gpt4 book ai didi

google-api - Geochart 美国各州使用 Google GeoCharts API

转载 作者:行者123 更新时间:2023-12-01 04:37:20 25 4
gpt4 key购买 nike

我想制作可选州的美国 map similar to what's shown here .

Source

enter image description here

除了,而不是多个国家,我只想呈现美国各州,类似于以下内容。

enter image description here

In this jsBin ,我希望看到在悬停一些弹出文本时突出显示的各个状态。然而,我实际上只看到美国的灰色背景轮廓,没有可辨别的个别州。

请提供一个可以完成任务的有效jsBin。

http://jsbin.com/jodesitoto/edit?html,输出

<!DOCTYPE html>
<html>
<head>
<!---- >
https://developers.google.com/chart/interactive/docs/gallery/geochart#full
<!---->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['geochart']});
google.charts.setOnLoadCallback(drawRegionsMap);

function drawRegionsMap() {

var data = google.visualization.arrayToDataTable([
['State', 'Select'],
['US-AL', 0],
['US-AK', 0],
['US-AR', 0],
['US-AK', 0],
['US-AZ', 0],
['US-Colorado', 0],
['US-CO', 0],
['US-DE', 0],
['US-FL', 0],
['US-HI', 0],
['US-KS', 0],
['US-KY', 0],
['US-MI', 0],
['US-MO', 0],
['US-MS', 0],
['US-MT', 0],
['US-NE', 0],
['US-NJ', 0],
['US-NM', 0],
['US-NY', 0],
['US-OR', 0],
['US-PA', 0],
['US-TX', 0],
['US-UT', 0],
['US-VA', 0],
['US-WA', 0],
['US-WV', 0],
['US-WY', 0],
]);

var options = {
region: 'US',
displayMode: 'regions',
};

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

chart.draw(data, options);
}
</script>
</head>
<body>
<div id="geochart" style="width: 900px; height: 500px;"></div>
</body>
</html>

最佳答案

添加 resolution: 'provinces',options目的。

    var options = {
region: 'US',
displayMode: 'regions',
resolution: 'provinces',
};

关于google-api - Geochart 美国各州使用 Google GeoCharts API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35100909/

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