Skip to content

Commit 94b31a8

Browse files
authored
Merge pull request #5139 from fredrikw/legen_prob
Fix issue 4986 - disappearing legend entries
2 parents b08c0e8 + 0809b71 commit 94b31a8

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

src/components/legend/draw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ function computeLegendDimensions(gd, groups, traces, opts) {
708708
var w = textGap + d[0].width;
709709
var next = (oneRowLegend ? w : maxItemWidth) + itemGap;
710710

711-
if((next + bw + offsetX) > opts._maxWidth) {
711+
if((next + bw + offsetX - itemGap) >= opts._maxWidth) {
712712
maxRowWidth = Math.max(maxRowWidth, rowWidth);
713713
offsetX = 0;
714714
offsetY += maxItemHeightInRow;
Loading
1.59 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"data": [
3+
{
4+
"x": [0, 20, 40, 60, 80],
5+
"y": [96.5468065879, 94.97385191686, 101.01829113346, 104.00785694962, 123.4647966861],
6+
"type": "scatter",
7+
"name": "test1 test test test test te"
8+
},
9+
{
10+
"x": [0, 20, 40, 60, 80],
11+
"y": [101.463715404525, 97.993757416425, 100.77392335440001, 101.23231922917499, 106.118254309675],
12+
"type": "scatter",
13+
"name": "test2"
14+
},
15+
{
16+
"x": [0, 20, 40, 60, 80],
17+
"y": [12, 9, 15, 12, 15],
18+
"type": "scatter",
19+
"name": "test3"
20+
}
21+
],
22+
"layout": {
23+
"title": "Testplot",
24+
"width": 400,
25+
"height": 300,
26+
"legend": {"orientation": "h"},
27+
"margin": {"l": 30, "r": 20}
28+
}
29+
}

0 commit comments

Comments
 (0)