Skip to content

Commit a6e90cb

Browse files
committed
sankey fix translateX for subplots
1 parent 9070705 commit a6e90cb

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

src/traces/sankey/render.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function sankeyModel(layout, d, traceIndex) {
172172
valueFormat: valueFormat,
173173
valueSuffix: valueSuffix,
174174
textFont: textFont,
175-
translateX: domain.x[0] * width + layout.margin.l,
175+
translateX: domain.x[0] * layout.width + layout.margin.l,
176176
translateY: layout.height - domain.y[1] * layout.height + layout.margin.t,
177177
dragParallel: horizontal ? height : width,
178178
dragPerpendicular: horizontal ? width : height,

test/image/mocks/sankey_subplots.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"data": [{
3+
"domain": {
4+
"x": [0, 0.45]
5+
},
6+
"type": "sankey",
7+
"orientation": "h",
8+
"node": {
9+
"line": {
10+
"color": "black"
11+
},
12+
"label": ["el1", "el2", "el3"]
13+
},
14+
"link": {
15+
"source": [0, 2],
16+
"target": [1, 1],
17+
"value": [120, 50],
18+
"label": ["stram1", "stream2"]
19+
}
20+
},
21+
{
22+
"domain": {
23+
"x": [0.55, 1]
24+
},
25+
"type": "sankey",
26+
"orientation": "h",
27+
"node": {
28+
"line": {
29+
"color": "black"
30+
},
31+
"label": ["el4", "el5", "el6"]
32+
},
33+
"link": {
34+
"source": [0, 2],
35+
"target": [1, 1],
36+
"value": [120, 50],
37+
"label": ["stram4", "stream5"]
38+
}
39+
}
40+
],
41+
"layout": {
42+
"title": "Multiple Sankey plots",
43+
"autosize": true,
44+
"showlegend": false
45+
}
46+
}

0 commit comments

Comments
 (0)