plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

horizontal legend width should be layout width

Open p1-ra opened this issue 5 years ago • 4 comments
trafficstars

Currently, horizontal legend width is set to the width of its longer text. It make the display of the scrollbar a little bit disturbing,

Capture_hlegend_broken

This PR fix horizontal legend width and set it to the full layout width:

Capture_hlegend_fixed

p1-ra avatar Aug 29 '20 16:08 p1-ra

Thanks for the PR. Seems like a good catch at first glance. However there are a number of baselines that change. So maybe one could consider enabling this option as a feature.

For now, could you please regenerate these?

geo_choropleth-legend
gl2d_fill-ordering
gl2d_parcoords_blocks
gl3d_mesh3d_coloring
legend_horizontal
legend_horizontal_wrap-alll-lines
legend_negative_x
legend_negative_x2
legend_scroll_beyond_plotarea
legendgroup_horizontal_bg_fit
pie_automargin
uniformtext_bar-like_10_auto
uniformtext_bar-like_8_textangle
uniformtext_bar-like_8_textangle45

Also please visit https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md#image-pixel-comparison-tests for more info regarding generating the baselines.

archmoj avatar Sep 01 '20 14:09 archmoj

Interesting, I certainly see the appeal of this, but I feel like it should at least be scoped to legends that have a scrollbar (the difference becomes important if the legend has a background or border), and possibly (as @archmoj mentioned) be turned into an opt-in attribute like legend.width

alexcjohnson avatar Sep 01 '20 22:09 alexcjohnson

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

nicolaskruchten avatar Mar 10 '21 21:03 nicolaskruchten

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

gvwilson avatar Jun 10 '24 17:06 gvwilson