I'm trying plot markers in a specific city using google Geochart when the region is set to that state (so just that state is displayed, not the entire US). I can get the specific state to plot, but when I try to add a marker nothing displays.
Nothing displays when I try to put markers on cities
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ".dtd">
<html xmlns="">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Google Visualization API Sample</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['geochart']});
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([
['City', 'Population', 'Area'],
['Los Angeles', 2761477, 1285.31]
]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, region: 'US-CA', resolution: 'provinces'});
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization"></div>
</body>
</html>
However, I'm able to get it to plot when I just do it by state. So, swapping out the functions for this, it works just fine
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Country');
data.addColumn('number', 'Popularity');
data.addRow(['US-CA', 1000]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, region: 'US-CA', resolution: 'provinces'});
}
I'm trying plot markers in a specific city using google Geochart when the region is set to that state (so just that state is displayed, not the entire US). I can get the specific state to plot, but when I try to add a marker nothing displays.
Nothing displays when I try to put markers on cities
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3/1999/xhtml">
<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./jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['geochart']});
function drawMarkersMap() {
var data = google.visualization.arrayToDataTable([
['City', 'Population', 'Area'],
['Los Angeles', 2761477, 1285.31]
]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, region: 'US-CA', resolution: 'provinces'});
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization"></div>
</body>
</html>
However, I'm able to get it to plot when I just do it by state. So, swapping out the functions for this, it works just fine
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Country');
data.addColumn('number', 'Popularity');
data.addRow(['US-CA', 1000]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, region: 'US-CA', resolution: 'provinces'});
}
Share
Improve this question
edited May 17, 2012 at 3:10
user1104854
asked May 17, 2012 at 1:31
user1104854user1104854
2,16714 gold badges53 silver badges75 bronze badges
2 Answers
Reset to default 2I figured it out. I had to enable dataMode: 'Markers' in options
Province level maps (e.g., US-CA) is not supported by GeoMaps. Works in GeoChart. There is a feature request on the Google Visualization API bug reports and feature requests.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745452406a4628332.html
评论列表(0条)