kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

setExtremes on chart.load

I want to determine y-axis min and max during the loading of a chart (I need this to create a bubble chart where the average bubble radius is related to PlotWidth and PlotHeight, so big charts get bigger bubbles and small charts get smaller bubbles).

I use axis.setExtremes during the load event of chart. The new maximum is set correctly, but the axis scaling is distorted see http://jsfiddle.net/kzoon/h7Xhk/. This problem only happens when chart animantion is false.

Any ideas?
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: setExtremes on chart.load

Instead of using setExtremes you can set axis min and max, see: http://jsfiddle.net/hfrntt/h7Xhk/4/
Slawek Kolodziej
Highcharts support team
kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

Re: setExtremes on chart.load

hfrntt,
thanks for your reply.
I connot set min/max in the options, because I need to know PlotWidth and PlotHeight before I can calculate my min and max values. That is why I want to use setExtremes during the load event of chart.

Is the scale distortion a bug, or can't I use axis.setExtremes during chart load?
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: setExtremes on chart.load

You can use setExtremes in chart.load, but as you can see, if you disable animations some axis lines won't be redrawn properly (as in your example). Anyway, in your case I advice to use setExtreme, then call redraw and instead of disabling animation, set its duration to 0.

See: http://jsfiddle.net/hfrntt/h7Xhk/5/
Slawek Kolodziej
Highcharts support team
kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

Re: setExtremes on chart.load

Thanks very much for the duration=0 suggestions; it works very well!

Return to “Highcharts Usage”