gpt4 book ai didi

javascript - Google GeoCharts 颜色不起作用

转载 作者:行者123 更新时间:2023-11-28 04:30:34 24 4
gpt4 key购买 nike

我尝试了多种应用方法,但似乎都无法改变我的图表。我正在通过文件上传数组,一切似乎都有效,甚至更改了默认颜色,但 colorAxis 似乎不起作用。你们(和女孩)能帮助我吗,我将不胜感激。谢谢

/* CSV handling - START */

var processedData = [];

var continent = $('select[name="continents"] option:selected').val();

$.get('example.csv', function(data) {

processedData = $.csv.toArrays(data);

}, 'text');


/* CSV handling - END */

/* Google Charts */



google.charts.load('current', {
'packages':['geochart'],
// Note: you will need to get a mapsApiKey for your project.
// See: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
'mapsApiKey': //doesn't matter
});
google.charts.setOnLoadCallback(drawRegionsMap);

function drawRegionsMap() {
var data = google.visualization.arrayToDataTable(processedData, false);

var options = {
sizeAxis: { minValue: 0, maxValue: 100 },
colorAxis: {colors: ['#e7711c', '#4374e0']},
region: continent,
width: '100%',
height: '100%',
backgroundColor: 'none'
};

var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));

chart.draw(data, options);
}

/* Google Charts - End */

最佳答案

请参阅 Google 开发者引用

https://developers.google.com/chart/interactive/docs/gallery/geochart#important

var 选项 = { 地区: '002',//非洲 colorAxis: {颜色: ['#00853f', '黑色', '#e31b23']}, 背景颜色: '#81d4fa', datalessRegionColor: '#f8bbd0', 默认颜色:'#f5f5f5', };

https://developers.google.com/chart/interactive/docs/gallery/geochart#coloring-your-chart

var 选项 = { 地区:“IT”, 显示模式:'标记', colorAxis: {颜色: ['绿色', '蓝色']} };

  var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data, options);

关于javascript - Google GeoCharts 颜色不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44641467/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com