Skip to content

Commit

Permalink
move saveRangeInitial call in graphWasEmpty block:
Browse files Browse the repository at this point in the history
- so that restyle calls that update that purge gd.calcdata
  don't update the 'initial' axis ranges.
- save initial range even if gd._context settings are such
  that it won't get used (in case gd._context changes during the
  plot life cycle).
  • Loading branch information
etpinard committed Mar 23, 2016
1 parent 42b4407 commit 8a9ed7e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,17 @@ Plotly.plot = function(gd, data, layout, config) {
}
else if(graphWasEmpty) makePlotFramework(gd);

// save initial axis range once per graph
if(graphWasEmpty) Plotly.Axes.saveRangeInitial(gd);

var fullLayout = gd._fullLayout;

// prepare the data and find the autorange

// generate calcdata, if we need to
// to force redoing calcdata, just delete it before calling Plotly.plot
var recalc = !gd.calcdata || gd.calcdata.length!==(gd.data||[]).length;
if(recalc) {
doCalcdata(gd);

if(gd._context.doubleClick!==false || gd._context.displayModeBar!==false) {
Plotly.Axes.saveRangeInitial(gd);
}
}
var recalc = !gd.calcdata || gd.calcdata.length !== (gd.data || []).length;
if(recalc) doCalcdata(gd);

// in case it has changed, attach fullData traces to calcdata
for(var i = 0; i < gd.calcdata.length; i++) {
Expand Down

0 comments on commit 8a9ed7e

Please sign in to comment.