Tree map with levels
by Black Label
HTML
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/treemap.js"></script>
<div id="container"></div>
JavaScript
Highcharts.theme = {
colors: [
"#2D2357",
"#4B3A7D",
"#614FA2",
"#7765C7",
"#8E7BED",
"#A392F5",
"#B8A8FF",
"#CCC0FF",
"#E0D9FF"
],
chart: {
panning: {
enabled: false
},
zooming: {
mouseWheel: {
enabled: false
}
},
style: {
fontFamily: 'Montserrat, sans-serif'
},
},
credits: {
enabled: false
},
title: {
style: {
fontWeight: 'normal',
color: 'black',
fontSize: '16px'
}
},
legend: {
symbolRadius: 0,
itemStyle: {
fontWeight: 'normal',
color: 'black',
fontSize: '12px'
}
},
plotOptions: {
series: {
borderRadius: 0,
borderWidth: 0.5,
borderColor: null,
dataLabels: {
style: {
fontWeight: 'normal',
color: 'black',
fontSize: '12px'
}
}
}
},
xAxis: {
title: {
style: {
fontSize: 14,
fontWeight: 'normal',
color: 'black',
}
},
labels: {
style: {
fontSize: 12,
fontWeight: 'normal',
color: 'black',
}
}
},
yAxis: {
title: {
style: {
fontSize: 14,
fontWeight: 'normal',
color: 'black',
}
},
labels: {
style: {
fontSize: 12,
fontWeight: 'normal',
color: 'black',
}
}
}
};
Highcharts.setOptions(Highcharts.theme);
Highcharts.chart('container', {
credits: {
enabled: false
},
series: [{
type: 'treemap',
layoutAlgorithm: 'stripes',
alternateStartingDirection: true,
borderColor: '#fff',
borderWidth: 1,
dataLabels: {
style: {
textOutline: 'none',
color: 'white',
fontSize: '14px'
}
},
levels: [{
level: 1,
layoutAlgorithm: 'strip',
dataLabels: {
enabled: true,
align: 'left',
verticalAlign: 'top',
style: {
...