Search code examples
javascriptchartsdashboardlightningchartlineseries

How to keep seeing the data from the start when the data keeps coming in LIghtningChartJS?


I went through one of your interactive examples, Dashboard 5 channels 1000 pps chart. In that as the data keeps coming, the view area starts scrolling so that I can see the new coming data. But in this process the data at the start goes out of view... What I want is, I want to see the new data as well as I want to see all the data from the start in view all the time.


Solution

  • You can achieve this by setting the AxisScrollStrategy to AxisScrollStrategies.fitting or AxisScrollStrategies.expansion

    series.axisX.setScrollStrategy(AxisScrollStrategies.expansion)