Skip to content

Commit 2554482

Browse files
committed
fix lf/uf vs min/max logic for box/violin/candlestick
1 parent ad1d8f0 commit 2554482

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/traces/box/plot.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,16 @@ function plotBoxAndWhiskers(sel, axes, trace, t) {
127127
valAxis.c2p(d.med, true),
128128
Math.min(q1, q3) + 1, Math.max(q1, q3) - 1
129129
);
130-
var lf = valAxis.c2p(trace.boxpoints ? d.lf : d.min, true);
131-
var uf = valAxis.c2p(trace.boxpoints ? d.uf : d.max, true);
130+
131+
// for compatibility with box, violin, and candlestick
132+
// perhaps we should put this into cd0.t instead so it's more explicit,
133+
// but what we have now is:
134+
// - box always has d.lf, but boxpoints can be anything
135+
// - violin has d.lf and should always use it (boxpoints is undefined)
136+
// - candlestick has only min/max
137+
var useExtremes = (d.lf === undefined) || (trace.boxpoints === false);
138+
var lf = valAxis.c2p(useExtremes ? d.min : d.lf, true);
139+
var uf = valAxis.c2p(useExtremes ? d.max : d.uf, true);
132140
var ln = valAxis.c2p(d.ln, true);
133141
var un = valAxis.c2p(d.un, true);
134142

0 commit comments

Comments
 (0)