我正在尝试填充Google Charts中的地理图表。
基本上,我在SELECT avg(TValue)
from
(
-- this will give you only the values for the current part/ppf/dimension
select * from ProductProperty
where Partno = @Partno and PPFno = @PPFno and DName = @Dimension
) myrow
unpivot
(
TValue
for TCol in (T1, T2, ... T44, T45)
) as x
中进行人数统计。如果我仅执行STATE, ZIPCODE, COUNT
和STATE
,则效果很好。但是当我尝试添加邮政编码时,地图生成不正确。
那是我的代码:
COUNT
我不明白为什么将邮政编码添加到数据中时,它只会返回一个空白地图。如果我将<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
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': 'AIzaSyD-9tSrke72PouQMnMX-a7eZSW0jkFMBWY'
});
google.charts.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['State', 'Count'],
['FL', 16],
['MA', 2149],
['NY', 2784],
['NC', 9782],
['PA', 9923],
['WA', 15],
<!-- i want to be able to have the following on the geochart -->
/*['State', 'Zip Code', 'Count'],
['AZ',85013,1],
['CA',91945,12],
['CA',96003,1],
['CA',18045,25],
['CA',92377,1],
['CA',93703,10],
['CA',95407,1],
['CA',93720,6],
['CA',93619,1],
['CA',92009,8],
['CA',93727,1],
['CO',80003,5],
['CO',80004,1],
['CO',80220,2],
['CO',80504,8],
['CO',80134,21],
['CO',80016,1],
['CO',80228,19],
['CO',80111,3],
['CT',06795,1],
['CT',06762,12],*/
]);
var options = {
region: 'US',
displayMode: 'markers',
resolution: 'provinces',
colorAxis: {colors: ['#fff9ef', '#fffa00']}
};
var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="regions_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
更改为resolution
,则与'metros'
相比,它似乎在地图上提供了更精细的级别。
在Google GeoCharts中这可能吗?