Skip to content

Commit a5fdc4f

Browse files
committed
Add top right + orient=v test cases
1 parent dac140c commit a5fdc4f

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

Diff for: src/components/legend/draw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ function computeTextDimensions(g, gd, legendObj, aTitle) {
668668
} else if(legendObj.title.side === 'top center') {
669669
if(legendObj._width) titleOffset = 0.5 * (legendObj._width - 2 * bw - 2 * constants.titlePad - width);
670670
} else if(legendObj.title.side === 'top right') {
671-
if(legendObj._width) titleOffset = legendObj._width - bw - constants.titlePad - width;
671+
if(legendObj._width) titleOffset = legendObj._width - 2 * bw - constants.titlePad - width;
672672
}
673673

674674
svgTextUtils.positionText(textEl,

Diff for: test/image/baselines/legend_horizontal_autowrap.png

-80 Bytes
Loading

Diff for: test/image/baselines/legend_itemwidth_dashline.png

510 Bytes
Loading

Diff for: test/image/mocks/legend_horizontal_autowrap.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@
547547
"size": 11.9552
548548
},
549549
"y": -0.4,
550-
"orientation": "h"
550+
"orientation": "h",
551+
"title": { "text": "Legend Title", "side": "top right" }
551552
},
552553
"hovermode": "closest",
553554
"width": 680,

Diff for: test/image/mocks/legend_itemwidth_dashline.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
],
4040
"layout": {
4141
"legend": {
42-
"itemwidth": 60
42+
"itemwidth": 60,
43+
"title": { "text": "Title", "side": "top center" }
4344
}
4445
}
4546
}

0 commit comments

Comments
 (0)