Chartjs-Chart.js v2.0.0 redrawing the chart

0๐Ÿ‘

โœ…

I found that if I modified the data, the chart redrew itself.
So with that in mind, I changed my init method to this:

// Create our chart
self.init = function (ctx, data, options, type) {

    // Create our config
    var config = { type: type || 'bar', data: angular.copy(data), options: options || {} };

    // Create our chart
    self.chart = new Chart(ctx[0], config);
};

And that worked, it now redraws properly.
I guess that is because it must check to see if the data has changed, if I do a copy then it is always changing.

Leave a comment