Skip to content

Commit b7fca1e

Browse files
authored
Merge pull request #3789 from plotly/fix3787-waterfall-line-width-react-in-mode-between
Waterfall connector.line.width react bug in mode between
2 parents 4f7592e + 39ceec7 commit b7fca1e

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ module.exports = {
9696
connector: {
9797
line: {
9898
color: extendFlat({}, lineAttrs.color, {dflt: Color.defaultLine}),
99-
width: lineAttrs.width,
99+
width: extendFlat({}, lineAttrs.width, {
100+
editType: 'plot', // i.e. to adjust bars is mode: 'between'. See https://github.com/plotly/plotly.js/issues/3787
101+
}),
100102
dash: lineAttrs.dash,
101103
editType: 'plot'
102104
},

Diff for: test/jasmine/tests/waterfall_test.js

+35
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,41 @@ describe('A waterfall plot', function() {
11401140
.catch(failTest)
11411141
.then(done);
11421142
});
1143+
1144+
it('should be able to adjust bars when reacting with new connector.line.width ', function(done) {
1145+
Plotly.plot(gd, {
1146+
data: [{
1147+
type: 'waterfall',
1148+
y: [1, 2, 3],
1149+
}],
1150+
layout: {
1151+
width: 500,
1152+
height: 500
1153+
}
1154+
})
1155+
.then(function() {
1156+
var traceNodes = getAllTraceNodes(gd);
1157+
var waterfallNodes = getAllWaterfallNodes(traceNodes[0]);
1158+
var path = waterfallNodes[0].querySelector('path');
1159+
var d = d3.select(path).attr('d');
1160+
expect(d).toBe('M11.33,321V268.33H102V321Z');
1161+
})
1162+
.then(function() {
1163+
gd.data[0].connector = {
1164+
line: { width: 10 }
1165+
};
1166+
return Plotly.react(gd, gd.data);
1167+
})
1168+
.then(function() {
1169+
var traceNodes = getAllTraceNodes(gd);
1170+
var waterfallNodes = getAllWaterfallNodes(traceNodes[0]);
1171+
var path = waterfallNodes[0].querySelector('path');
1172+
var d = d3.select(path).attr('d');
1173+
expect(d).toBe('M11.33,325V264.33H102V325Z');
1174+
})
1175+
.catch(failTest)
1176+
.then(done);
1177+
});
11431178
});
11441179

11451180
describe('waterfall visibility toggling:', function() {

0 commit comments

Comments
 (0)