Tilemap, circles
author(s):
Mustapha Mekhatria
HTML
<script src="https://code.highcharts.com/maps/highmaps.js"></script>
<script src="https://code.highcharts.com/modules/tilemap.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/offline-exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<div id="container"></div>
CSS
body {
background: var(--highcharts-background-color);
color: var(--highcharts-neutral-color-100);
}
#container {
min-width: 320px;
max-width: 550px;
margin: 0 auto;
}
JavaScript
Highcharts.chart('container', {
chart: {
type: 'tilemap',
height: '125%'
},
title: {
text: 'Africa Real GDP Growth for 2023',
align: 'left'
},
accessibility: {
point: {
valueDescriptionFormat: '{xDescription}, forecasted ' +
'{point.value}% growth.'
}
},
lang: {
accessibility: {
chartTypes: {
defaultSingle: 'Map with fixed circle areas laid out in the ' +
'shape of Africa. The map shows {numPoints} countries.'
}
}
},
xAxis: {
visible: false
},
yAxis: {
visible: false
},
legend: {
enabled: true,
layout: 'vertical',
align: 'left',
y: -20,
floating: true
},
colorAxis: {
dataClasses: [{
to: 0,
color: '#ff9999',
name: 'Negative'
}, {
from: 0,
to: 2,
color: '#e8f5e9',
name: 'Weak'
}, {
from: 2,
to: 5,
color: '#81c784',
name: 'Average'
}, {
from: 5,
to: 6,
color: '#43a047',
name: 'Strong'
}, {
from: 6,
color: '#1b5e20',
name: 'Stellar'
}]
},
tooltip: {
headerFormat: '',
pointFormat: 'The real GDP growth of <b>{point.name}</b> is <b>' +
'{point.value}</b> %'
},
plotOptions: {
series: {
tileShape: 'circle',
dataLabels: {
enabled: true,
format: '{point.iso-a3}',
color: '#000000',
style: {
textOutline: false
}
}
}
},
// https://tradingeconomics.com/country-list/gdp-annual-growth-rate?continent=africa
series: [{
data: [{
...