@@ -172,12 +172,12 @@ exports.lsInner = function(gd) {
172172 . call ( Drawing . setTranslate , xa . _offset , ya . _offset )
173173 . call ( Drawing . setClipUrl , plotinfo . clipId ) ;
174174
175- var xIsFree = xa . anchor === 'free' ;
175+ var xIsFree = ! xa . _anchorAxis ;
176176 var showFreeX = xIsFree && ! freeFinished [ xa . _id ] ;
177177 var showBottom = shouldShowLine ( xa , ya , 'bottom' ) ;
178178 var showTop = shouldShowLine ( xa , ya , 'top' ) ;
179179
180- var yIsFree = ya . anchor === 'free' ;
180+ var yIsFree = ! ya . _anchorAxis ;
181181 var showFreeY = yIsFree && ! freeFinished [ ya . _id ] ;
182182 var showLeft = shouldShowLine ( ya , xa , 'left' ) ;
183183 var showRight = shouldShowLine ( ya , xa , 'right' ) ;
@@ -249,7 +249,7 @@ exports.lsInner = function(gd) {
249249 showTop ? xLinesYTop : undefined ,
250250 showFreeX ? xLinesYFree : undefined
251251 ] ;
252- if ( xa . anchor === ya . _id ) {
252+ if ( xa . _anchorAxis === ya ) {
253253 xa . _linepositions [ subplot ] [ 3 ] = xa . side === 'top' ?
254254 xLinesYTop : xLinesYBottom ;
255255 }
@@ -262,7 +262,7 @@ exports.lsInner = function(gd) {
262262 showRight ? yLinesXRight : undefined ,
263263 showFreeY ? yLinesXFree : undefined
264264 ] ;
265- if ( ya . anchor === xa . _id ) {
265+ if ( ya . _anchorAxis === xa ) {
266266 ya . _linepositions [ subplot ] [ 3 ] = ya . side === 'right' ?
267267 yLinesXRight : yLinesXLeft ;
268268 }
@@ -329,28 +329,24 @@ exports.lsInner = function(gd) {
329329} ;
330330
331331function shouldShowLine ( ax , counterAx , side ) {
332- return ( ax . anchor === counterAx . _id && ( ax . mirror || ax . side === side ) ) ||
332+ return ( ax . _anchorAxis === counterAx && ( ax . mirror || ax . side === side ) ) ||
333333 ax . mirror === 'all' || ax . mirror === 'allticks' ||
334334 ( ax . mirrors && ax . mirrors [ counterAx . _id + side ] ) ;
335335}
336336
337- function findMainAxis ( gd , ax ) {
338- return ax . overlaying ? Plotly . Axes . getFromId ( gd , ax . overlaying ) : ax ;
339- }
340-
341337function findCounterAxes ( gd , ax , axList ) {
342338 var counterAxes = [ ] ;
343- var anchorAx = Plotly . Axes . getFromId ( gd , ax . anchor ) ;
339+ var anchorAx = ax . _anchorAxis ;
344340 if ( anchorAx ) {
345- var counterMain = findMainAxis ( gd , anchorAx ) ;
341+ var counterMain = anchorAx . _mainAxis ;
346342 if ( counterAxes . indexOf ( counterMain ) === - 1 ) {
347343 counterAxes . push ( counterMain ) ;
348- }
349- for ( var i = 0 ; i < axList . length ; i ++ ) {
350- if ( axList [ i ] . overlaying === counterMain . _id &&
351- counterAxes . indexOf ( axList [ i ] ) === - 1
352- ) {
353- counterAxes . push ( axList [ i ] ) ;
344+ for ( var i = 0 ; i < axList . length ; i ++ ) {
345+ if ( axList [ i ] . overlaying === counterMain . _id &&
346+ counterAxes . indexOf ( axList [ i ] ) === - 1
347+ ) {
348+ counterAxes . push ( axList [ i ] ) ;
349+ }
354350 }
355351 }
356352 }
@@ -360,7 +356,8 @@ function findCounterAxes(gd, ax, axList) {
360356function findLineWidth ( gd , axes , side ) {
361357 for ( var i = 0 ; i < axes . length ; i ++ ) {
362358 var ax = axes [ i ] ;
363- if ( ax . anchor !== 'free' && shouldShowLine ( ax , { _id : ax . anchor } , side ) ) {
359+ var anchorAx = ax . _anchorAxis ;
360+ if ( anchorAx && shouldShowLine ( ax , anchorAx , side ) ) {
364361 return Drawing . crispRound ( gd , ax . linewidth ) ;
365362 }
366363 }
@@ -374,7 +371,7 @@ function findCounterAxisLineWidth(gd, ax, subplotCounterLineWidth,
374371
375372 // find all counteraxes for this one, then of these, find the
376373 // first one that has a visible line on this side
377- var mainAxis = findMainAxis ( gd , ax ) ;
374+ var mainAxis = ax . _mainAxis ;
378375 var counterAxes = findCounterAxes ( gd , mainAxis , axList ) ;
379376
380377 var lineWidth = findLineWidth ( gd , counterAxes , side ) ;
0 commit comments