Skip to content

Commit 032e604

Browse files
committed
fix 3785 waterfall connectors on date axes
1 parent 4f7592e commit 032e604

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

Diff for: src/traces/waterfall/cross_trace_calc.js

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ module.exports = function crossTraceCalc(gd, plotinfo) {
6565
if(di.isSum === false) {
6666
di.s0 += (j === 0) ? 0 : cd[j - 1].s;
6767
}
68+
69+
if(j + 1 < cd.length) {
70+
cd[j].nextP0 = cd[j + 1].p0;
71+
cd[j].nextS0 = cd[j + 1].s0;
72+
}
6873
}
6974
}
7075
};

Diff for: src/traces/waterfall/plot.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ function plotConnectors(gd, plotinfo, cdModule, traceLayer) {
6060
var x2, y2;
6161
var x3, y3;
6262

63-
var delta = 0;
64-
if(i + 1 < len && Array.isArray(trace.offset)) {
65-
delta -= trace.offset[i + 1] - trace.offset[i];
66-
}
67-
6863
if(isHorizontal) {
6964
x0 = xa.c2p(di.s1, true);
7065
y0 = ya.c2p(di.p1, true);
@@ -76,8 +71,8 @@ function plotConnectors(gd, plotinfo, cdModule, traceLayer) {
7671
y2 = ya.c2p(di.p1, true);
7772

7873
if(i + 1 < len) {
79-
x3 = xa.c2p(di.s0 + 1 - delta, true);
80-
y3 = ya.c2p(di.p0 + 1 - delta, true);
74+
x3 = xa.c2p(di.nextS0, true);
75+
y3 = ya.c2p(di.nextP0, true);
8176
}
8277
} else {
8378
x0 = xa.c2p(di.p1, true);
@@ -90,8 +85,8 @@ function plotConnectors(gd, plotinfo, cdModule, traceLayer) {
9085
y2 = ya.c2p(di.s1, true);
9186

9287
if(i + 1 < len) {
93-
x3 = xa.c2p(di.p0 + 1 - delta, true);
94-
y3 = ya.c2p(di.s0 + 1 - delta, true);
88+
x3 = xa.c2p(di.nextP0, true);
89+
y3 = ya.c2p(di.nextS0, true);
9590
}
9691
}
9792

Diff for: test/image/baselines/waterfall_date-axes.png

7.43 KB
Loading

Diff for: test/image/mocks/waterfall_date-axes.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"data": [{
3+
"type": "waterfall",
4+
"x": [
5+
"2010-01-01",
6+
"2010-07-01",
7+
"2011-01-01",
8+
"2012-01-01"
9+
],
10+
"y": [
11+
1,
12+
-2,
13+
3,
14+
0
15+
],
16+
"measure": [
17+
"absolute",
18+
"relative",
19+
"relative",
20+
"total"
21+
]
22+
23+
}],
24+
"layout": {
25+
"width": 500,
26+
"height": 250
27+
}
28+
}

0 commit comments

Comments
 (0)