Highcharts sunburst dodrilldown

Viewed 120

I have two sunburst graphs, with exact same data structure, for different time periods. I would like to drilldown on the second graph to mimic the user drilldown on the first graph. I cannot get this to work, please see code below.

        var data = [
                { id: 'START', name: 'START'},
                { id: 'One', name: 'One', parent: 'START' },
                { id: 'OneOne', name: 'OneOne', parent: 'One', value: 30 },
                { id: 'OneTwo', name: 'OneTwo', parent: 'One', value: 70 }
            ];
var chart1;
var chart2;

$(document).ready(function () {

chart2=Highcharts.chart('container2', {
            series: [{
                type: "sunburst", data: data, allowTraversingTree: true
            }]
        });


chart1=Highcharts.chart('container1', {
            series: [{
                type: "sunburst", data: data, allowTraversingTree: true,
                point: {
                       events: {
                            click: function () {
                    chart2.series[0].data[1].doDrilldown();
                                        chart2.redraw();
                                    }
                              }
                        }
            }]
        });

        })
<script src='https://code.jquery.com/jquery-3.3.1.js'></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sunburst.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>

<div id="container1"></div>
<div id="container2"></div>

Thanks Chris

1 Answers
Related