I have a client that uses HighStock in their service and they are showing cumulative data on date-range axis. So, their data is basically "you did 1h on date 1/1/2012, 2h on date 1/2/2012, etc." and we're showing this on time axis x-axis being the time.
The data on y-axis is cumulative data, so if we showed range 1/1-1/2, the on 1st would be 1h and on the 2nd it would be 3h.
They have the following requirements for Y-axis display on the left side:
- When there is less than 2 hours of data, you should have minimum tick interval of 15mins
- When there is 2-3 hours of data, you should have minimum tick interval of 30mins
- Otherwise, let highstock decide
So, I've managed to setup this with the options.yAxis.tickInterval variable BUT the problem arises when user hides some of the series showing on the graph by clicking them on the legend.
I've also managed to grab on to the event options.plotOptions.series.events.legendItemClick to re-calculate the tickInterval there but when I set it there, it does not apply to the drawing.
Also, if I check on the chart.event.redraw event what the tickInterval is on the yAxis, it has be overridden by highcharts from the one I previously set in legendItemClick event. Also, if I set it in the chart.event.redraw event again for the yAxis, it is too late because the axis has already been drawn there (as I can see if I temporarily stop the script from proceeding by calling alert() there).
How can I fix this? I don't know even if I'm on the right track here but I've googled/searched the forums/tried our everything and nothing seems to work.
Basically my question: How can I re-set the tickInterval (so that HighStock doesn't re-calculate it by itself) after user has clicked one item on the legend? I've managed to do everything else but this is what I'm strugling with...