Skip to content

fix: Update legend maxheight calculation logic #7483

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

camdecoster
Copy link
Contributor

@camdecoster camdecoster commented Jul 21, 2025

Description

Update the legend maxheight calculation logic to account for the legend being located above/below the plot. Closes #7473.

Changes

  • Updates the maxheight calculation logic
  • Moves the default calculation into the sizing method
  • Updates attribute description
  • Adds test mock for image comparison

Demo

Before After
image image

Testing instructions

  • Be on master
  • Create a mock using the config from this PR
  • Open the mock in Plotly DevTools
  • Note that the legend overlaps the plot
  • Switch to this branch
  • Open the mock in Plotly DevTools
  • Note that the mock shows up correctly

@camdecoster camdecoster marked this pull request as ready for review July 22, 2025 16:34
@@ -28,7 +28,7 @@ function findLocaleStrings() {
var code = fs.readFileSync(file, 'utf-8');
var filePartialPath = file.substr(constants.pathToSrc.length);

falafel(code, {locations: true}, function(node) {
falafel(code, { ecmaVersion: 12, locations: true }, function(node) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camdecoster Would you please open a separate PR for these adjustments to falafel arguments? That way we could merge that one quickly and benefit from it in other new PRs.

@archmoj archmoj added bug something broken regression this used to work labels Jul 24, 2025
@@ -188,7 +188,7 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {

coerce('xanchor', defaultXAnchor);
coerce('yanchor', defaultYAnchor);
coerce('maxheight', isHorizontal ? 0.5 : 1);
coerce('maxheight');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the attribute description: "Default value is: 0.5 for horizontal legends; 1 for vertical legends."
So it looks like we should keep it as

coerce('maxheight', isHorizontal ? 0.5 : 1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken regression this used to work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vertical legend sizing/positioning broken
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy