-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[Bug] Horizontal Legend Wrapping doesn't account properly for usage of <br> tags #3175
Comments
EDIT: |
@alexcjohnson Do I understand correctly that maxTraceHeight is set to 0 here plotly.js/src/components/legend/draw.js Line 594 in 9a79056
plotly.js/src/components/legend/draw.js Line 615 in 9a79056
plotly.js/src/components/legend/draw.js Line 630 in 9a79056
EDIT: Ah, it's a forEach. But then how is maxTraceHeight relevant for the last legend item? It is calculated but never used then. Am I right? |
So I verified the behaviour and can reproduce it 100%: Either the first trace/a trace in the first row has to contain the same amount of Or any trace in between (rows) has to contain at least the same amount of Something must be different for the first legend item/first row calculation that doesn't apply to all other legend items. What could that be? EDIT: Man, this is the only wall I've hit yet that I couldn't program a somewhat efficient workaround for. 🙈 The only things that I can think of would be heavily resource-hungry... |
Hey, everyone. Just wanted to know if anyone of the contributors/members has read this, since it isn't labeled and there's no comment yet =(... |
#3024 might be enough to fix this. |
This comment has been minimized.
This comment has been minimized.
Sorry for not taking a more serious look at this report before. Turns out this thing is a different beast than what #3024 attempts to solve. can you confirm that switching to |
Ok I can narrow it down some more: It only happens in Firefox in mobile view! @alexcjohnson @etpinard Can you make any sense of this special behaviour for the mobile developer view? I can't wrap my head around it. EDIT: Mobile view in Chrome works, though! |
Fix wrapped horizontal legends height computations
Hmm https://codepen.io/anon/pen/MPdoXY?editors=0010 looks ok to me on mobile FF64 on a Pixel2 android phone Could you share a bit more info about the device you're using and which mobile FF version you're on? Thank you. |
I already found the code line responsible for the problem: 0251a0c#r32036135 |
Sure, but I can't reproduce it. |
Is it also off on mobile FF? |
I would presume not, because you don't have a scrollbar there. Sadly I can't test that right now. I can test it tomorrow, though. I remember having had such issues with scrollbars in Firefox mobile developer view for some of my own business logic, that's why I checked this in the first place and seem to have hit the right spot. |
I can't reproduce it easily on my smartphone, because the edge case happens for displays with 360px width. (Don't have a smartphone on me with that width but that's still the most important mobile display width to support if I remember the statistics correctly, so that's what I test for when using the mobile developer view in Firefox for PC.) The problem stands, though: I hit an edge-case where a difference in 1~2px is not calculated correctly in Firefox mobile developer view only. It can be broken down to the fact that the legend items are not drawn next to each other but the calculation if everything fits in one row says it does fit in one row; this shouldn't be happening if the logic behind knowing if the legend can be rendered in one row and if the legend fits in one row are the same and is executed under the same conditions. But this is exactly what's happening :(... A quick and dirty fix that comes up would be to implement a var that tells us how many rows were actually rendered in the legend and do something with it in the onerow-detection. |
Nevermind, my bad. It was a differing marginright... Sorry 🐱 |
Reproduction:
legend.orientation = "h"
.<br>
in the first traces name.<br>
in the second trace's name.Here's an example: https://codepen.io/anon/pen/EdJyQm?editors=0010
If you put a
<br>
anywhere in the name of trace6, the name of trace7 will be shown fine.If you leave it out and your last trace contains a
<br>
the second line will be cut off.Please ping me up if you need further explanation of the problem.
The text was updated successfully, but these errors were encountered: