reactjs / react-chartjs

common react charting components using chart.js
MIT License
2.93k stars 299 forks source link

Support for .addData and .removeData? #15

Closed sklise closed 9 years ago

sklise commented 9 years ago

I'm trying to use this library to re-use a graph that can switch from 7 items to 30 items. It seems that whenever the number of items changes I get Uncaught TypeError: Cannot set property 'value' of undefined This happens every time the number of values to be charted changes.

If I have the redraw option enabled then these errors do not occur. With the redraw I would need to set animation: false otherwise I get some flickering in the chart.

Is this expected, or, am I probably implementing the graphs in the wrong way?

Thanks! this project is awesome

jhudson8 commented 9 years ago

can you make a unit test or a jsbin or something - I'm not actively using react-chartjs at the moment because I got caught up in another project but I'll have a look

sklise commented 9 years ago

ah, in trying to figure out how to recreate the issue with jsfiddle/bin I found what the problem was, and it was my code. I had a chartData object with {datasets: {key1: {...}, key2: {...}} instead of {datasets: [{...},{...}]

Which works fine except for when updatePoints() was called.

Thank you for your time!