highcharts
highcharts copied to clipboard
Calling chart.redraw() after adding drilldown will not show drilldown
Expected behaviour
Redrawing the the chart after drilldown series should redraw the drilldown view
Actual behaviour
It will redraw to the original view showing the series it was drill down from but zoomed
Live demo with steps to reproduce
Call a redraw or any method that redraws the chart (like fitToBounds, zoomTo etc with redraw option se to true) after adding a drilldown in drilldown handler. The drilldown won't be shown only zoomed to the bounds of clicked point. Demo using latest highmaps: https://jsfiddle.net/ed468k57/
Working fine with highmaps 10.3.3: https://jsfiddle.net/ybe8wkmL/1/
Product version
Highmaps v. 11.4.0 works fine in 10.3.3
Hi there!
The key is the redraw
method in line 56. If you comment this additional redraw everything works as expected: https://jsfiddle.net/BlackLabel/npv6ush7/
I am not sure, if we should treat this as a bug because the redraw during the drilldown shouldn't be called multiple times. Can I ask for your opinion @TorsteinHonsi?
Hi and thanks for the reply!
I know the issue is the line you commented out. I added it to demonstrate the issue. For my usecase it is a problem as I want to call the fitToBounds or zoomTo (which calls the fitToBounds) method to make a specific zoom after I make the drilldown. Which worked on the 10.3.3 but breaks all of our drilldowns on the 11.4.0.
Edit: Maybe it is an anti pattern what I am doing but haven't found other solution and it worked fine so far.
Looking forward to further replies.
@esszed, for this purpose, now you can use afterApplyDrilldown
event (currently not exposed to API, but safe to use). Please, check this demo: https://jsfiddle.net/BlackLabel/otf1edxu/
@hubertkozik Thanks for this! It works in principle. However there is little caveat to the zoomTo in your demo to 10.3.3 zoomTo which affects our usage. Before the zoom there seems to be delay where we see for a moment the whole drilldown map and then we see the zoom event happen. When used same code (albeit in the drilldown event) in 10.3.3 we get smooth zoom right after we click on the point, which is preferred. Here is an example: https://jsfiddle.net/1jx0a53n/
This question may be outside of the scope of this github issue. So feel free to handle it as you find fit.
Thank you
@esszed Sadly, the zoom on drilldown series is another issue... I've reported it here: https://github.com/highcharts/highcharts/issues/20857