-
-
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
Allow configuration of horizontal legend max height (ratio || pixel) #5106
base: master
Are you sure you want to change the base?
Allow configuration of horizontal legend max height (ratio || pixel) #5106
Conversation
6fc4dd6
to
a4a474e
Compare
- Replace hardcoded horizontal legend max height ratio of 2 with user options (default is still 2).
a4a474e
to
f98d106
Compare
role: 'style', | ||
editType: 'legend', | ||
description: 'Sets the max height (in px) of the horizontaly aligned legend.' | ||
}, |
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.
@p1-ra thanks very much for the PR.
Maybe by inverting the hmaxheightratio:
we could combine the two attributes into one.
Something like:
maxheight: {
valType: 'number',
min: 0,
dflt: 0.5,
role: 'style',
editType: 'legend',
description: [
'If greater than one, it sets the max height (in px) of the horizontaly aligned legend.',
'Otherwise, it sets the max height ratio (layout * ratio) of the visible legend when horizontaly aligned.',
'Default value is 0.5; the legend will take up to 50% of the layout height before displaying a scrollbar'
].join(' ')
},
A small update on timing: our team is working hard on releasing v2.0 of Plotly.js, which we anticipate will happen in early April. This PR would be a good candidate to land in the library in v2.1 or later, so with apologies for the delay, we will likely not be able to give much feedback on this PR for the next few weeks :) |
This pull request has been sitting for a while, so I would like to close it as part of our effort to tidy up our public repositories. I've assigned it to myself to keep track of it; I'll wait until 2024-06-17 for someone to say it's still relevant and they'll to take it on, and otherwise I will close it then. Thanks - @gvwilson |
Currently, horizontal legend max height is hardcode to 50% of the full layout height. It's not possible to configure an other behaviour.
plotly.js/src/components/legend/draw.js
Lines 607 to 610 in 4ac68aa
This PR introduce two new legend properties to allow customization the max height ratio or directly the max height in pixel