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

Automargins in narrow spaces #4350

Closed
nicolaskruchten opened this issue Nov 14, 2019 · 5 comments
Closed

Automargins in narrow spaces #4350

nicolaskruchten opened this issue Nov 14, 2019 · 5 comments
Labels
bug something broken

Comments

@nicolaskruchten
Copy link
Contributor

From @chriddyp:

I’m seeing this issue in 1.51.1 - I’m assuming that the axes labels are longer than the width of the chart itself. maybe we can introduce some kind of minwidth property for the layout where the chart would shrink up to minwidth and display cut off tick labels (e.g. shrink the chart up to 100px wide)

image

a min width on one end or the other might be nice. either say - if there isn’t enough room, make the graph at least 100px wide (layout.minwidth or something) or e.g. set the min width in the tick labels - display at least 40px of tick labels
or maybe there is a more elegant solution to display the tick labels in a nicer way for compact layouts. like on top of the bars or something. or at least get the hover labels to show up on top of the bars

@etpinard
Copy link
Contributor

I’m assuming that the axes labels are longer than the width of the chart itself.

Actually, longer than half the width of the chart is enough to trigger the problem:

plotly.js/src/plots/plots.js

Lines 1842 to 1851 in 513491e

// if the item is too big, just give it enough automargin to
// make sure you can still grab it and bring it back
if(o.l + o.r > fullLayout.width * 0.5) {
Lib.log('Margin push', id, 'is too big in x, dropping');
o.l = o.r = 0;
}
if(o.b + o.t > fullLayout.height * 0.5) {
Lib.log('Margin push', id, 'is too big in y, dropping');
o.b = o.t = 0;
}

@etpinard
Copy link
Contributor

... and I should add the lines pasted in the above comment are very old, so I doubt the current v1.51.x behaviour is any different than in previous versions.

@archmoj
Copy link
Contributor

archmoj commented Dec 3, 2020

How does this problem look like after v1.58.0?
cc: #5237

@nicolaskruchten
Copy link
Contributor Author

What would you expect the change to be? I thought that to fix this we would need #5246 ?

@archmoj
Copy link
Contributor

archmoj commented Dec 3, 2020

Confirmed by @wbrgss that this issue is now now fixed after v1.58.0 by #5237.

@archmoj archmoj closed this as completed Dec 3, 2020
@archmoj archmoj added the bug something broken label Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants