Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Chart.js type does not update on prop change #1054

Closed
1 task done
BlenderDude opened this issue Jul 1, 2022 · 1 comment · Fixed by #1055
Closed
1 task done

[Bug]: Chart.js type does not update on prop change #1054

BlenderDude opened this issue Jul 1, 2022 · 1 comment · Fixed by #1055
Labels

Comments

@BlenderDude
Copy link
Contributor

BlenderDude commented Jul 1, 2022

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

Current behavior:
When changing the prop type, the underlying chart does not update until the entire component re-renders.

Expected behavior:
When changing the prop type, the underlying chart updates (redraws) with the new type.

Reproduction

https://codesandbox.io/s/chart-type-update-issue-iym5e9

chart.js version

v3.8.0

react-chartjs-2 version

v4.2.0

Possible solution

Redraw the chart upon type change, I will be submitting a PR momentarily

[edit] Confirmation of ChartJS not working: https://stackoverflow.com/questions/36949343/chart-js-dynamic-changing-of-chart-type-line-to-bar-as-example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants