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
All chart examples in documentation are decreasing in size when hover #10951
Comments
Could not reproduce, updated my edge to the latest version (108.0.1462.42) and there it also seems to work fine, did it on a pc running win 11 with a 192*1080 screen 🤔 |
Now I tested it in Chrome and the problem didn't really happen, it must be a problem with the version of Edge I'm using. And I can't even update it because the company I work for blocks updates and makes them available only from time to time. I just think it's weird because that it's not even an too old version, you know. Can you downgrade your browser and test in a similar version? And it's even weirder because this problem only occurs in the latest version of the documentation. |
I am experiencing the same thing. All of the samples continuously minimize. Setting Chrome Version 108.0.5359.99 (Official Build) (64-bit) |
I am experiencing the same thing (Chrome 108.0.5359.99 Mac). In my case, the specific scenario is:
|
Curious if this was fixed by #10942 |
I'm able to reproduce the issue (after the #10942 fix).
I'll let you know if I find the root cause. |
I've the same problem, I noticed that this happens when you've a different zoom in your browser. Please let me know if it can be fixed or if there is some stable version that I can use thank you |
The code below slightly changes the chart width and height on every call, for some values of Chart.js/src/helpers/helpers.dom.ts Lines 222 to 226 in c4fbd5f
Note: pixelRatio equals Window.devicePixelRatio
For reference, as of today, when Chrome is set to Zoom %90, Since this code is invoked when handling resize (i.e I couldn't figure out the reason to update the chart size after calculating the @LeeLenaleee, @kurkle - any thoughts? |
Looks like floating point arithetic errors are not considered there. The tests at lines 238 and 239 can easily fail, when the pixel ratio is not whole. The chart width/height try to be accurate while deviceWidth/height are truncated to whole numbers. Logging some values there could help to create a test for this, because the floating point arithmetic errors should be repeatable. |
My previous comment is actually mostly wrong, but loggign some numbers could still help creating a test :) |
Experiencing the same issue. Migrating from 2.7 to 4.0.1 and found this in dev, hopefully this fixes it so we can push to prod. Thanks for the effort on this! |
* test: new test to reproduce issue #10951 * test: validate the canvas style too * fix: Avoid reassigning the the chart size. For specific values of pixelRatio the assignment would cause the size to reduce by 1px. Since it's called from the ResizeObserver it will be stuck in a loop that constantly reduce the size of the chart and canvas. * Revert "fix: Avoid reassigning the the chart size. For specific values of pixelRatio the assignment would cause the size to reduce by 1px. Since it's called from the ResizeObserver it will be stuck in a loop that constantly reduce the size of the chart and canvas." This reverts commit ed7a348. * fix: Avoid the resize loop by fixing the rounding error in the retinaScale function. * fix: getMaximumSize was flooring non-integer height values unnecessarily. * Revert "fix: Avoid the resize loop by fixing the rounding error in the retinaScale function." This reverts commit 23525ab. * fix: Avoid the resize loop by fixing the rounding error in the retinaScale function.
Wow! This just solved the problem for me. |
This worked for me, cheers! |
Expected behavior
When triggering some hover event in a chart, the expected behavior is just to keep the real size.
Current behavior
The charts are decreasing in size when mouse hover event is triggered.
Reproducible sample
https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html
Optional extra steps/info to reproduce
recording-2022-12-08-09-43-44.webm
Possible solution
I've been through a problem like this, the difference was that the graph didn't reduce, but increased. I solved it by inserting a container on the chart's canvas, it had something to do with the size (width and height) of the chart.
I've never seen this problem happen in the documentation.
But I don't consider it a solution, it's more like a workaround.
Context
No response
chart.js version
v4.0.1
Browser name and version
Microsoft Edge v107.0.1418.52
Link to your project
No response
The text was updated successfully, but these errors were encountered: