Highcharts.getJSON(
'https://cdn.jsdelivr.net/gh/highcharts/highcharts@c116b6fa6948448/samples/data/us-counties-unemployment.json',
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
* 4. Verify that the length of the data is reasonable, about 3300
* counties.
*/
var countiesMap = Highcharts.geojson(
Highcharts.maps['countries/us/us-all-all']
),
// Extract the line paths from the GeoJSON
lines = Highcharts.geojson(
Highcharts.maps['countries/us/us-all-all'], 'mapline'
),
// Filter out the state borders and separator lines, we want these
// in separate series
borderLines = Highcharts.grep(lines, function (l) {
return l.properties['hc-group'] === '__border_lines__';
}),
separatorLines = Highcharts.grep(lines, function (l) {
return l.properties['hc-group'] === '__separator_lines__';
});
// Add state acronym for tooltip
Highcharts.each(countiesMap, function (mapPoint) {
mapPoint.name = mapPoint.name + ', ' +
mapPoint.properties['hc-key'].substr(3, 2);
});
document.getElementById('container').innerHTML = 'Rendering map...';
// Create the map
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.