Skip to content

Instantly share code, notes, and snippets.

@bridgpal
Created December 31, 2012 17:47
Show Gist options
  • Save bridgpal/4421549 to your computer and use it in GitHub Desktop.
Save bridgpal/4421549 to your computer and use it in GitHub Desktop.
Simple Google geochart example
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawMarkersMap);
function drawMarkersMap() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Country');
data.addColumn('number', 'Value');
data.addColumn({type:'string', role:'tooltip'});
data.addRows([[{v:"Philadelphia, PA",f:"Philadelphia"},1,"Where I live"]]);
data.addRows([[{v:"San Francsico, CA",f:"San Francsico"},1,"Where I'm moving to"]]);
var options = {
region: 'US',
displayMode: 'markers',
resolution: 'provinces',
legend: 'none',
enableRegionInteractivity: 'true',
sizeAxis: {minSize:5, maxSize: 5},
colorAxis: {minValue: 1, maxValue:1, colors: ['#B92B3D']}
};
var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data, options);
};
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment