Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.

Commit 7ff4e2d

Browse files
committed
Fix legend horizontal wrapping
1 parent 06bf98e commit 7ff4e2d

21 files changed

+123
-127
lines changed

dist/plotly-basic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25854,7 +25854,7 @@ function computeLegendDimensions(gd, groups, traces) {
2585425854
var opts = fullLayout.legend;
2585525855
var borderwidth = opts.borderwidth;
2585625856
var isGrouped = helpers.isGrouped(opts);
25857-
var isHorizontalColumn = helpers.isHorizontalColumn(opts);
25857+
var isHorizontalWrapped = helpers.isHorizontalWrapped(opts);
2585825858

2585925859
var extraWidth = 0;
2586025860

@@ -25978,11 +25978,11 @@ function computeLegendDimensions(gd, groups, traces) {
2597825978
});
2597925979

2598025980
// check if legend fits in one row
25981-
var oneRowLegend = !isHorizontalColumn || (fullLayout._size.w > borderwidth + fullTracesWidth - traceGap);
25981+
var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
2598225982

2598325983
traces.each(function(d) {
2598425984
var legendItem = d[0];
25985-
var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;
25985+
var traceWidth = (oneRowLegend || isHorizontalWrapped) ? 40 + d[0].width : maxTraceWidth;
2598625986

2598725987
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
2598825988
offsetX = 0;
@@ -26444,8 +26444,8 @@ exports.isReversed = function isReversed(legendLayout) {
2644426444
return (legendLayout.traceorder || '').indexOf('reversed') !== -1;
2644526445
};
2644626446

26447-
exports.isHorizontalColumn = function isHorizontalColumn(legendLayout) {
26448-
return legendLayout.horizontalspacing === 'column';
26447+
exports.isHorizontalWrapped = function isHorizontalWrapped(legendLayout) {
26448+
return legendLayout.horizontalspacing === 'wrapped';
2644926449
}
2645026450
},{}],98:[function(_dereq_,module,exports){
2645126451
/**

dist/plotly-basic.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plotly-cartesian.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25966,7 +25966,7 @@ function computeLegendDimensions(gd, groups, traces) {
2596625966
var opts = fullLayout.legend;
2596725967
var borderwidth = opts.borderwidth;
2596825968
var isGrouped = helpers.isGrouped(opts);
25969-
var isHorizontalColumn = helpers.isHorizontalColumn(opts);
25969+
var isHorizontalWrapped = helpers.isHorizontalWrapped(opts);
2597025970

2597125971
var extraWidth = 0;
2597225972

@@ -26090,11 +26090,11 @@ function computeLegendDimensions(gd, groups, traces) {
2609026090
});
2609126091

2609226092
// check if legend fits in one row
26093-
var oneRowLegend = !isHorizontalColumn || (fullLayout._size.w > borderwidth + fullTracesWidth - traceGap);
26093+
var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
2609426094

2609526095
traces.each(function(d) {
2609626096
var legendItem = d[0];
26097-
var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;
26097+
var traceWidth = (oneRowLegend || isHorizontalWrapped) ? 40 + d[0].width : maxTraceWidth;
2609826098

2609926099
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
2610026100
offsetX = 0;
@@ -26556,8 +26556,8 @@ exports.isReversed = function isReversed(legendLayout) {
2655626556
return (legendLayout.traceorder || '').indexOf('reversed') !== -1;
2655726557
};
2655826558

26559-
exports.isHorizontalColumn = function isHorizontalColumn(legendLayout) {
26560-
return legendLayout.horizontalspacing === 'column';
26559+
exports.isHorizontalWrapped = function isHorizontalWrapped(legendLayout) {
26560+
return legendLayout.horizontalspacing === 'wrapped';
2656126561
}
2656226562
},{}],106:[function(_dereq_,module,exports){
2656326563
/**

dist/plotly-cartesian.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plotly-finance.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25952,7 +25952,7 @@ function computeLegendDimensions(gd, groups, traces) {
2595225952
var opts = fullLayout.legend;
2595325953
var borderwidth = opts.borderwidth;
2595425954
var isGrouped = helpers.isGrouped(opts);
25955-
var isHorizontalColumn = helpers.isHorizontalColumn(opts);
25955+
var isHorizontalWrapped = helpers.isHorizontalWrapped(opts);
2595625956

2595725957
var extraWidth = 0;
2595825958

@@ -26076,11 +26076,11 @@ function computeLegendDimensions(gd, groups, traces) {
2607626076
});
2607726077

2607826078
// check if legend fits in one row
26079-
var oneRowLegend = !isHorizontalColumn || (fullLayout._size.w > borderwidth + fullTracesWidth - traceGap);
26079+
var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
2608026080

2608126081
traces.each(function(d) {
2608226082
var legendItem = d[0];
26083-
var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;
26083+
var traceWidth = (oneRowLegend || isHorizontalWrapped) ? 40 + d[0].width : maxTraceWidth;
2608426084

2608526085
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
2608626086
offsetX = 0;
@@ -26542,8 +26542,8 @@ exports.isReversed = function isReversed(legendLayout) {
2654226542
return (legendLayout.traceorder || '').indexOf('reversed') !== -1;
2654326543
};
2654426544

26545-
exports.isHorizontalColumn = function isHorizontalColumn(legendLayout) {
26546-
return legendLayout.horizontalspacing === 'column';
26545+
exports.isHorizontalWrapped = function isHorizontalWrapped(legendLayout) {
26546+
return legendLayout.horizontalspacing === 'wrapped';
2654726547
}
2654826548
},{}],105:[function(_dereq_,module,exports){
2654926549
/**

dist/plotly-finance.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plotly-geo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26633,7 +26633,7 @@ function computeLegendDimensions(gd, groups, traces) {
2663326633
var opts = fullLayout.legend;
2663426634
var borderwidth = opts.borderwidth;
2663526635
var isGrouped = helpers.isGrouped(opts);
26636-
var isHorizontalColumn = helpers.isHorizontalColumn(opts);
26636+
var isHorizontalWrapped = helpers.isHorizontalWrapped(opts);
2663726637

2663826638
var extraWidth = 0;
2663926639

@@ -26757,11 +26757,11 @@ function computeLegendDimensions(gd, groups, traces) {
2675726757
});
2675826758

2675926759
// check if legend fits in one row
26760-
var oneRowLegend = !isHorizontalColumn || (fullLayout._size.w > borderwidth + fullTracesWidth - traceGap);
26760+
var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
2676126761

2676226762
traces.each(function(d) {
2676326763
var legendItem = d[0];
26764-
var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;
26764+
var traceWidth = (oneRowLegend || isHorizontalWrapped) ? 40 + d[0].width : maxTraceWidth;
2676526765

2676626766
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
2676726767
offsetX = 0;
@@ -27223,8 +27223,8 @@ exports.isReversed = function isReversed(legendLayout) {
2722327223
return (legendLayout.traceorder || '').indexOf('reversed') !== -1;
2722427224
};
2722527225

27226-
exports.isHorizontalColumn = function isHorizontalColumn(legendLayout) {
27227-
return legendLayout.horizontalspacing === 'column';
27226+
exports.isHorizontalWrapped = function isHorizontalWrapped(legendLayout) {
27227+
return legendLayout.horizontalspacing === 'wrapped';
2722827228
}
2722927229
},{}],100:[function(_dereq_,module,exports){
2723027230
/**

dist/plotly-geo.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plotly-gl2d.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59562,7 +59562,7 @@ function computeLegendDimensions(gd, groups, traces) {
5956259562
var opts = fullLayout.legend;
5956359563
var borderwidth = opts.borderwidth;
5956459564
var isGrouped = helpers.isGrouped(opts);
59565-
var isHorizontalColumn = helpers.isHorizontalColumn(opts);
59565+
var isHorizontalWrapped = helpers.isHorizontalWrapped(opts);
5956659566

5956759567
var extraWidth = 0;
5956859568

@@ -59686,11 +59686,11 @@ function computeLegendDimensions(gd, groups, traces) {
5968659686
});
5968759687

5968859688
// check if legend fits in one row
59689-
var oneRowLegend = !isHorizontalColumn || (fullLayout._size.w > borderwidth + fullTracesWidth - traceGap);
59689+
var oneRowLegend = fullLayout._size.w > borderwidth + fullTracesWidth - traceGap;
5969059690

5969159691
traces.each(function(d) {
5969259692
var legendItem = d[0];
59693-
var traceWidth = oneRowLegend ? 40 + d[0].width : maxTraceWidth;
59693+
var traceWidth = (oneRowLegend || isHorizontalWrapped) ? 40 + d[0].width : maxTraceWidth;
5969459694

5969559695
if((borderwidth + offsetX + traceGap + traceWidth) > fullLayout._size.w) {
5969659696
offsetX = 0;
@@ -60152,8 +60152,8 @@ exports.isReversed = function isReversed(legendLayout) {
6015260152
return (legendLayout.traceorder || '').indexOf('reversed') !== -1;
6015360153
};
6015460154

60155-
exports.isHorizontalColumn = function isHorizontalColumn(legendLayout) {
60156-
return legendLayout.horizontalspacing === 'column';
60155+
exports.isHorizontalWrapped = function isHorizontalWrapped(legendLayout) {
60156+
return legendLayout.horizontalspacing === 'wrapped';
6015760157
}
6015860158
},{}],379:[function(_dereq_,module,exports){
6015960159
/**

dist/plotly-gl2d.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)