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

Line chart stacking (via dataset stack) doesn't work on initial render #11856

Closed
NAndreasson opened this issue Aug 7, 2024 · 0 comments · Fixed by #11882
Closed

Line chart stacking (via dataset stack) doesn't work on initial render #11856

NAndreasson opened this issue Aug 7, 2024 · 0 comments · Fixed by #11882

Comments

@NAndreasson
Copy link

Expected behavior

I expect the datasets/lines to be stacked on initial render.

Current behavior

The dataset/lines will be stacked after an update (i.e. two renders are needed before they become stacked).

Reproducible sample

https://codepen.io/NAndreasson/pen/gONREBm

Optional extra steps/info to reproduce

Click the button in the Codepen to trigger an update

Possible solution

I think the bug is related to the following:

https://github.com/chartjs/Chart.js/blob/master/src/core/core.datasetController.js#L404-L414

In the first render, isStacked will return false which will affect _resyncElements. After updating isStacked will return true and the expected result will render.

Context

No response

chart.js version

v4.4.3

Browser name and version

No response

Link to your project

No response

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.

1 participant