@@ -2251,7 +2251,7 @@ axes.draw = function(gd, arg, opts) {
22512251 var fullAxList = axes . list ( gd ) ;
22522252 // Get the list of the overlaying axis for all 'shift' axes
22532253 var overlayingShiftedAx = fullAxList . filter ( function ( ax ) {
2254- return ax . shift === true ;
2254+ return ax . autoshift === true ;
22552255 } ) . map ( function ( ax ) {
22562256 return ax . overlaying ;
22572257 } ) ;
@@ -2272,7 +2272,7 @@ axes.draw = function(gd, arg, opts) {
22722272 var axDone = axes . drawOne ( gd , ax , opts ) ;
22732273
22742274 if ( ax . _shiftPusher ) {
2275- incrementShift ( ax , ax . _fullDepth , axShifts ) ;
2275+ incrementShift ( ax , ax . _fullDepth , axShifts , true ) ;
22762276 }
22772277 ax . _r = ax . range . slice ( ) ;
22782278 ax . _rl = Lib . simpleMap ( ax . _r , ax . r2l ) ;
@@ -2328,16 +2328,18 @@ axes.drawOne = function(gd, ax, opts) {
23282328 // this happens when updating matched group with 'missing' axes
23292329 if ( ! mainPlotinfo ) return ;
23302330
2331- ax . _shiftPusher = ax . shift === true ||
2331+ ax . _shiftPusher = ax . autoshift === true ||
23322332 overlayingShiftedAx . indexOf ( ax . _id ) !== - 1 ||
23332333 overlayingShiftedAx . indexOf ( ax . overlaying ) !== - 1 ;
23342334 // An axis is also shifted by 1/2 of its own linewidth and inside tick length if applicable
2335+ // as well as its manually specified `shift` val if we're in the context of `autoshift`
23352336 if ( ax . _shiftPusher & ax . anchor === 'free' ) {
23362337 var selfPush = ( ax . linewidth / 2 || 0 ) ;
23372338 if ( ax . ticks === 'inside' ) {
23382339 selfPush += ax . ticklen ;
23392340 }
2340- incrementShift ( ax , selfPush , axShifts ) ;
2341+ incrementShift ( ax , selfPush , axShifts , true ) ;
2342+ incrementShift ( ax , ( ax . shift || 0 ) , axShifts , false ) ;
23412343 }
23422344
23432345 // Somewhat inelegant way of making sure that the shift value is only updated when the
@@ -2608,7 +2610,6 @@ axes.drawOne = function(gd, ax, opts) {
26082610
26092611 var axDepth = 0 ;
26102612 var titleDepth = 0 ;
2611- var multAxisPad = 3 ; // TODO: Expose as a param to allow user to specify padding between axes
26122613 if ( ax . _shiftPusher ) {
26132614 axDepth = Math . max (
26142615 outsideTickLen ,
@@ -2621,7 +2622,7 @@ axes.drawOne = function(gd, ax, opts) {
26212622 }
26222623 }
26232624
2624- ax . _fullDepth = Math . max ( axDepth , titleDepth ) + multAxisPad ;
2625+ ax . _fullDepth = Math . max ( axDepth , titleDepth ) ;
26252626 }
26262627
26272628 if ( ax . automargin ) {
@@ -4274,10 +4275,15 @@ function hideCounterAxisInsideTickLabels(ax, opts) {
42744275 }
42754276}
42764277
4277- function incrementShift ( ax , shiftVal , axShifts ) {
4278+ function incrementShift ( ax , shiftVal , axShifts , normalize ) {
42784279 // Need to set 'overlay' for anchored axis
42794280 var overlay = ( ( ax . anchor !== 'free' ) && ( ( ax . overlaying === undefined ) || ( ax . overlaying === false ) ) ) ? ax . _id : ax . overlaying ;
4280- var shiftValAdj = ax . side === 'right' ? shiftVal : - shiftVal ;
4281+ var shiftValAdj ;
4282+ if ( normalize ) {
4283+ shiftValAdj = ax . side === 'right' ? shiftVal : - shiftVal ;
4284+ } else {
4285+ shiftValAdj = shiftVal ;
4286+ }
42814287 if ( ! ( overlay in axShifts ) ) {
42824288 axShifts [ overlay ] = { } ;
42834289 }
@@ -4288,7 +4294,7 @@ function incrementShift(ax, shiftVal, axShifts) {
42884294}
42894295
42904296function setShiftVal ( ax , axShifts ) {
4291- return ax . shift === true ?
4297+ return ax . autoshift === true ?
42924298 axShifts [ ax . overlaying ] [ ax . side ] :
42934299 ( ax . shift || 0 ) ;
42944300}
0 commit comments