Highcharts Demo

author(s): Torstein Hønsi

by Rafael Nepomuceno

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.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: 'Highcharts multi-series drilldown'
        },
        subtitle: {
            text: 'The <em>allowPointDrilldown</em> option makes point clicks drill to the whole category'
        },
        xAxis: {
            type: 'category'
        },

        plotOptions: {
            series: {
                stacking: 'normal',
                borderWidth: 0,
                dataLabels: {
                    inside: false,
                    enabled: true,
                    color: 'black'
                }
            }
        },

        series: [{
            stack: '2010',
            name: '2010',
            data: [{
                name: 'Republican',
                y: 5,
                drilldown: 'republican-2010'
            }, {
                name: 'Democrats',
                y: 2,
                drilldown: 'democrats-2010'
            }, {
                name: 'Other',
                y: 4,
                drilldown: 'other-2010'
            }]
        }, {
            stack: '2014',
            name: '2014',
            data: [{
                name: 'Republican',
                y: 4,
                drilldown: 'republican-2014'
            }, {
                name: 'Democrats',
                y: 4,
                drilldown: 'democrats-2014'
            }, {
                name: 'Other',
                y: 4,
                drilldown: 'other-2014'
            }]
        }, {
            stack: '2014',
            showInLegend: false,
            enableMouseTracking: false,
            color: 'none',
            name: '2018 forecast',
            dataLabels: {
                enabled: false
            },
            data: [{
                name: 'Republican',
                y: 0,
                drilldown: 'republican-2018'
            }, {
                name: 'Democrats',
   ...