-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Re-set autobin
when defaults override.
#149
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
Conversation
// If autobinned before, autobin again. supplyDataDefaults sees | ||
// the generated bin object and assumes it has been set manually | ||
// so we need to override that behaviour. | ||
if (oldFullData[i]){ |
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.
this belongs in Plotly.restyle
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.
hmm, on second thought, moving this block to restyle
would not fix the problem in Plotly.extendTraces
@mdtusz (cc @alexcjohnson @cldougl) Times where the calc or plot step adds attributes to user
|
Updating histogram data should clear the computed xbins and ybins, but the other cases aren't as obvious. Should updating contour data clear the computed contours attributes? I'd vote for no. Should the updating data linked to a colorscale update the bounds of the colorscale? I'd vote for no also. So, looks like xbins ans ybins are in a league of their own. |
Is it possible for a |
everything is displayed correctly. My comment referred to the computed auto contour and auto colorscale ranges. For example, at the moment, starting from a heatmap trace with I think this correct. Updating heatmap data should not magically re-compute the colorscale range. |
@mdtusz this turns out to a pretty hard problem. First, the problem of #24 only affects restyle/extendTraces calls with new data outside the computed [ e.g. Plotly.plot(Tabs.fresh(), [
{
type: 'histogram',
x: [ 0, 1, 1, 2, 2, 2, 3, 3, 4]
}]
).then(function(gd) {
Plotly.extendTraces(gd, {x: [[2,2,2,2]]}, [0]);
}).then(function(gd) {
Plotly.restyle(gd, {x: [[0,0,0,1,2,3,3,3,4,4]]}, [0])
}); behaves as expected. Now, consider the case where a user sets the Plotly.plot(Tabs.fresh(), [
{
type: 'histogram',
x: [ 0, 1, 1, 2, 2, 2, 3, 3, 4],
xbins: { // N.B. this defaults fullTrace.autobinx to true
start: 0,
end: 4,
size: 1
}
}]
).then(function(gd) {
Plotly.extendTraces(gd, {x: [[2,2,2,2]]}, [0]);
}); then, the extendTraces call should not clear the set I'm not sure what the solution should be. We could to find a way to extend the [ |
At present, this PR will likely create more issues than it solves, so it is being temporarily closed. |
Fairly straightforward fix. Take a look and let me know if there's a more suitable place to put this logic.