Highcharts: How to set dynamic data to a Pie Chart?

I can set the 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 can I dynamically tune drillthrough data?

I tried using

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

but it didn’t work.

I use services RESTfulto display data.

+4
source share
1 answer

You can access the scan 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 completely replace the sweep

chart.options.drilldown.series = [newDrillDowns];
+10
source

All Articles