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

v3 Gaps in stacked bar chart when object based data point removed #8614

Closed
sdehm opened this issue Mar 10, 2021 · 1 comment · Fixed by #8617
Closed

v3 Gaps in stacked bar chart when object based data point removed #8614

sdehm opened this issue Mar 10, 2021 · 1 comment · Fixed by #8617

Comments

@sdehm
Copy link

sdehm commented Mar 10, 2021

Expected Behavior

When a data point is removed the other stacked bars should drop to fill the gap.

Current Behavior

When a data point, specified in Object[] format is removed the bars that were above do not drop to fill the gap.

Possible Solution

I have tested the following workarounds:

  • When deleting a data point just set it's value to zero (better appearance/animation but more complicated code)
  • When updating data in a dataset replace the whole dataset (reanimates entire dataset which is not always desirable)

Steps to Reproduce

Create a stacked bar chart with data in Objects[] format and then delete some data points.
Example codepen derived from sample stacked bar chart:
https://codepen.io/scdehmlow/pen/BaQvowb

Context

I am unable to provide a smooth animation experience for changing chart data without more complicated logic that sets deleted values to zero.

Environment

  • Chart.js version: 3.0.0-beta.13
  • Browser name and version: Chrome 88.0.4324.190
  • Link to your project:
@etimberg
Copy link
Member

This seems related to the stack caching. If I disable it, the update looks as expected.

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

Successfully merging a pull request may close this issue.

2 participants