Closed phil-lauffenburger closed 8 years ago
+1 on this, I am having the same problem. Radar chart is the whole reason i'm using this library so if I can't get it to work I will have to replace it :(
I passed in redraw as a prop and it fixed the issue for me. It scraps the old chart and makes a whole new one every time though. For example, your code would look like this:
`
I saw it at the bottom of this page:
Yeah, that works for me as well. I just don't like how redrawing the chart looks.
adding to this. redraw
fixes the issue for me as well, but it shouldn't really be needed
Hey guys, I was having an issue with my doughnut charts updating (which shares code with radar and circle charts). Old data points would not be removed when the new dataset was of a smaller length than the previous. I've made a PR under #88, if you think it might help your problems we can make an effort to get it merged.
Can you guys check if https://github.com/jhudson8/react-chartjs/pull/88 fixed your issue?
Ok, so #88 does not fix the issue. #88 just applies to Polar/Pie/Doughnut Charts. However, chart.removeData() seemed promising. I mucked around with it a bit and removed the while loop just below the change in #88.
} else { chart.removeData(); nextProps.data.datasets.forEach(function(set, setIndex) {
This of course causes some other errors but I just added a few extra if statements to classData.componentWillReceiveProps:
if (chart.scale) { chart.scale.xLabels = nextProps.data.labels; if (chart.scale.calculateXLabelRotation){ chart.scale.calculateXLabelRotation(); } }
Now, my radar chart is updating without redrawing. This feels like a bit of a hack, so I want to poke at it a bit more before submitting a pull request.
Any thoughts?
@lauffenp Yeah my commit only related to those charts you mentioned. I noticed that some of my charts have been updating slowly with my fix, so if you're able to remove the data without a loop that'll probably give us a speed boost.
fixed by #92
I am passing in data in the render() portion of my react component to a radarchart
When the component re-renders, I get the following error: Uncaught TypeError: Cannot read property 'length' of undefined
originating from this codeline:
If I change my radar chart to a bar chart it works just fine. Is there something I'm missing here?
Thanks!