HighStock.js: add parameter to chart.redraw(numberOfPointFromTheEnd) API method
Hello,
I develop application related to stock market. I have a case when there are three charts displayed (area, candlestick, column) that needs to be updated when stock price is changed but not more than one time per 2 seconds. Each chart type (area, candlestick, column) can contain 15000 of points. Here is live demo: https://jsfiddle.net/ogorobets/8gb54cyh/5/. As you can see there application hangs out because of big load.
My proposition is to have "numberOfPointFromTheEnd" parameter in chart.redraw() API method to redraw only last few points but not whole chart. This way redrawing chart can take much less time.
As I see Highstock.js charts autoscales after chart is redrawn to fit all points inside visible chart area. Redrawing mechanism could be changed in a following way. We can get extremes (yAxis[0].getExtremes()) and recalculate data for latest newly added a few points to see if we can redraw them without rescaling whole chart. As for candlestick chart if (newCandle.high < extremes.max) && (newCandle.low > extremes.min) then redraw only last candle, otherwise redraw whole chart (as standard chart.redraw() call).
This way we could save a lot of browser tab resources and improve performance of HighStock.js library.
Thanks!
Oleksandr Horobets