Skip to content

Commit 1e4900c

Browse files
committed
cleanup logic for data-bind fn / fallback to []
1 parent b2a55f6 commit 1e4900c

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/traces/box/plot.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@ function plotBoxAndWhiskers(sel, axes, trace, t) {
100100
bdPos1 = t.bdPos;
101101
}
102102

103-
var fn;
104-
if(trace.type === 'box' ||
105-
trace.type === 'candlestick' ||
106-
(trace.type === 'violin' && (trace.box || {}).visible)
107-
) {
108-
fn = Lib.identity;
109-
}
110-
111-
var paths = sel.selectAll('path.box').data(fn || []);
103+
var paths = sel.selectAll('path.box').data((
104+
trace.type !== 'violin' ||
105+
trace.box
106+
) ? Lib.identity : []);
112107

113108
paths.enter().append('path')
114109
.style('vector-effect', 'non-scaling-stroke')
@@ -307,14 +302,10 @@ function plotBoxMean(sel, axes, trace, t) {
307302
bdPos1 = t.bdPos;
308303
}
309304

310-
var fn;
311-
if(trace.type === 'box' && trace.boxmean ||
312-
(trace.type === 'violin' && (trace.box || {}).visible && (trace.meanline || {}).visible)
313-
) {
314-
fn = Lib.identity;
315-
}
316-
317-
var paths = sel.selectAll('path.mean').data(fn || []);
305+
var paths = sel.selectAll('path.mean').data((
306+
(trace.type === 'box' && trace.boxmean) ||
307+
(trace.type === 'violin' && trace.box && trace.meanline)
308+
) ? Lib.identity : []);
318309

319310
paths.enter().append('path')
320311
.attr('class', 'mean')

0 commit comments

Comments
 (0)