Sunburst
Numeric dimension
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sunburst.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container"></div>
CSS
#container {
min-width: 310px;
max-width: 600px;
margin: 0 auto
}
JavaScript
var colors = Highcharts.getOptions().colors;
// Splice in transparent for the center circle
Highcharts.getOptions().colors.splice(0, 0, 'transparent');
Highcharts.chart('container', {
chart: {
height: '100%',
},
title: {
text: 'Customer Sales'
},
plotOptions: {
sunburst: {}
},
series: [{
type: "sunburst",
data: [{
id: '0.0'
}, {
id: '1.0',
parent: '0.0',
name: 11,
color: colors[1]
}, {
parent: '1.0',
name: 110,
value: 147
}, {
parent: '1.0',
name: 111,
value: 1151
}, {
parent: '1.0',
name: 112,
value: 1157
}, {
id: '2.0',
name: 22,
parent: '0.0',
color: colors[2]
}, {
parent: '2.0',
name: 210,
value: 3366
}, {
parent: '2.0',
name: 211,
value: 905
}, {
parent: '2.0',
name: 212,
value: 2531
}, {
id: '3.0',
name: 33,
parent: '0.0',
color: colors[3]
}, {
parent: '3.0',
name: 310,
value: 5438
}, {
parent: '3.0',
name: 311,
value: 840
}, {
parent: '3.0',
name: 312,
value: 2753
}, {
id: '4.0',
name: 44,
parent: '0.0',
color: colors[4]
}, {
parent: '4.0',
name: 410,
value: 234
}, {
parent: '4.0',
name: 411,
value: 15261
}],
allowDrillToNode: true,
cursor: 'pointer',
dataLabels: {
/**
* A custom formatter that returns the name only if the inner arc
* is longer than a certain pixel size, so the shape has place for
* the label.
*/
formatter: function() {
var shape = this.point.node.shapeArgs;
var innerArcFraction = (shape.end - shape.start) / (2 * Math.PI);
var perimeter = 2 * Math.PI * shape.innerR;
var innerArcPixels = innerArcFraction * perimeter;
if (innerArcPixels > 16) {
...