Skip to content

Instantly share code, notes, and snippets.

@owendall
Created May 12, 2012 17:12
Show Gist options
  • Save owendall/2667680 to your computer and use it in GitHub Desktop.
Save owendall/2667680 to your computer and use it in GitHub Desktop.
Sample geomap with markers instead of state shading
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/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.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['geomap']});
/** 2012-05-12: Data are draft and not for publication **/
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'State');
data.addColumn('number', 'Dollars');
data.addRow(['US-MN',10463387]);
data.addRow(['US-IA',7815523]);
data.addRow(['US-MA',6597251]);
data.addRow(['US-OH',6160677]);
data.addRow(['US-CA',5713277]);
data.addRow(['US-NC',5168873]);
data.addRow(['US-OK',4883011]);
data.addRow(['US-NY',3466933]);
data.addRow(['US-CO',3071108]);
data.addRow(['US-IL',2800000]);
data.addRow(['US-FL',2786576]);
data.addRow(['US-PA',2502642]);
data.addRow(['US-GA',2136936]);
data.addRow(['US-NE',2041969]);
data.addRow(['US-WI',2000000]);
data.addRow(['US-NH',1861488]);
data.addRow(['US-WA',1839909]);
data.addRow(['US-TN',1801169]);
data.addRow(['US-MS',1409011]);
data.addRow(['US-TX',1316388]);
data.addRow(['US-NM',1286768]);
data.addRow(['US-KY',999964]);
data.addRow(['US-MT',990500]);
data.addRow(['US-NJ',971799]);
data.addRow(['US-SC',894203]);
data.addRow(['US-LA',791866]);
data.addRow(['US-UT',761386]);
data.addRow(['US-VT',746913]);
data.addRow(['US-KS',690000]);
data.addRow(['US-VA',656526]);
data.addRow(['US-AR',449993]);
data.addRow(['US-MI',376616]);
data.addRow(['US-OR',254274]);
var formatter = new google.visualization.NumberFormat(
{prefix: '$', fractionDigits: 0});
formatter.format(data, 1); // Apply formatter to second column
var geochart = new google.visualization.GeoMap(
document.getElementById('visualization'));
geochart.draw(data, {width: 960, height: 400, region: 'US', resolution: 'provinces', dataMode: 'markers'});
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment