File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2011,7 +2011,7 @@ plots.doAutoMargin = function(gd) {
2011
2011
var oldMargins = Lib . extendFlat ( { } , gs ) ;
2012
2012
2013
2013
// only account for reservedMargins if autoexpand
2014
- if ( margin . autoexpand === true ) {
2014
+ if ( margin . autoexpand !== false ) {
2015
2015
var margins = gd . _fullLayout . _reservedMargin ;
2016
2016
for ( var key in margins ) {
2017
2017
for ( var side in margins [ key ] ) {
@@ -2048,6 +2048,20 @@ plots.doAutoMargin = function(gd) {
2048
2048
// now cycle through all the combinations of l and r
2049
2049
// (and t and b) to find the required margins
2050
2050
2051
+ // make sure that the reservedMargin is the minimum needed
2052
+ for ( var s in reservedMargins ) {
2053
+ var autoMarginPush = 0 ;
2054
+ for ( var m in pushMargin ) {
2055
+ if ( m !== 'base' ) {
2056
+ if ( isNumeric ( pushMargin [ m ] [ s ] . size ) ) {
2057
+ autoMarginPush += pushMargin [ m ] [ s ] . size ;
2058
+ }
2059
+ }
2060
+ }
2061
+ var extraMargin = Math . max ( 0 , ( margin [ s ] - autoMarginPush ) ) ;
2062
+ reservedMargins [ s ] = Math . max ( 0 , reservedMargins [ s ] - extraMargin ) ;
2063
+ }
2064
+
2051
2065
for ( var k1 in pushMargin ) {
2052
2066
var pushleft = pushMargin [ k1 ] . l || { } ;
2053
2067
var pushbottom = pushMargin [ k1 ] . b || { } ;
You can’t perform that action at this time.
0 commit comments