Open adamscybot opened 9 years ago
I have had this issue as well, I added redraw
as per the docs
if data passed into the component changes, points will animate between values using chart.js' .update(). If you want the chart destroyed and redrawn on every change, pass in redraw as a prop. For example <LineChart data={this.state.chartData} redraw />
If you want to make this dynamic please submit a PR.
I made a component for Chart.js from scratch. I destroy an old instance and re-initialize a chart on componentWillUnmount
rather than componentWillReceiveProps
. Also, I replace the whole data every time the component is provided with new data. This way, we can keep our code simple. I share with you a simple helper method I wrote to generate a chart component class.
Please check out InteractiveChartComponent.
If you update data and the new data has less labels than the previous number of labels you get the error:
Its related to the line
Should probably trigger a redraw...