Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

p1-ra
Copy link

@p1-ra p1-ra commented Aug 28, 2020

Currently, horizontal legend max height is hardcode to 50% of the full layout height. It's not possible to configure an other behaviour.

opts._maxHeight = Math.max(
(isBelowPlotArea || isAbovePlotArea) ? fullLayout.height / 2 : gs.h,
30
);

This PR introduce two new legend properties to allow customization the max height ratio or directly the max height in pixel

  hmaxheightratio: {
        valType: 'number',
        min: 2,
        dflt: 2,
        role: 'style',
        editType: 'legend',
        description: [
	    'Sets the max height ratio (layout / ratio) of the visible legend when horizontaly aligned.',
	    'Default value is 2; the legend will take up to 50% of the layout height before displaying a scrollbar',
	].join(' ')
    },
    hmaxheight: {
        valType: 'number',
        min: 0,
        role: 'style',
        editType: 'legend',
        description: 'Sets the max height (in px) of the horizontaly aligned legend.'
    },

@p1-ra p1-ra force-pushed the feature/horizontal-legend-customizable-max-height branch from 6fc4dd6 to a4a474e Compare August 28, 2020 16:32
  - Replace hardcoded horizontal legend max height ratio of 2 with
  user options (default is still 2).
@p1-ra p1-ra force-pushed the feature/horizontal-legend-customizable-max-height branch from a4a474e to f98d106 Compare August 28, 2020 16:52
@archmoj archmoj added status: reviewable community community contribution feature something new labels Aug 31, 2020
role: 'style',
editType: 'legend',
description: 'Sets the max height (in px) of the horizontaly aligned legend.'
},
Copy link
Contributor

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(' ')
},

@nicolaskruchten
Copy link
Contributor

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 :)

@gvwilson gvwilson self-assigned this Jun 10, 2024
@gvwilson
Copy link
Contributor

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

@nicolaskruchten nicolaskruchten removed their request for review July 5, 2024 13:02
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title Allow to configure horizontal legend max height (ratio || pixel) Allow configuration of horizontal legend max height (ratio || pixel) Aug 8, 2024
@gvwilson gvwilson added the P2 considered for next cycle label Aug 9, 2024
@gvwilson gvwilson assigned gvwilson and unassigned marthacryan Nov 21, 2024
@camdecoster camdecoster self-assigned this Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants