我正在为没有工具提示数据但在文档中找不到任何帮助的国家/地区透明背景。
我需要在哪里设置颜色属性,甚至可以更改颜色?
var options = {
sizeAxis: {
minValue: 0,
maxSize: 100
},
colorAxis: {
colors: ['#8a4cab', '#8a4cab']
},
legend: 'none',
backgroundColor: 'transparent',
keepAspectRatio: true,
tooltip: {
isHtml: true
}
};
这是现在的样子:https://imgur.com/XRl7F8Z
答案 0 :(得分:0)
使用选项-> datalessRegionColor
例如
datalessRegionColor: 'transparent'
请参阅以下工作片段...
google.charts.load('current', {
packages: ['geochart'],
mapsApiKey: 'AIzaSyD-9tSrke72PouQMnMX-a7eZSW0jkFMBWY'
}).then(function () {
var data = google.visualization.arrayToDataTable([
['Country', 'value'],
['United States', 1],
['Canada', 1],
]);
var options = {
sizeAxis: {
minValue: 0,
maxSize: 100
},
colorAxis: {
colors: ['#8a4cab', '#8a4cab']
},
legend: 'none',
backgroundColor: 'transparent',
datalessRegionColor: 'transparent',
keepAspectRatio: true,
tooltip: {
isHtml: true
}
};
var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data, options);
});
#chart_div {
background-color: #000000;
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>