Chartjs-Chart.Js is keeping old data after AJAX call

0👍

I think you need to clear the chart before drawing it with new data. That way new chart is drawn with the updated data only. From chart.js docs:

.clear()

Will clear the chart canvas. Used extensively internally between animation frames, but you might find it useful.

// Will clear the canvas that myLineChart is drawn on
myLineChart.clear();
// => returns ‘this’ for chainability

See the documentation for prototype methods

Leave a comment