-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Chart shrinking excessively when browser zoom not set to 100% #10890
Comments
OS X 12.6.1, Retina 2880 × 1800 (1440x900) Screen.Recording.2022-11-24.at.20.35.24.mov |
Windows 10, 1920x1080 Desktop.2022.11.24.-.20.37.58.04.mp4 |
+1 chart shrinks to nothing if you hover your mouse over it. |
Had the same issue but found that adding |
- Added some comments - Set ChartJS graph responsiveness to false due to ongoing issues chartjs/Chart.js#10890 chartjs/Chart.js#10927
We also have this issue. Is there any ideas why it happens and when to expect a fix? P.S. the workaround from @KajsaEklof did not work for me. The chart just gets completely squashed vertically... :( |
Doesn't work for me, It causes the graph to start flickering |
Can confirm that we are seeing the same issue specifically with Browser Zoom at 90%
|
Could you please test v4.1.1 |
I'm seeing this in v4.1.1 on my line chart on my high resolution monitor only. I have 3 monitors: When I start my page with the chart in chrome with a low res monitor, the chart is fine. No infinite shrink. When I move the browser over to my high res. monitor, it starts the infinite shrink process. No resizing of the window seems to fix the issue. When I start my page with the chart in chrome on a high res monitor, same issue. |
Still there in 4.2.1, if browser is set to 90%, the canvas shrinks slowly to nothing. At 100% it is fine. I will try |
Same problem |
Same problem. Using chrome headless to print to pdf and set |
The problem is still present in v4.4.0. CC @gbaron |
Hitting this problem too with
|
still problem persist. any fixes available? |
Problem still exist in 4.4.1. All samples on chart.js homepage behaves this way. I´m amazed that this issue still has not been addressed. After some more testing it seems to be related to screen resolution. When running on a 4K screen this issue appears. |
I will never understanding why a not solved issue always be closed without solution. Same problem here. Any fix? |
Facing same issue... |
Why is this closed lool |
Still having this problem with:
|
I had this problem with v4.4.2 and this worked for me. Thank you so much! |
I am using Chart.js version 4.4.2 and encountering the same issue. |
Got the same issue, i added |
check this thread maybe you find some solution as of July 2024: here |
ChartJS has a bug causing charts to continually shrink and reset size when the browser zoom level is not 100%. See chartjs/Chart.js#10890 for details.
@etimberg - This issue was never resolved and still exists in 4.4.4. Can it please be reopened? |
We were having a similar issue where opening or closing Chrome's dev console was causing the graph to visually break. We were able to resolve it by removing this line from
Related threads for convenience:
|
Calling |
Why is the issue closed without providing any permanent solution? very frustrating. Tried all the method that is mentioned above as well as the referenced thread to stackover flow. nothing worked. the problem remains same as before. |
Setting the following css for the canvas element resolved this for me
|
Expected behavior
Chart should shrink appropriately during initial load or browser resize.
Current behavior
Chart either shrinks to nothing, then re-appears, or excessively shrinks then eventually stops.
Behaviour is inconsistent between page loads.
Reproducible sample
https://www.chartjs.org/docs/latest/charts/line.html
Optional extra steps/info to reproduce
Using Chrome desktop browser, set browser zoom to 110% and open the line chart example.
Reload the page to check chart behaviour on each page load.
Chart will either resize slightly, resize excessively, or shrink to nothing and then re-appear in a continuous loop.
Setting browser zoom to 125% seems to avoid "shrink to nothing", but still shrinks excessively on some page loads, and not others. Setting to 90% also has unpredictable results. 200% seems reasonably stable.
Resize browser window when zoom level other than 100% to see similar behaviour.
Possible solution
Seems to be related to retina/high Device Pixel Ratio chart responsiveness handling, perhaps related to the issue mentioned here.
Context
Setting browser zoom > 100% also increases device pixel ratio to a value above 1 on desktop browser.
chart.js version
v4.0.1
Browser name and version
Linux Chrome 106.0.5249.103
Link to your project
No response
The text was updated successfully, but these errors were encountered: