Donut chart
author(s): Torstein Hønsi
by Geo George
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
In Highcharts, pies can also be hollow, in which case they are commonly
referred to as donut charts. This pie also has an inner chart, resulting
in a hierarchical type of visualization.
</p>
</figure>
CSS
.highcharts-figure, .highcharts-data-table table {
min-width: 320px;
max-width: 660px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #EBEBEB;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
JavaScript
var colors = Highcharts.getOptions().colors,
categories = [
'Chrome',
'Firefox',
'Internet Explorer',
'Safari',
'Edge',
'Opera',
'Other'
],
data = [
{
y: 62.74,
color: colors[2],
drilldown: {
name: 'Chrome',
categories: [
'Chrome v65.0',
'Chrome v64.0',
'Chrome v63.0',
'Chrome v62.0',
'Chrome v61.0',
'Chrome v60.0',
'Chrome v59.0',
'Chrome v58.0',
'Chrome v57.0',
'Chrome v56.0',
'Chrome v55.0',
'Chrome v54.0',
'Chrome v51.0',
'Chrome v49.0',
'Chrome v48.0',
'Chrome v47.0',
'Chrome v43.0',
'Chrome v29.0'
],
data: [
0.1,
1.3,
53.02,
1.4,
0.88,
0.56,
0.45,
0.49,
0.32,
0.29,
0.79,
0.18,
0.13,
2.16,
0.13,
0.11,
0.17,
0.26
]
}
},
{
y: 10.57,
color: colors[1],
drilldown: {
name: 'Firefox',
categories: [
'Firefox v58.0',
'Firefox v57.0',
'Firefox v56.0',
'Firefox v55.0',
'Firefox v54.0',
'Firefox v52.0',
'Firefox v51.0',
...