-
-
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
Histogram autobin #3044
Histogram autobin #3044
Conversation
no error on `undefined` but yes on non-finite numbers
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.
Looks like this worked out pretty well 💪 ⛵ 🍸
I really like the new-found use of _module.cleanData
. It's nice way to confine somewhat-hacky logic to a small scope. Going forward, it might be the solution to other "missing fields in fullData" bugs cc #2834.
I found one thing that's probably worth adding to the PR description for future reference: how auto-binning now considers sample data from multiple traces.
Now, I'll probably need to go through Histogram.calc
again to make full sense of it, but here are a few blocking comments in the meantime:
- We should ask RCE team to QA this thing (cc @nicolaskruchten )
- We should test this in the old toolpanel
- We should append the
(x|y)bins*
attribute descriptions. Mainly,histogram
andhistogram2d
should not longer use the same description (ashistogram
has cross-trace coupling). Moreover, we should make sure_deprecated
attributes still show up on https://plot.ly/javascript/reference/ - Jasmine test coverage looks solid, but we should add at least one image mock
- Get
Plotly.validate
to work with(x|y)bins*
attributes
src/traces/histogram/defaults.js
Outdated
|
||
handleBinDefaults(traceIn, traceOut, coerce, [sampleLetter]); | ||
// Note: bin defaults are now handled in Histogram.cleanData |
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.
Oh that's probably bad news for Plotly.validate
.
We'll need to either bring back the coerce
calls here or make plot_api/validate.js
call _module.cleanData
. Come to think of it, the latter sounds like the "correct" thing to do with or w/o this new logic.
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.
_module.cleanData
is in supplyDefaults
so this doesn't cause problems. I'll add a test though to 🔒 it.
Given its location in the pipeline - and the uses we're accreting for it - cleanData
is probably not a great name, perhaps we should change it to _module.crossTraceDefaults
?
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.
_module.cleanData is in supplyDefaults so this doesn't cause problems.
Oh right, I got confused with the only cleanData
. Great!
is probably not a great name, perhaps we should change it to
_module.crossTraceDefaults
?
This would be great! No need to do in this PR of course. A new issue or a comment in #749 would be good enough for now.
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'd be happy to give this guy an RCE QA pass when it's ready! |
Should we wait till it hits master and do it as part of pre-release QA? or want us to do it pre-dancer? |
@nicolaskruchten pre-dancer might be nice, as it's going to need some changes in RCE - ie in order to re-enable autobin after this PR we either need a special button to delete the Note that even if (as @etpinard suggested above) I put |
+1 Pre-dancer would be best. |
I assume we have an autobin toggle there, it's going to need to change to something like what I described in #3044 (comment) (probably the simpler option is better for toolpanel)
improved the attribute descriptions - and moved them out of
good call, I also used that to ensure the subplot logic works right -> 7909f53
part of 76eee4b |
@@ -438,17 +438,17 @@ plots.supplyDefaults = function(gd, opts) { | |||
plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData); | |||
|
|||
// Special cases that introduce interactions between traces. | |||
// This is after relinkPrivateKeys so we can use those in cleanData | |||
// This is after relinkPrivateKeys so we can use those in crossTraceDefaults |
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.
Grepping for cleanData
in streambed, I found:
@VeraZab does this ring a bell? Is that line still getting used?
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.
Line 157351 - looks like it's pulling in a whole plotly.js bundle.
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.
Good 👁️ , false alarm.
All my comments have been addressed 🥇 Hopefully the RCE will be happy with the changes too 🙏 |
https://github.com/plotly/streambed/pull/11589 adapted the toolpanel for this change. @nicolaskruchten @VeraZab have you gotten a chance to look at integrating it with RCE, per #3044 (comment)? |
I have not, but I can do it today :) |
OK, here's a WIP ... behaving not great: https://github.com/plotly/react-chart-editor/tree/autobin ... that branch will stay up to date with this one, so just |
After we got it plumbed up to the correct code, @nicolaskruchten assures me that RCE is in fact happy with these changes - they will not have the bandwidth to add reset to auto values right away, but that's a general feature in the queue to support for all fields so it won't be missing for too long. @etpinard AFAICT this is now ready to go. Anything else? |
Nothing else. 💃 |
... in Histogram.calc loop looking for isFirstVisible trace
Closes #3001
A thorough update of our autobinning algorithms for 1D and 2D histograms:
size
,start
, andend
) can be provided or omitted independently, and autobin figures out the rest.autobin(x|y)
attributes, but maintains their behavior in bothnewPlot
/react
andrestyle
.start
values.size
applies to all traces in the groupstart
is used precisely, all other traces we use either the explicitstart
or that trace's minimum data value but shift it so the bin edges match.I also fixed a couple of small issues that cropped up along the way:
cleanDate
behave more likecoerce
by silently returning the default value onundefined
input, but still generating a log error message for invalid dates and adding log errors for non-finite numbers. c5cb42clegend.traceorder
would lose itsreversed
default when you hid all traces in the legend... so clicking the same spot after that would re-show a different trace than the one you intended! To fix this I hadsupplyDefaults
runsupplyLayoutDefaults
for all trace modules, not just visible ones. I suppose this could be overkill as it will includevisible: false
as well aslegendonly
, but that seems to me better than what we have now. e066bb9cc @etpinard @antoinerg