Skip to content

Commit e7a690c

Browse files
committed
clear empty boxes and candlestick - fixing 4729
1 parent 3dc3b09 commit e7a690c

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

src/traces/box/plot.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function plotBoxAndWhiskers(sel, axes, trace, t, isStatic) {
8181
paths.exit().remove();
8282

8383
paths.each(function(d) {
84-
if(d.empty) return 'M0,0Z';
84+
if(d.empty) return d3.select(this).attr('d', 'M0,0Z');
8585

8686
var lcenter = posAxis.c2l(d.pos + bPos, true);
8787

test/jasmine/tests/finance_test.js

+42
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,48 @@ describe('finance charts updates:', function() {
10471047
})
10481048
.then(done, done.fail);
10491049
});
1050+
1051+
it('should clear empty candlestick boxes using react', function(done) {
1052+
var type = 'candlestick';
1053+
var x = [0, 1];
1054+
1055+
var steps = [{
1056+
data: [{
1057+
close: [132, null],
1058+
high: [204, 20],
1059+
low: [30, 193],
1060+
open: [78, 79],
1061+
type: type,
1062+
x: x
1063+
}],
1064+
layout: {}
1065+
},
1066+
{
1067+
data: [{
1068+
close: [140, 78],
1069+
high: [91, 117],
1070+
low: [115, 78],
1071+
open: [null, 97],
1072+
type: type,
1073+
x: x
1074+
}],
1075+
layout: {}
1076+
}];
1077+
1078+
Plotly.newPlot(gd, steps[0])
1079+
.then(function() {
1080+
return Plotly.react(gd, steps[1]);
1081+
}).then(function() {
1082+
expect(
1083+
d3Select('g.cartesianlayer')
1084+
.selectAll('g.trace.boxes')
1085+
.selectAll('path')
1086+
.node()
1087+
.getAttribute('d')
1088+
).toEqual('M0,0Z');
1089+
})
1090+
.then(done, done.fail);
1091+
});
10501092
});
10511093

10521094
describe('finance charts *special* handlers:', function() {

0 commit comments

Comments
 (0)