HightCharts Stacked DrillDown

author(s): Torstein Hønsi

by BluePampa

HTML

<script src="http://github.highcharts.com/highcharts.js"></script>
<script src="http://github.highcharts.com/modules/drilldown.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

JavaScript

$(function () {    

    // Create the chart
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Basic drilldown'
        },
        xAxis: {
            type: 'category'
        },

        legend: {
            enabled: true
        },

        plotOptions: {
            series: {
                borderWidth: 0,
                dataLabels: {
                    enabled: false
                },
                stacking: 'normal'
            }
        },
        
        tooltip: {
            pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
            shared: true
        },
        
        series: [{
            name: 'Things',
            data: [{
                
                name: 'Animals',
                y: 5,
                drilldown: 'animals'
            }, {
                name: 'Fruits',
                y: 2,
                drilldown: 'fruits'
            }, {
                name: 'Cars',
                y: 4,
                drilldown: 'cars'
            }]
        }, {
            name: 'Things2',
            data: [{
                name: 'Animals',
                y: 1,
                drilldown: 'animals2'
            }, {
                name: 'Fruits',
                y: 5,
                drilldown: 'fruits2'
            }, {
                name: 'Cars',
                y: 2,
                drilldown: 'cars2'
            }]
        }, {
            name: 'Things3',
            stack: 1,
            data: [{
                name: 'Animals',
                y: 8,
                drilldown: 'animals3'
            }, {
                name: 'Fruits',
                y: 7,
                drilldown: 'fruits3'
            }, {
                name: 'Cars',
                y: 10,
                drilldown: 'cars3'
            }]
        },{
            name: 'Things4',
            stack: 1,
     ...