我想在Google圖表中創建與美國所有國家和所有州的地圖圖表。 這可能嗎?我該怎麼做? 謝謝!聯盟美國各州和所有國家在谷歌圖表中的一個地圖圖表
google.load("visualization", "1", {packages:["geochart"]});
google.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['Brazil', 400],
['Canada', 500],
['France', 600],
['RU', 700],
// and there I want to add states to the chart
['Texas', 300],
['Ohio', 200]
]);
var options = {};
var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
chart.draw(data, options);
}
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['geochart']}]}"></script>
<div id="regions_div"></div>
我們不代碼給你,當你在你的代碼中遇到問題時,我們會給你幫助,所以寫下你已經嘗試過的東西(如果有的話)。 – jmattheis
@Rocky我添加了一些代碼。我只在google的默認示例中添加了一些字符串。 – Badfishmaan
那麼只需將它們添加到數組中? – jmattheis