-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix box & violin inner parts removal #2785
Conversation
src/traces/box/plot.js
Outdated
fn = Lib.identity; | ||
} | ||
|
||
var paths = sel.selectAll('path.box').data(fn || []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this pattern! But two comments about it:
trace.box
andtrace.meanline
are deleted rather than left withvisible: false
- so can't we just say(trace.type === 'violin' && trace.box)
etc?- I'm a bit uneasy relying on uninitialized vars being
undefined
- seems like it makes things more fragile, for example if we usefn
again, or wrap this block in a loop or something... I'd rather a pattern like
var fn;
if(...) fn = Lib.identity;
else fn = []; // or just var fn = []; and drop the else, dunno which is better
var paths = sel.selectAll('path.box').data(fn);
src/traces/box/plot.js
Outdated
@@ -102,6 +102,7 @@ function plotBoxAndWhiskers(sel, axes, trace, t) { | |||
|
|||
var fn; | |||
if(trace.type === 'box' || | |||
trace.type === 'candlestick' || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps trace.type !== 'violin' || trace.box
? NBD either way, we'd of course figure it out pretty quick if we add any other trace type that reuses box drawing.
Very nicely done - getting us that much closer to regular d3 idioms - and great tests! Both of my comments are nonblocking - 💃 |
fixes #2777 and a bunch of other restyle/react bugs introduced in #2579, where the box and violin meanlines and points d3-data-binds assume a clean parent
<g>
and didn't care about clearing parts that should no longer be visible.cc @alexcjohnson @dmt0