plotly / plotly/plotly.js

Legend text overlapping Labels of Y axis when legends set tot left of Chart

Open
#6,155 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When legends are left aligned to the chart and Y axis labels have long string. The legend and labels text seems to overlap each other
image
The reason behind seems the way marginPushers are calculated and the labels are rendered. Labels are rendered considering the anchor point for the text as "start" or "end" based on the side where the labels are displayed. In case of labels being displayed on left the text-anchor is set to "right" while the rest of the whole calculations for the charts does not consider this and all the other layers are rendered without considering the extra space that will be required for the labels to render themselves taking space from right to left (read here. When labels are on right we should consider them as margin pushers and calculate them for transformation/axis translations of all layers of the Charts such as zeroline/grid/plots etc,

Please share your point of view or any workarounds, if can be used.

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 by tracing how marginPushers are calculated and how Y-axis labels and left-aligned legends are rendered, focusing on the SVG text-anchor behavior described in the issue. Reproduce the chart with long left-side Y-axis labels and a left-aligned legend; done means the legend, labels, zeroline, grid, plots, and axis translations no longer overlap.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.