Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts: How do I set dynamic data to the drilldown pie chart?

I am able to set data to the main pie chart using

var data = [1,2,3,4,5]; //value of data will be returned through an AJAX call
chart1.series[0].setData(data);

Similarly, how do I set the drilldown data dynamically?

I tried with

chart1.drilldown[0].data = '[1,2,3]';

but it did not work.

I am using RESTful services to expose data.

like image 787
Karthik VU Avatar asked May 19 '15 05:05

Karthik VU


1 Answers

You can access drilldown at runtime using chart.options.drilldown

var newDrillDowns = {
                id: 'my drilldowns',
                data: [
                    ['Cat1', 4],
                    ['Cat2', 2],
                    ['Cat3', 1]
                ]};

chart.options.drilldown.series[0] = newDrillDowns;

In the same way you can replace drilldowns completely

chart.options.drilldown.series = [newDrillDowns];
like image 101
Igor Popov Avatar answered Nov 07 '22 00:11

Igor Popov