chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
63.9k stars 11.88k forks source link

Chrome 124 - Charts disappearing after switching tabs #11777

Closed annam-ph closed 1 month ago

annam-ph commented 1 month ago

Expected behavior

Charts keep their previous state when I come back to my browser tab

Current behavior

Chart disappears when I switch to another tab, and then come back to the tab with the chart

Reproducible sample

https://www.chartjs.org/docs/4.4.3/samples/bar/border-radius.html

Optional extra steps/info to reproduce

Possible solution

No response

Context

No response

chart.js version

v4.4.3, v3.9.1

Browser name and version

Chrome 124 & Chrome 125

Link to your project

No response

HT808s commented 1 month ago

I've noticed the same issue with the same Chrome version. It doesn't happen immediately but occurs after leaving the tab for a few minutes and then returning to it.

ajulien973 commented 1 month ago

I can confirm the issue on Chrome 124 on my end. Not reproducible on Firefox Developer Edition 125

LeeLenaleee commented 1 month ago

This does not seem like a chart.js bug but a chrome issue. In discord someone posted a video where you can see the same behaviour on the w3 schools website for a default canvas tutorial.

https://discord.com/channels/1109494364788502548/1109497513720938546/1241275466267099136

So this issue needs to be reported at the chrome issue tracker.

ishantgupta777 commented 1 month ago

++ having the same issue

aljazdolenc commented 1 month ago

Same issue

mikethea1 commented 1 month ago

Same issue. Has anyone opened an issue in Chrome?

I get this on Chrome 125 as well.

LeeLenaleee commented 1 month ago

Closing this issue as this is not a chart.js issue but a chrome issue and thus should be reported and resolved in chrome instead.

ian-whitestone commented 1 month ago

Looks like it is being tracked and worked on already by Google.

https://issuetracker.google.com/issues/328755781

semeion-net commented 1 month ago

Not sure if this is helpful, but I noticed that the problem only appears if maintainAspectRatio is set to false in the chart options. If it is set to true, the charts stay visible. I'm using Chrome Version 124.0.6367.209 with an RTX3070.

omonedeki commented 1 month ago

Saw similar issue, will try the suggestion, to see if it works while chrome works a hotfix

mikethea1 commented 1 month ago

For anyone it helps, I'm currently working around this by subscribing to the visibilitychanged event and re-rendering the chart whenever the tab transitions to visible.