Home › forums › Using CanvasJS › Dynamic chart w shifting array
Evaluating a purchase of this library but finding an issue with our initial testing on a live chart showing a fixed number of dataPoints. More specifically: we need to display the last X values, shifting the first value off the array and pushing a new value onto the end.
We first looked at this a couple months ago and this seemed to be how the examples on the Canvasjs were constructed. Now that we’ve had problems I’m looking at those examples on the site again and can see the lines containing the shift operations are commented out. Is there a known issue with this?
Example (line 34): https://canvasjs.com/jquery-charts/dynamic-chart/
Thanks for bringing it to our notice, we have updated the example. Please take a look at the updated code. Shifting should work fine with the updated code.
In updated code plot is not shifting….
uncommenting the line //dataPoints.shift(); in the above example will trigger the shift operation for dataPoints.
You must be logged in to reply to this topic.