Skip to content

Commit 17a1df7

Browse files
committed
adjustment for multi-lines on vertical sankey
1 parent 8ffbbca commit 17a1df7

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

src/traces/sankey/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) {
987987
// how much to shift a multi-line label to center it vertically.
988988
var nLines = svgTextUtils.lineCount(e);
989989
var blockHeight = d.textFont.size * (
990-
nLines === 1 ? -CAP_SHIFT : (nLines - 1) * LINE_SPACING
990+
(nLines - 1) * LINE_SPACING - CAP_SHIFT
991991
);
992992

993993
// TODO: handle MathJax
5.23 KB
Loading

test/image/mocks/sankey_subplots.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
{
22
"data": [{
3-
"textfont": {
4-
"color": "red"
5-
},
63
"domain": {
7-
"x": [0, 0.45]
4+
"y": [0, 0.45]
85
},
96
"type": "sankey",
107
"orientation": "h",
118
"node": {
129
"line": {
13-
"width": 8,
10+
"width": 4,
1411
"color": "black"
1512
},
1613
"label": [
1714
"<i>Rien ne se perd,<br>rien ne se crée,<br>tout se <b>transforme</b>.</i><sub>",
18-
"el2",
15+
"H<sub>2</sub>O",
1916
"<b>e<sup>iπ</sup> = cos i + i sin π</b>"
2017
]
2118
},
@@ -24,25 +21,37 @@
2421
"target": [1, 1],
2522
"value": [120, 50],
2623
"label": ["stram1", "stream2"]
24+
},
25+
"textfont": {
26+
"color": "darkblue"
2727
}
2828
},
2929
{
3030
"domain": {
31-
"x": [0.55, 1]
31+
"y": [0.55, 1]
3232
},
3333
"type": "sankey",
34-
"orientation": "h",
34+
"orientation": "v",
3535
"node": {
36+
"thickness": 50,
3637
"line": {
38+
"width": 4,
3739
"color": "black"
3840
},
39-
"label": ["el4", "el5", "el6"]
41+
"label": [
42+
"<i>Rien ne se perd,<br>rien ne se crée,<br>tout se <b>transforme</b>.</i><sub>",
43+
"H<sub>2</sub>O",
44+
"<b>e<sup>iπ</sup> = cos i + i sin π</b>"
45+
]
4046
},
4147
"link": {
4248
"source": [0, 2],
4349
"target": [1, 1],
4450
"value": [120, 50],
45-
"label": ["stram4", "stream5"]
51+
"label": ["stram1", "stream2"]
52+
},
53+
"textfont": {
54+
"color": "darkblue"
4655
}
4756
},
4857
{
@@ -52,7 +61,8 @@
5261
],
5362
"layout": {
5463
"title": {"text": "Multiple Sankey plots"},
55-
"autosize": true,
64+
"width": 600,
65+
"height": 600,
5666
"showlegend": false
5767
}
5868
}

0 commit comments

Comments
 (0)