Commit Graph

7 Commits

Author SHA1 Message Date
Spencer Dellis
dbce4d7c2c Fixing eslint issues. 2017-05-19 11:11:56 -04:00
Spencer Dellis
5cc8f0a878 Resolve reactivity mixin animation issue.
A small consequence of replacing the entire dataset in the [reactive mixins files](https://github.com/apertureless/vue-chartjs/blob/develop/src/mixins/reactiveData.js) is that it causes charts to completely re-render even if only the 'data' attribute of a dataset is changing. In my case, I set up a reactive doughnut chart with two data points but whenever the data values change, instead of shifting the fill coloring, it completely re-renders the entire chart.

You can see the issue in this fiddle (the problem remains even when changing chart type):
https://jsfiddle.net/sg0c82ev/11/

To solve the issue, I instead run a diff between the new and old dataset keys, remove keys that aren't present in the new data,  and update the rest of the attributes individually. After making these changes my doughnut chart is animating as expected (even when adding and removing new dataset attributes).

A fiddle with my changes:
https://jsfiddle.net/sg0c82ev/12/

Perhaps this is too specific of a scenario to warrant a complexity increase (and better suited for a custom handler) but I figured it would be better to dump it here and make it available for review. Let me know what you think.
2017-05-19 03:16:12 -04:00
Jakub Juszczak
874b674803 🐛 Fix reactiveMixins issue #42 2017-02-22 15:39:42 +01:00
Jakub Juszczak
6a82e42c6e 🐛 Fix eslint errors 2017-02-14 17:37:54 +01:00
Jakub Juszczak
aa76f518cb 🔨 Change reactiveMixins
Destroy chart instance on render()
Add additional check for dataset length
Add comments
Refactor reactiveData to match reactiveProp style
2017-02-14 17:31:18 +01:00
Jakub Juszczak
f94b320dfa Change reactiveDataMixin 2016-10-15 12:58:51 +02:00
Jakub Juszczak
45e543b636 Add reactiveData mixin 2016-10-02 10:31:14 +02:00