Highcharts Demo
author(s): Torstein Hønsi
by sqiudward
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<h1 id="context">
</h1>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
var context = "things";
updateContext(context);
function updateContext(ctx){
document.getElementById('context').innerHTML = ctx;
};
var c = {
chart: {
type: 'column',
events: {
drilldown: function (e) {
console.log(e);
updateContext(e.seriesOptions.id);
},
drillup: function(e){
console.log(e);
updateContext(e.seriesOptions.id);
}
}
},
title: {
text: 'Async drilldown'
},
xAxis: {
type: 'category',
title: {
text: 'Things'
}
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: [{
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals',
y: 5,
drilldown: 'animals'
}, {
name: 'Fruits',
y: 2,
drilldown: true
}, {
name: 'Cars',
y: 4,
drilldown: true
}]
}],
drilldown: {
series: [{id:'animals', data:[["cat", 2]]}]
}
};
// Create the chart
Highcharts.chart('container', c);