Skip to content

Commit 350c74b

Browse files
committed
add extra space between legend title and itmes in the case of horizontal
1 parent 8ca5840 commit 350c74b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/legend/draw.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ function computeTextDimensions(g, gd, legendObj, aTitle) {
508508
return;
509509
}
510510

511+
var isVertical = helpers.isVertical(legendObj);
512+
511513
var mathjaxGroup = g.select('g[class*=math-group]');
512514
var mathjaxNode = mathjaxGroup.node();
513515
if(!legendObj) legendObj = gd._fullLayout.legend;
@@ -539,6 +541,11 @@ function computeTextDimensions(g, gd, legendObj, aTitle) {
539541
// approximation to height offset to center the font
540542
// to avoid getBoundingClientRect
541543
if(aTitle === MAIN_TITLE) {
544+
if(!isVertical) {
545+
// add extra space between legend title and itmes
546+
width += constants.titlePad * 2;
547+
}
548+
542549
svgTextUtils.positionText(textEl,
543550
bw + constants.titlePad,
544551
bw + lineHeight

0 commit comments

Comments
 (0)