Skip to content

Commit

Permalink
Add (large) upper bound on the number of redraw calls
Browse files Browse the repository at this point in the history
... that Plots.doAutoMargin can trigger.
  • Loading branch information
etpinard committed Sep 24, 2019
1 parent 7a8eedf commit 631014a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/plots/plots.js
Expand Up @@ -1960,7 +1960,19 @@ plots.doAutoMargin = function(gd) {
} else {
fullLayout._redrawFromAutoMarginCount = 1;
}
return Registry.call('plot', gd);

// Always allow at least one redraw and give each margin-push
// call 3 loops to converge. Of course, for most cases this way too many,
// but let's keep things on the safe side until we fix our
// auto-margin pipeline problems:
// https://github.com/plotly/plotly.js/issues/2704
var maxNumberOfRedraws = 3 * (1 + Object.keys(pushMarginIds).length);

if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) {
return Registry.call('plot', gd);
} else {
Lib.warn('Too many auto-margin redraws.');
}
}
};

Expand Down

0 comments on commit 631014a

Please sign in to comment.