Skip to content

Commit 631014a

Browse files
committed
Add (large) upper bound on the number of redraw calls
... that Plots.doAutoMargin can trigger.
1 parent 7a8eedf commit 631014a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/plots/plots.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,19 @@ plots.doAutoMargin = function(gd) {
19601960
} else {
19611961
fullLayout._redrawFromAutoMarginCount = 1;
19621962
}
1963-
return Registry.call('plot', gd);
1963+
1964+
// Always allow at least one redraw and give each margin-push
1965+
// call 3 loops to converge. Of course, for most cases this way too many,
1966+
// but let's keep things on the safe side until we fix our
1967+
// auto-margin pipeline problems:
1968+
// https://github.com/plotly/plotly.js/issues/2704
1969+
var maxNumberOfRedraws = 3 * (1 + Object.keys(pushMarginIds).length);
1970+
1971+
if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) {
1972+
return Registry.call('plot', gd);
1973+
} else {
1974+
Lib.warn('Too many auto-margin redraws.');
1975+
}
19641976
}
19651977
};
19661978

0 commit comments

Comments
 (0)