Skip to content

Commit 8a9ed7e

Browse files
committed
move saveRangeInitial call in graphWasEmpty block:
- 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).
1 parent 42b4407 commit 8a9ed7e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/plot_api/plot_api.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,17 @@ Plotly.plot = function(gd, data, layout, config) {
147147
}
148148
else if(graphWasEmpty) makePlotFramework(gd);
149149

150+
// save initial axis range once per graph
151+
if(graphWasEmpty) Plotly.Axes.saveRangeInitial(gd);
152+
150153
var fullLayout = gd._fullLayout;
151154

152155
// prepare the data and find the autorange
153156

154157
// generate calcdata, if we need to
155158
// to force redoing calcdata, just delete it before calling Plotly.plot
156-
var recalc = !gd.calcdata || gd.calcdata.length!==(gd.data||[]).length;
157-
if(recalc) {
158-
doCalcdata(gd);
159-
160-
if(gd._context.doubleClick!==false || gd._context.displayModeBar!==false) {
161-
Plotly.Axes.saveRangeInitial(gd);
162-
}
163-
}
159+
var recalc = !gd.calcdata || gd.calcdata.length !== (gd.data || []).length;
160+
if(recalc) doCalcdata(gd);
164161

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

0 commit comments

Comments
 (0)