Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
US State Map using the GeoChart from the Google Chart Tools Based off of the Official Google JSFiddle
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<div id="regions_div" style="width: 900px; height: 500px;"></div>
google.charts.load('current', {'packages':['geochart']});
google.charts.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['State', 'Enabled'],
['US-AL', 1],
['US-AK', 1],
['US-AR', 1],
['US-AZ', 1],
['US-CA', 1],
['US-CO', 1],
['US-CT', 0],
['US-DE', 0],
['US-DC', 0],
['US-FL', 0],
['US-GA', 0],
['US-HI', 0],
['US-ID', 0],
['US-IL', 0],
['US-IN', 0],
['US-IA', 0],
['US-KS', 0],
['US-KY', 0],
['US-LA', 0],
['US-MA', 0],
['US-MD', 0],
['US-ME', 0],
['US-MI', 0],
['US-MN', 0],
['US-MS', 0],
['US-MO', 0],
['US-MT', 0],
['US-NC', 0],
['US-ND', 0],
['US-NE', 0],
['US-NH', 0],
['US-NJ', 0],
['US-NM', 0],
['US-NV', 0],
['US-NY', 0],
['US-OH', 0],
['US-OK', 0],
['US-OR', 0],
['US-PA', 0],
['US-RI', 0],
['US-SC', 0],
['US-SD', 0],
['US-TN', 0],
['US-TX', 0],
['US-UT', 0],
['US-VA', 0],
['US-VT', 0],
['US-WA', 0],
['US-WI', 0],
['US-WV', 0],
['US-WY', 0]
]);
var options = {
region: "US",
resolution: "provinces"
colorAxis: {colors: ['#ff8800']},
defaultColor: '#f5f5f5'
};
var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
chart.draw(data, options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment