我試圖在我的應用中實現this demo,但無論值如何,我都會獲得全黑地圖。這裏是我的代碼:amChart heat位置敏感地圖
var map = AmCharts.makeChart("chartdiv", {
"type": "map",
"theme": "light",
"colorSteps": 10,
"dataProvider": {
"mapURL": "https://www.amcharts.com//lib/3/maps/svg/iranLow.svg",
"getAreasFromMap": true,
"zoomLevel": 0.9,
"areas": []
},
"areasSettings": {
"autoZoom": true,
"balloonText": "[[title]]: <strong>[[value]]</strong>"
},
"valueLegend": {
"right": 10,
"minValue": "little",
"maxValue": "a lot!"
},
"zoomControl": {
"minZoomLevel": 0.9
},
"titles": 'titles',
"listeners": [ {
"event": "init",
"method": updateHeatmap
} ]
});
function updateHeatmap(event) {
var map = event.chart;
if (map.dataGenerated)
return;
if (map.dataProvider.areas.length === 0) {
setTimeout(updateHeatmap, 100);
return;
}
for (var i = 0; i < map.dataProvider.areas.length; i++) {
map.dataProvider.areas[ i ].value = Math.round(Math.random() * 10000);
}
map.dataGenerated = true;
map.validateNow();
}
有什麼我應該做的,以獲得基於值的顏色範圍?
您是否在項目中包含光源主題源? – barbsan
@barbsan是的,我已經包含了'amchart.js','ammap.js'和'light theme' – mhesabi