Skip to content

Instantly share code, notes, and snippets.

@bchumney
Created October 17, 2013 16:01
Show Gist options
  • Save bchumney/7027553 to your computer and use it in GitHub Desktop.
Save bchumney/7027553 to your computer and use it in GitHub Desktop.
JVectorMap Sample
<link rel="stylesheet" media="all" href="../jvectormap/jquery-jvectormap.css"/>
<script src="../jvectormap/jquery-jvectormap-1.1.1.min.js" type="text/javascript"></script>
<script src="../jvectormap/jquery-mousewheel.js" type="text/javascript"></script>
<script src="../jvectormap/tests/assets/jquery-jvectormap-world-mill-en.js" type="text/javascript"></script>
<script src="../jvectormap/tests/assets/jquery-jvectormap-us-aea-en.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
var states = {
"US-AL": 0, "US-AK": 1, "US-AZ": 2, "US-AR": 3, "US-CA": 4, "US-CO": 5, "US-CT": 6, "US-DE": 7, "US-DC": 8, "US-FL": 9, "US-GA": 10, "US-HI": 11, "US-ID": 12, "US-IL": 13, "US-IN": 14, "US-IA": 15, "US-KS": 16, "US-KY": 17, "US-LA": 18, "US-ME": 19, "US-MD": 20, "US-MA": 21, "US-MI": 22, "US-MN": 23, "US-MS": 24, "US-MO": 25, "US-MT": 26, "US-NE": 27, "US-NV": 28, "US-NH": 29, "US-NJ": 30, "US-NM": 31, "US-NY": 32, "US-NC": 33, "US-ND": 34, "US-OH": 35, "US-OK": 36, "US-OR": 37, "US-PA": 38, "US-RI": 39, "US-SC": 40, "US-SD": 41, "US-TN": 42, "US-TX": 43, "US-UT": 44, "US-VT": 45, "US-VA": 46, "US-WA": 47, "US-WV": 48, "US-WI": 49, "US-WY": 50
};
$('#map').vectorMap({
map: 'us_aea_en',
series: {
regions: [{
values: states,
scale: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial'
}]
},
onRegionLabelShow: function(e, el, code){
el.html(el.html()+' (Average one-time gift: $'+states[code]+')');
}
});
});
</script>
<div id="map" style="width: 100%; height: 600px;"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment