Highcharts - Async Multi-Drilldown

modified by: Me author(s): Torstein Hønsi

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',
            events: {
                drilldown: function (e) {
                    if (!e.seriesOptions) {
console.log("is",e.point.name)
var n=e.point.name;
                        var chart = this,
                            drilldowns = {
                                n: {
                                    name: 'Animals',
                                    data: [
                                        {
                                            name: 'Cats',
                                            y: 2,
                                            drilldown: 'cats'
                                        },
                                        ['Cows', 2],
                                        ['Sheep', 3]
                                    ]
                                },
                                
                                
                                'Cats': {
                                 	name: 'Cats',
                                    data: [
                                     	['Siamese', 1],
                                        ['Calico', 1]
                                    ]
                                }
                            },
                            series = drilldowns[n];

                        // Show the loading label
                        chart.showLoading('Simulating Ajax ...');

                        setTimeout(function () {
                            chart.hideLoading();
                            chart.addSeriesAsDrilldown(e.point, series);
                        }, 1000);
                    }

                }
            }
        },
        title: {
            text: 'Async drilldown'
        },
        xAxis: {
            type: 'category'
        },

        legend: {
            enabled: false
        },

        plotOptions: {
           ...