Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts drilldown - when useing setData chart doesn't stay drilled down

I've got a highcharts chart with the drilldown module which works just fine. At some point I'd like to update the chart with a new set of data. I use

chart.options.drilldown.series = drilldownSeries;

//This forces the chart to go back to level one     
chart.series[0].setData(brandsData);

And it gives a nice animation with the updated data. However when I am 'drilled down' and I use the setData the chart goes back to the first level, as if I wasn't drilled down.

See: http://jsfiddle.net/n0y4vu24/1/

First: Press update data - You see the first bar moving to 20 which is fine. Run jsfiddle again, but before pressing update data click the first bar. Now when you press update data it will go back to the 'brands' chart not stay and update the drill down chart

Is there a way to stay at the current chart / current level of the drilldown?

like image 479
Richard Deurwaarder Avatar asked Nov 11 '22 01:11

Richard Deurwaarder


1 Answers

It is caused because you update first serie (index 0), not drilldown serie. So behaviour is correct, but in your case you need to destroy chart and prepare new one with new data, because setData is not available in the drilled points.

like image 87
Sebastian Bochan Avatar answered Nov 14 '22 23:11

Sebastian Bochan