0
我的數據表:標記在錯誤位置標繪
Country Types of sales Total sales($) Name State
United states of America chemicals 12662871 Obama GA
United states of America electronics 20145684 Romney ON
United states of America textiles 22458756 Gliton MB
United states of America automobiles 34235684 Andrew Jackson BC
United states of America chemicals 19438333 James Madison AB
不是給狀態欄,如果我給的名字列名也繪製在地圖geochart像在附件文件。
這隻有在displayMode是標記時纔會發生。
Javascript代碼:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Google Visualization API Sample</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([
['Name', 'Total Sales'],
['Romney', 20145684],
['Obama', 12662871],
['Gliton', 22458756],
['Andrew Jackson', 34235684],
['James Madison', 19438333]
]);
var options = {
region: 'US',
resolution: 'provinces',
displayMode:'markers',
width: 400,
height: 400,
colorAxis: {
//values: [-1, 0, 1],
colors: ['#FF0000']
}
};
var geochart = new google.visualization.GeoChart(document.getElementById('visualization'));
geochart.draw(data, options);
google.visualization.events.addListener(geochart, 'select', function (eventOption) {
var item = geochart.getSelection();
var value = data.getValue(item[0].row, 1);
alert(value);
});
}
google.load('visualization', '1', { packages: ['geochart'] });
google.setOnLoadCallback(drawMarkersMap);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization"></div>
</body>
</html>
請您提供解決方案來解決它。
在此先感謝。
我真的不明白你要在這裏做什麼。您的示例代碼不包含地理位置。你能否改變你的例子,以顯示職位(除了銷售量)? –