Highcharts Demo
author(s): Torstein Hønsi
by Ravi A
HTML
<div id="container" style="height: 520px; min-width: 310px; width: 800px; margin: 0 auto; text-align:center; line-height: 520px">
Downloading map...
</div>
<script src="https://code.highcharts.com/maps/highmaps.js"></script>
<script src="https://code.highcharts.com/maps/modules/data.js"></script>
<script src="https://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="https://code.highcharts.com/mapdata/countries/us/us-all-all.js"></script>
JavaScript
$(function () {
$.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=us-counties-unemployment.json&callback=?', function (data) {
/**
* Data parsed from http://www.bls.gov/lau/#tables
*
* 1. Go to http://www.bls.gov/lau/laucntycur14.txt (or similar, updated datasets)
* 2. In the Chrome Developer tools console, run this code:
* copy(JSON.stringify(document.body.innerHTML.split('\n').filter(function (s) { return s.indexOf('<PUT DATE HERE IN FORMAT e.g. Feb-14>') !== -1; }).map(function (row) { row = row.split('|'); return { code: 'us-' + row[3].trim().slice(-2).toLowerCase() + '-' + row[2].trim(), name: row[3].trim(), value: parseFloat(row[8]) }; })))
* 3. The data is now on your clipboard, paste it below
*/
var countiesMap = Highcharts.geojson(Highcharts.maps['countries/us/us-all-all']),
lines = Highcharts.geojson(Highcharts.maps['countries/us/us-all-all'], 'mapline'),
options;
// Add state acronym for tooltip
Highcharts.each(countiesMap, function (mapPoint) {
mapPoint.name = mapPoint.name + ', ' + mapPoint.properties['hc-key'].substr(3, 2);
});
options = {
chart: {
},
title: {
text: 'US Counties unemployment rates, April 2015'
},
mapNavigation: {
enabled: true
},
colorAxis: {
},
plotOptions: {
mapline: {
showInLegend: false,
enableMouseTracking: false
}
},
series: [{
mapData: countiesMap,
data: data,
joinBy: ['hc-key', 'code'],
name: 'Unemployment rate',
tooltip: {
valueSuffix: '%'
...