[Bug]: Bar Chart with multiple dataset stacks reanimating when data changes

Author: MigdaliaBritoCreated Nov 5, 2024Updated Nov 6, 2024
Labelsbug

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

I see this only occur with bar charts with data sets that have multiple stack ids. But when the data changes, it does not animate gracefully the difference for the stacks. It does for the first stack collection, but the rest it resets the animation. I found an example in the chartjs documentation that does what I expect it to do but when using react-chartjs-2 it does not replicate the expected behavior.

https://www.chartjs.org/docs/latest/samples/bar/stacked-groups.html

Reproduction

https://codesandbox.io/p/devbox/silly-aj-gqvwvr?file=%2FApp.tsx%3A60%2C16&workspaceId=d2c104b9-4ce0-406f-9621-548a17948260

chart.js version

4.0.0

react-chartjs-2 version

5.0.0

Possible solution

No response

Source: reactchartjs/react-chartjs-2