Skip to content

Commit 5ca95d3

Browse files
committed
save initial ranges after insideticklabel is done
1 parent 74f594d commit 5ca95d3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/components/modebar/buttons.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ function handleCartesian(gd, ev) {
249249
var astr = button.getAttribute('data-attr');
250250
var val = button.getAttribute('data-val') || true;
251251
var fullLayout = gd._fullLayout;
252+
if(val === 'auto') {
253+
fullLayout._insideTickLabelsAutorangeDone = undefined;
254+
}
255+
252256
var aobj = {};
253257
var axList = axisIds.list(gd, null, true);
254258
var allSpikesEnabled = fullLayout._cartesianSpikesEnabled;

src/plot_api/plot_api.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,16 @@ function plot(gd, data, layout, config) {
382382
// component drawing - see https://github.com/plotly/plotly.js/issues/2704
383383
Plots.doAutoMargin,
384384
insideTickLabelsAutorange,
385+
saveRangeInitialForInsideTickLabels,
385386
Plots.previousPromises
386387
);
387388

389+
function saveRangeInitialForInsideTickLabels(gd) {
390+
if(gd._fullLayout._insideTickLabelsAutorangeDone) {
391+
if(graphWasEmpty) Axes.saveRangeInitial(gd, true);
392+
}
393+
}
394+
388395
// even if everything we did was synchronous, return a promise
389396
// so that the caller doesn't care which route we took
390397
var plotDone = Lib.syncOrAsync(seq, gd);
@@ -399,6 +406,8 @@ function plot(gd, data, layout, config) {
399406
function insideTickLabelsAutorange(gd) {
400407
var obj = gd._fullLayout._insideTickLabelsAutorange;
401408
if(!obj) return;
409+
410+
402411
gd._fullLayout._insideTickLabelsAutorangeDone = true;
403412
return relayout(gd, obj);
404413
}

0 commit comments

Comments
 (0)