reactjs / react-chartjs

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

Can't return to first data set #203

Closed brianh20 closed 5 years ago

brianh20 commented 6 years ago

Hello, I am having an issue updating the dataset shown.

This is the setup: I have a component which has a sidebar with different names for the datasets and a pie chart. The dataset of the is tied to data[display] where data is an array received by props and display is automatically set to the first key in the array and is reset to the option selected in the sidebar.

The question is: When I start the app it renders correctly, and it also switches between the datasets correctly EXCEPT for the first dataset (used on initial render)

If I console.log the data[display] object it shows the correct one but the piechart ignores the change... therefore the first chart is only shown on render, and then I can only view the second and third one but can never return to the first.

Why is this? Is there a solution?