ChartJs has animation every time angular refresh the data

๐Ÿ‘:0

In your chart component when the data changes you call destroy() on the chart instance and re create the entire chart. Instead of doing this you need to edit the values within the existing chart object and call update() on your chart instance.

const newLabels = ["t", "a", "b"];
const newData = [2,3,4];

chartInstance.data.labels = newLabels;
chartInstance.data.datasets[0].data = newData;

chartInstance.update();

Leave a comment