JSFiddle - React, Tailwind, and code Playground
by Luke Marlow
HTML
<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/maps/modules/offline-exporting.js"></script>
<div id="container"></div>
CSS
#container {
height: 500px;
min-width: 310px;
max-width: 800px;
margin: 0 auto;
}
JavaScript
var data = [];
Highcharts.getJSON('https://onelazy.dev/maps-gb-all.geo.json', function(geojson) {
Highcharts.mapChart('container', {
chart: {
map: geojson
},
title: {
text: 'Britain Highmaps Example'
},
mapNavigation: {
enabled: true,
buttonOptions: {
verticalAlign: 'bottom'
}
},
colorAxis: {
tickPixelInterval: 100
},
series: [{
data: data,
keys: ['hasc', 'value'],
joinBy: 'hasc',
name: 'Streams',
states: {
hover: {
color: '#a4edba'
}
},
dataLabels: {
enabled: true,
format: '{point.properties.postal}'
}
}]
});
});