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

Doughnut hide(...) not being animated #11369

Open
juanchomali opened this issue Jun 26, 2023 · 2 comments
Open

Doughnut hide(...) not being animated #11369

juanchomali opened this issue Jun 26, 2023 · 2 comments

Comments

@juanchomali
Copy link

juanchomali commented Jun 26, 2023

Expected behavior

The Doughnut chart should animate the hide() the same way as the show().

https://www.chartjs.org/docs/latest/samples/other-charts/doughnut.html

Current behavior

The show() animates the arc being shown as well as the ones being resized, while the hide() makes the arc being hidden disappear instantly while the rest of the bars resize. The hide() should animate the disappearing arc in the same way as the ones being resized to fill in the space.

Reproducible sample

https://www.chartjs.org/docs/latest/samples/other-charts/doughnut.html

Optional extra steps/info to reproduce

Click on show(0,1) and then hide(0,1).

Possible solution

No response

Context

No response

chart.js version

v4.3.0

Browser name and version

Chrome Version 114.0.5735.133 (Official Build) (arm64)

Link to your project

No response

@mukham12
Copy link
Contributor

mukham12 commented Jul 16, 2023

@kurkle,

I came across your previous work on the functionality implemented in #9450. Upon reviewing the code, I noticed a conditional statement that checks whether a dataset element is hidden:

if (element.hidden) {
continue;
}

If it is, the loop continues, bypassing the draw function. This approach leads to the immediate removal of the arc element instead of animating it, resulting in a jagged animation.

I experimented with removing the mentioned check, and I observed that the element removal still occurs correctly, with the expected animation. However, I want to acknowledge that I haven't had the opportunity to thoroughly examine the code. I apologize if my inquiry appears trivial or if I've overlooked any important details.

Thanks,

@mukham12
Copy link
Contributor

@stockiNail & @etimberg your input on this is highly welcome. Thanks.

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

No branches or pull requests

2 participants