Skip to content
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

Re-set autobin when defaults override. #149

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1647,11 +1647,11 @@ Plotly.restyle = function restyle(gd, astr, val, traces) {
if(typeof astr === 'string') aobj[astr] = val;
else if(Plotly.Lib.isPlainObject(astr)) {
aobj = astr;
if(traces===undefined) traces = val; // the 3-arg form
if(traces === undefined) traces = val; // the 3-arg form
}
else {
console.log('restyle fail',astr,val,traces);
return new Promise.reject();
return Promise.reject();
}

if(Object.keys(aobj).length) gd.changed = true;
Expand Down Expand Up @@ -2173,7 +2173,7 @@ Plotly.relayout = function relayout(gd, astr, val) {
gd = getGraphDiv(gd);

if(gd.framework && gd.framework.isPolar) {
return new Promise.resolve(gd);
return Promise.resolve(gd);
}

var layout = gd.layout,
Expand Down
9 changes: 9 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,15 @@ plots.supplyDefaults = function(gd) {
trace = newData[i];

fullTrace = plots.supplyDataDefaults(trace, i, newFullLayout);

// 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]){
Copy link
Contributor

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

Copy link
Contributor

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

fullTrace.autobinx = oldFullData[i].autobinx || fullTrace.autobinx;
fullTrace.autobiny = oldFullData[i].autobiny || fullTrace.autobiny;
}

newFullData.push(fullTrace);

// DETECT 3D, Cartesian, and Polar
Expand Down