Highcharts Demo
author(s): Torstein Hønsi
by sgearhart2
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<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/mapdata/custom/world.js"></script>
<div id="container" style="height: 500px; min-width: 310px; max-width: 800px; margin: 0 auto"></div>
JavaScript
$.getJSON('https://cdn.jsdelivr.net/gh/highcharts/[email protected]/samples/data/world-population-density.json', function (data) {
// Instanciate the map
Highcharts.mapChart('container', {
title: {
text: 'World population 2010 by country'
},
subtitle: {
text: 'Demo of map button theming'
},
legend: {
enabled: false
},
mapNavigation: {
enabled: true,
buttonOptions: {
theme: {
fill: 'white',
'stroke-width': 1,
stroke: 'silver',
r: 0,
states: {
hover: {
fill: '#a4edba'
},
select: {
stroke: '#039',
fill: '#a4edba'
}
}
},
verticalAlign: 'top',
alignTo: 'plotBox'
}
},
colorAxis: {
minColor: '#efecf3',
maxColor: '#990041',
startOnTick: false,
endOnTick: false,
type: 'logarithmic'
},
series: [{
name: 'Population',
mapData: Highcharts.maps['custom/world'],
data: data,
joinBy: ['iso-a2', 'code'],
tooltip: {
pointFormat: '{point.code}: {point.value:,f},000'
}
}]
});
});