Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HighStock: Loading series data asynchronously as needed

I want to display multiple years of historical stock data in a HighChart. The json data size for all the years is 5mb, why I want to avoid loading all at once. Especially because most users will only need the last 6 month.

I would like to fetch the first 6 months initially. If the user zooms out or "moves" backwards in time I would like to load the whole data. Has someone a recipe for this? What is the starting point? Are there any HighChart events I could listen to, to get notified when the user zooms out or moves?

like image 607
Erik Avatar asked Oct 31 '12 20:10

Erik


1 Answers

You are looking for the xAxis.events.setExtremes event.

You will need to combine it with Series.addPoint(Object options, [Boolean redraw], [Boolean shift], [Mixed animation]) inside a loop with the redraw option as false inside the it and explicitly call Chart.redraw() after looping all the newly added points.

You may also need to look @ navigator.series since your navigator series may require to be different from the actual series

like image 171
Jugal Thakkar Avatar answered Nov 10 '22 13:11

Jugal Thakkar