Skip to content

Commit 144989c

Browse files
committed
Address 3/4 of @alexcjohnson's comments on notches
1 parent a234668 commit 144989c

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/traces/box/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
2929
coerce('whiskerwidth');
3030
coerce('boxmean');
3131

32-
coerce('notched');
33-
coerce('notchwidth');
32+
var notched = coerce('notched');
33+
if(notched) coerce('notchwidth');
3434

3535
handlePointsDefaults(traceIn, traceOut, coerce, {prefix: 'box'});
3636
}

src/traces/box/plot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ function plotBoxAndWhiskers(sel, axes, trace, t) {
146146
d3.select(this).attr('d',
147147
'M' + m + ',' + posm0 + 'V' + posm1 + // median line
148148
'M' + q1 + ',' + pos0 + 'V' + pos1 + // left edge
149-
(((notched === true)) ? 'H' + ln + 'L' + m + ',' + posm1 + 'L' + un + ',' + pos1 : '') + // top notched edge
149+
(notched ? 'H' + ln + 'L' + m + ',' + posm1 + 'L' + un + ',' + pos1 : '') + // top notched edge
150150
'H' + q3 + // end of the top edge
151151
'V' + pos0 + // right edge
152-
(((notched === true)) ? 'H' + un + 'L' + m + ',' + posm0 + 'L' + ln + ',' + pos0 : '') + // bottom notched edge
152+
(notched ? 'H' + un + 'L' + m + ',' + posm0 + 'L' + ln + ',' + pos0 : '') + // bottom notched edge
153153
'Z' + // end of the box
154154
'M' + q1 + ',' + posc + 'H' + lf + 'M' + q3 + ',' + posc + 'H' + uf + // whiskers
155155
((whiskerWidth === 0) ? '' : // whisker caps
@@ -158,10 +158,10 @@ function plotBoxAndWhiskers(sel, axes, trace, t) {
158158
d3.select(this).attr('d',
159159
'M' + posm0 + ',' + m + 'H' + posm1 + // median line
160160
'M' + pos0 + ',' + q1 + 'H' + pos1 + // top of the box
161-
(((notched === true)) ? 'V' + ln + 'L' + posm1 + ',' + m + 'L' + pos1 + ',' + un : '') + // notched right edge
161+
(notched ? 'V' + ln + 'L' + posm1 + ',' + m + 'L' + pos1 + ',' + un : '') + // notched right edge
162162
'V' + q3 + // end of the right edge
163163
'H' + pos0 + // bottom of the box
164-
(((notched === true)) ? 'V' + un + 'L' + posm0 + ',' + m + 'L' + pos0 + ',' + ln : '') + // notched left edge
164+
(notched ? 'V' + un + 'L' + posm0 + ',' + m + 'L' + pos0 + ',' + ln : '') + // notched left edge
165165
'Z' + // end of the box
166166
'M' + posc + ',' + q1 + 'V' + lf + 'M' + posc + ',' + q3 + 'V' + uf + // whiskers
167167
((whiskerWidth === 0) ? '' : // whisker caps
450 Bytes
Loading

test/image/mocks/box_horz_notched.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@
282282
},
283283
"height":598,
284284
"width":1080,
285+
"margin":{
286+
"l":110
287+
},
285288
"autosize":true
286289
}
287290
}

0 commit comments

Comments
 (0)