Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dc2609

Browse files
committed
Legend: set tspan.line's x before expandMargin
* Ensure the position of the `tspan.line`s is set before computing the legend dimensions and expanding the margins. * The baseline image for `pseudo_html.json` needed updating because it has a multi-line legend.
1 parent b2538e1 commit 9dc2609

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/components/legend/draw.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,12 @@ function drawTexts(gd, context, legendItem, traces) {
334334

335335
function textLayout(s) {
336336
Plotly.util.convertToTspans(s, function() {
337+
s.selectAll('tspan.line').attr({x: s.attr('x')});
338+
337339
if(gd.firstRender) {
338340
computeLegendDimensions(gd, traces);
339341
expandMargin(gd);
340342
}
341-
s.selectAll('tspan.line').attr({x: s.attr('x')});
342343
});
343344
}
344345

test/image/baselines/pseudo_html.png

603 Bytes
Loading

0 commit comments

Comments
 (0)