carlcraig / tc-angular-chartjs

AngularJS directives for Chart.js
http://carlcraig.github.io/tc-angular-chartjs/
Other
233 stars 83 forks source link

Update chart on dynamically type selection #85

Open ypkkhatri opened 7 years ago

ypkkhatri commented 7 years ago

Hi,

Right now there is now way to change chart type on same data like bar to line, no dynamic chart selection, I have resolved the issue by removing all the generated HTML elements then regenerate the chart. But I don't prefer that

In the code I have seen code watcher applied on data and options:

$scope.$watch('[data, options]', function (value) { ..... }

But in this watcher, type needs to be added whenever type change it will recreate it and I think it will resolve the issue:

$scope.$watch('[data, options, type]', function (value) { ..... }

At local it's working perfectly

Thanks & Cheers

Yougeshwar Khatri

abarinoff commented 7 years ago

Hi. Please refer to this issue and see my comment - Dynamically change chart type.

When resolving char type via {{}} it redraws entire chart once the type changes.