Highstock: How to combine lazy loading AND dynamic data?

前端 未结 2 400
忘掉有多难
忘掉有多难 2021-02-02 02:12

I\'m trying to combine lazy loading with dynamically updated data in Highstock. The idea is to have a large historical down-to-the-minute chart (with millions of data points) wh

2条回答
  •  误落风尘
    2021-02-02 02:47

    I had this problem too, and after trying many solutions, I got one that really worked for me.

    I used a global variable that contains the max value of xAxis and when I update the chart I verify if the new xAxis value is bigger then the maxX variable.

    If it's true then I update the maxX with the new point and then I use the chart.xAxis.setExtremes (chart.xAxis.min, maxX); and after this I redraw the chart.

    With these two things the chart will simulate the lazy loading with dynamic data, but another problem came through: the range selector and the navigator weren't updating. The solution was:

    chart.rangeSelector.buttons[0].setState(2);
    chart.rangeSelector.clickButton(0,0,true);
    

    These two lines enable the range selector again and everything became ok.

提交回复
热议问题