plotly / plotly/plotly.js

Legend size is calculated incorrectly with orientation 'v', yref 'container'

Open
#7,386 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

As mentioned in this PR comment (#7359), there appears to be a bug related to the legend size calculation (possible due to an incorrect margin calculation) when the orientation is set to v and the yref is set to container. You can see the issue by going through the following steps:

  • Be on master
  • Start up the developer dashboard
  • Load the legend_horizontal_autowrap mock
  • Note that it loads fine
  • Edit the JSON for the mock to switch "orientation" to "v"
  • Edit the JSON for the mock to add "yref" with a value of "container" under the "legend" key
  • Reload the mock
  • Note that the legend gets scrunched up into the top right corner of the plot
  • Switch to this branch
  • Reload the mock
  • Note that an error is produced (due to a bad reaction to a negative margin value)

An example of the bug is seen in the following image:

image showing bug

The legend height should be calculated using the plot height (the "container"), but something is going wrong in this configuration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start the developer dashboard and load the legend_horizontal_autowrap mock, then reproduce the issue by setting legend orientation to "v" and yref to "container". Trace the legend size and margin calculation from that reproduction. Done means the legend uses the plot height as its container, is not scrunched into the top-right corner, and reloads without a negative-margin error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.