JSFiddle - React, Tailwind, and code Playground
by Vignesh Gopalakrishnan
JavaScript
Highcharts.chart('container', {
series: [{
type: 'treemap',
layoutAlgorithm: 'stripes',
alternateStartingDirection: true,
borderColor: '#fff',
borderRadius: 6,
borderWidth: 2,
dataLabels: {
style: {
textOutline: 'none'
}
},
levels: [{
level: 1,
layoutAlgorithm: 'sliceAndDice',
dataLabels: {
enabled: true,
align: 'left',
verticalAlign: 'top',
style: {
fontSize: '15px',
fontWeight: 'bold'
}
}
}],
data: [{
id: 'A',
name: 'Revenue',
color: '#50FFB1'
}, {
id: 'B',
name: 'Cost',
color: '#F5FBEF'
}, {
name: 'Revenue from solar electricity sales',
parent: 'A',
value: 20.37
}, {
name: 'Revenue from export',
parent: 'A',
value: 1.40
}, {
name: 'Maintenance costs',
parent: 'B',
value: 2.23
}, {
name: 'Export metering',
parent: 'B',
value: 0.96
}]
}],
title: {
text: 'Norwegian regions and counties by area',
align: 'left'
},
subtitle: {
text:
'Source: <a href="https://snl.no/Norge" target="_blank">SNL</a>',
align: 'left'
},
tooltip: {
useHTML: true,
pointFormat:
'The area of <b>{point.name}</b> is <b>{point.value} km<sup>2</sup></b>'
}
});