8000 fix legend when figures has large margins by antoinerg · Pull Request #2983 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

fix legend when figures has large margins 8000 #2983

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

Merged
merged 3 commits into from
Sep 7, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
simplifies the check to see if legend fits
  • Loading branch information
antoinerg committed Sep 7, 2018
commit dbea03d998fe4b040b9cd937faf03fd2d6275274
4 changes: 2 additions & 2 deletions src/components/legend/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,12 @@ function computeLegendDimensions(gd, groups, traces) {
});

// check if legend fits in one row
oneRowLegend = (fullLayout.width - (fullLayout._size.r + fullLayout._size.l)) > borderwidth + fullTracesWidth - traceGap;
oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
traces.each(function(d) {
var legendItem = d[0],
traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;

if((borderwidth + offsetX + traceGap + traceWidth) > (fullLayout.width - (fullLayout._size.r + fullLayout._size.l))) {
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
offsetX = 0;
rowHeight = rowHeight + maxTraceHeight;
opts._height = opts._height + maxTraceHeight;
Expand Down
0