Skip to content

Commit 37567e9

Browse files
committed
simplify box/meanlin visible logic
1 parent 7d50630 commit 37567e9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/traces/box/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function plotBoxAndWhiskers(sel, axes, trace, t) {
102102

103103
var paths = sel.selectAll('path.box').data((
104104
trace.type !== 'violin' ||
105-
(trace.box || {}).visible
105+
trace.box.visible
106106
) ? Lib.identity : []);
107107

108108
paths.enter().append('path')
@@ -304,7 +304,7 @@ function plotBoxMean(sel, axes, trace, t) {
304304

305305
var paths = sel.selectAll('path.mean').data((
306306
(trace.type === 'box' && trace.boxmean) ||
307-
(trace.type === 'violin' && (trace.box || {}).visible && (trace.meanline || {}).visible)
307+
(trace.type === 'violin' && trace.box.visible && trace.meanline.visible)
308308
) ? Lib.identity : []);
309309

310310
paths.enter().append('path')

src/traces/violin/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ module.exports = function plot(gd, plotinfo, cd, violinLayer) {
147147
d.pathLength = d.path.getTotalLength() / (hasBothSides ? 2 : 1);
148148
});
149149

150-
var boxAttrs = trace.box || {};
150+
var boxAttrs = trace.box;
151151
var boxWidth = boxAttrs.width;
152152
var boxLineWidth = (boxAttrs.line || {}).width;
153153
var bdPosScaled;
@@ -179,7 +179,7 @@ module.exports = function plot(gd, plotinfo, cd, violinLayer) {
179179
});
180180

181181
var fn;
182-
if(!(trace.box || {}).visible && (trace.meanline || {}).visible) {
182+
if(!trace.box.visible && trace.meanline.visible) {
183183
fn = Lib.identity;
184184
}
185185

0 commit comments

Comments
 (0)