Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/traces/waterfall/cross_trace_calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ module.exports = function crossTraceCalc(gd, plotinfo) {
if(di.isSum === false) {
di.s0 += (j === 0) ? 0 : cd[j - 1].s;
}

if(j + 1 < cd.length) {
cd[j].nextP0 = cd[j + 1].p0;
cd[j].nextS0 = cd[j + 1].s0;
}
}
}
};
13 changes: 4 additions & 9 deletions src/traces/waterfall/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ function plotConnectors(gd, plotinfo, cdModule, traceLayer) {
var x2, y2;
var x3, y3;

var delta = 0;
if(i + 1 < len && Array.isArray(trace.offset)) {
delta -= trace.offset[i + 1] - trace.offset[i];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Where is offset taken in consideration? Do we have a mock with arrayOk trace.offset settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

}

if(isHorizontal) {
x0 = xa.c2p(di.s1, true);
y0 = ya.c2p(di.p1, true);
Expand All @@ -76,8 +71,8 @@ function plotConnectors(gd, plotinfo, cdModule, traceLayer) {
y2 = ya.c2p(di.p1, true);

if(i + 1 < len) {
x3 = xa.c2p(di.s0 + 1 - delta, true);
y3 = ya.c2p(di.p0 + 1 - delta, true);
x3 = xa.c2p(di.nextS0, true);
y3 = ya.c2p(di.nextP0, true);
}
} else {
x0 = xa.c2p(di.p1, true);
Expand All @@ -90,8 +85,8 @@ function plotConnectors(gd, plotinfo, cdModule, traceLayer) {
y2 = ya.c2p(di.s1, true);

if(i + 1 < len) {
x3 = xa.c2p(di.p0 + 1 - delta, true);
y3 = ya.c2p(di.s0 + 1 - delta, true);
x3 = xa.c2p(di.nextP0, true);
y3 = ya.c2p(di.nextS0, true);
}
}

Expand Down
Binary file added test/image/baselines/waterfall_date-axes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions test/image/mocks/waterfall_date-axes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"data": [{
"type": "waterfall",
"x": [
"2010-01-01",
"2010-07-01",
"2011-01-01",
"2012-01-01"
],
"y": [
1,
-2,
3,
0
],
"measure": [
"absolute",
"relative",
"relative",
"total"
]

}],
"layout": {
"width": 500,
"height": 250
}
}