1π
β
I tried a lot of things regarding cleaning the canvas and the chart instances, but ended up taking another approach (and probably a better one). Instead of removing the chart (and its canvas) and creating a new one, I updated the chartβs data (replacing the old dataset for the new one).
for(var i = 0; i < $scope.chartsList.length; i++) {
var chart = $scope.chartsList[i];
var firstDataSet = $scope.formattedData[i];
var secondDataSet = $scope.formattedData[i + 15];
for(var j = 0; j < 51; j++) {
chart.config.data.datasets[0].data = firstDataSet;
chart.config.data.datasets[1].data = secondDataSet;
chart.update();
}
Done!
Source:stackexchange.com