-
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
fix: Chart shrinking uncontrollably on browser zoom (#11089) #11132
base: master
Are you sure you want to change the base?
Conversation
@@ -200,7 +200,7 @@ export function getMaximumSize( | |||
const maintainHeight = bbWidth !== undefined || bbHeight !== undefined; | |||
|
|||
if (maintainHeight && aspectRatio && containerSize.height && height > containerSize.height) { | |||
height = containerSize.height; | |||
height = Math.round(containerSize.height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if round1 would be enough to fix the issue..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or if removing the width rounding too would sctually fix it :)
Really need this fix! |
This fix is really needed ! My chart on Android browser shrinks all the time. EDIT: |
Bumping this one, also really in need of the fix! 🙏 |
Badly waiting for this fix, can we get this one merged and released soon please? |
What is blocking the thing since February? |
@fly74 this hasn't been merged because this is very risky code to touch and this is an issue that the bulk of our users are not experiencing. While this fix solves this specific issue, there are no guarantees that it doesn't break other user's charts or introduces the same problem in other ways. @kurkle already commented that |
@etimberg I know that the use of HiDPI Monitors is not common for everybody but 4k with a scale is the future. This is resulting that the browser is choosing a zoom value which is sometimes like 116% or other what is resulting is this rounding issue. Why is it dangerous to round? |
@fly74 the risk is that we run into a scenario like this hence why we're reluctant to make a ton of changes to this code
If we merge this, we're rounding the height. From what I recall when we last ran into this, rounding to the nearest integer was much more likely to cause the scrollbar problem hence rounding to a single decimal place where our testing showed that it was less likely to occur. |
A thought. Are you open to adding a configuration parameter or allowing a custom/passthrough rounding function to modify this behavior? That way individual users could extend the behavior to meet their specific requirements? As it stands right now, we're in this situation you described with the existing functionality. It's just the chart that's freaking out, not the scrollbars (we have them disabled via CSS.) |
@lincolnthree that would really a perfect solution for everybody who are waiting to get it work. Let's try it with a config parameter. Great idea 👌! |
@lincolnthree I would be open to having a config option for this + something in the docs discussing this problem and potential solutions. @LeeLenaleee @kurkle opinions? |
@etimberg with regards to config option, what did you have in mind? |
@gbaron could be something like |
My comment on the original issue contains the full analysis (scenario, root cause, how to reproduce):
#11089 (comment)
The functions
retinaScale
andgetMaximumSize
are full of minor details and multiple flows.Hence, this area in the code is quite sensitive IMHO.
I'm making an attempt to fix the issue with minimum side effects.
Fixes #11089.