Chartjs-Chart.js 2.x animation onComplete not responding

1πŸ‘

βœ…

I solved the issue. I was passing $scope.chartOptions to a function to add attributes to it depending on some other parameters. I was doing this for several charts, so I cloned $scope.chartOptions and modified the cloned versions of it, to finally pass these clones to the charts’ constructor.

The problem: In order to clone the object I was doing a shallow copy of the object, and as explained here, a shallow copy of a collection is a copy of the collection structure, not the elements. For this reason I was losing the onProgress and onComplete functions.

So I used angular.copy($scope.chartOptions).

Leave a comment