-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix legend container overflow #7158
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
base: master
Are you sure you want to change the base?
Conversation
…ontainer. Need these for the case yref === 'container' && xref === 'paper'
|
@emilykl @camdecoster |
src/components/legend/draw.js
Outdated
| } | ||
|
|
||
| // Set default maxheight if not provided by user | ||
| maxheight ||= (yref === 'paper' && !useFullLayoutHeight) ? 1 : 0.5; |
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.
I'm pretty sure you could avoid the yref === 'paper' check here by just setting useFullLayoutHeight to false inside the else case
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.
In fact I think you need to do that, because otherwise useFullLayoutHeight is undefined when yref is not 'paper'
Description
Fixes maximum height calculation for legends anchored to the container (
yref: "container"). Previously, legends would overflow outside the available container space. This fix ensures that when a legend is positioned relative to the container, its maximum height is constrained to the available space based on theyposition andyanchorsettings.Resolves #7072
Changes
computeLegendDimensionsfunction insrc/components/legend/draw.jsto calculate and constrainmaxheightwhenyref === 'container'legend_overflow_height.jsonto verify the bug fixDemo Video:
Before:
Screen.Recording.2025-10-27.at.11.30.24.PM.mov
After:
Screen.Recording.2025-10-27.at.11.30.52.PM.mov
Testing
npm startlegend_overflow_heightmock