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
// Prepare random data
var data = [
['US', Math.floor(Math.random() * 100000)],
['GB', Math.floor(Math.random() * 100000)],
];
Highcharts.getJSON('https://onelazy.dev/map-world-palestine.geo.json', function(geojson) {
// Initiate the chart
Highcharts.mapChart('container', {
chart: {
map: geojson
},
title: {
text: 'World Highmaps Example'
},
mapNavigation: {
enabled: true,
buttonOptions: {
verticalAlign: 'bottom'
}
},
colorAxis: {
tickPixelInterval: 100
},
series: [{
data: data,
keys: ['iso-a2', 'value'],
joinBy: 'iso-a2',
name: 'Streams',
states: {
hover: {
color: '#a4edba'
}
},
dataLabels: {
enabled: true,
format: '{point.properties.postal}'
}
}]
});
});