Skip to content

Fix #1913 by pushing overflowed legend items to a new line #3628

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 14 commits into from
Mar 20, 2019
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
8 changes: 5 additions & 3 deletions src/components/legend/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,13 +609,15 @@ function computeLegendDimensions(gd, groups, traces) {
maxItems = Math.max(maxItems, group.length);
});

maxHeight += opts.tracegroupgap || 5;
maxHeight += opts.tracegroupgap;
var traceGroupGap = 5;
maxWidth += traceGroupGap;

var groupXOffsets = [opts._width];
var rowHeights = [];
var rowNum = 1;
for(var i = 0, n = groupData.length; i < n; i++) {
opts._width += maxWidth;
opts._width += maxWidth ;

if(fullLayout._size.w < (borderwidth + opts._width + maxWidth)) {
groupXOffsets[groupXOffsets.length - 1] = groupXOffsets[0];
Expand Down Expand Up @@ -669,7 +671,7 @@ function computeLegendDimensions(gd, groups, traces) {
var maxTraceWidth = 0;
var offsetX = 0;
var fullTracesWidth = 0;
var traceGap = opts.tracegroupgap || 5;
var traceGap = 5;

// calculate largest width for traces and use for width of all legend items
traces.each(function(d) {
Expand Down