-
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
Resposive chart infinitely shrinking with certain zoom levels #11612
Comments
Same here with 3840x2160 screen, it happen in Edge, Chrome and Brave. But curiosly enough, not in Firefox. It will happen with both 90% and 110% zoom. |
Encountered this issue with following versions:
|
hello, I encountered this issue in chart.js v 4.4.3 also, is there any solution or workaround? |
I also encountered this problem with Chart.js version 4.4.1. I managed to avoid this by setting the |
Hello @HieroglypH, I already tried before to add aspect-ratio to the canvas but it doesn't work with both 90% and 125% zoom in chrome. I am using v4.4.3 to create doughnut chart. |
Sorry for the late reply. I set the <div id="chart" class="wrapper">
<canvas>
</div> .wrapper {
aspect-ratio: 1 / 2;
} If that doesn't resolve the issue, how about setting the This phenomenon is caused by the canvas resizing itself repeatedly. |
Expected behavior
Responsive chart should be a stable size with all devicePixelRatios.
Current behavior
Chart will infinitely shrink when certain devicePixelRatios are used.
Behavior occurs with a devicePixelRatio of 1.3499999046325684.
The ratio can be achieved naturally by users:
Windows 10
Screen resolution: 1920x1080
Windows resolution scaling: 150%
Chrome zoom level: 90%
Reproducible sample
https://codesandbox.io/p/sandbox/chartjs-responsive-zoom-thccwr
Optional extra steps/info to reproduce
Demo uses css
zoom
property. Need to use a browser that supportszoom
, such as Chrome.Possible solution
No response
Context
I believe this is the same issue as #10890.
Either the issue was reintroduced or the original fix didn't work for all scenarios.
chart.js version
4.4.1
Browser name and version
Chrome 119
Link to your project
No response
The text was updated successfully, but these errors were encountered: