@@ -172,12 +172,12 @@ exports.lsInner = function(gd) {
172
172
. call ( Drawing . setTranslate , xa . _offset , ya . _offset )
173
173
. call ( Drawing . setClipUrl , plotinfo . clipId ) ;
174
174
175
- var xIsFree = xa . anchor === 'free' ;
175
+ var xIsFree = ! xa . _anchorAxis ;
176
176
var showFreeX = xIsFree && ! freeFinished [ xa . _id ] ;
177
177
var showBottom = shouldShowLine ( xa , ya , 'bottom' ) ;
178
178
var showTop = shouldShowLine ( xa , ya , 'top' ) ;
179
179
180
- var yIsFree = ya . anchor === 'free' ;
180
+ var yIsFree = ! ya . _anchorAxis ;
181
181
var showFreeY = yIsFree && ! freeFinished [ ya . _id ] ;
182
182
var showLeft = shouldShowLine ( ya , xa , 'left' ) ;
183
183
var showRight = shouldShowLine ( ya , xa , 'right' ) ;
@@ -249,7 +249,7 @@ exports.lsInner = function(gd) {
249
249
showTop ? xLinesYTop : undefined ,
250
250
showFreeX ? xLinesYFree : undefined
251
251
] ;
252
- if ( xa . anchor === ya . _id ) {
252
+ if ( xa . _anchorAxis === ya ) {
253
253
xa . _linepositions [ subplot ] [ 3 ] = xa . side === 'top' ?
254
254
xLinesYTop : xLinesYBottom ;
255
255
}
@@ -262,7 +262,7 @@ exports.lsInner = function(gd) {
262
262
showRight ? yLinesXRight : undefined ,
263
263
showFreeY ? yLinesXFree : undefined
264
264
] ;
265
- if ( ya . anchor === xa . _id ) {
265
+ if ( ya . _anchorAxis === xa ) {
266
266
ya . _linepositions [ subplot ] [ 3 ] = ya . side === 'right' ?
267
267
yLinesXRight : yLinesXLeft ;
268
268
}
@@ -329,28 +329,24 @@ exports.lsInner = function(gd) {
329
329
} ;
330
330
331
331
function 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 ) ) ||
333
333
ax . mirror === 'all' || ax . mirror === 'allticks' ||
334
334
( ax . mirrors && ax . mirrors [ counterAx . _id + side ] ) ;
335
335
}
336
336
337
- function findMainAxis ( gd , ax ) {
338
- return ax . overlaying ? Plotly . Axes . getFromId ( gd , ax . overlaying ) : ax ;
339
- }
340
-
341
337
function findCounterAxes ( gd , ax , axList ) {
342
338
var counterAxes = [ ] ;
343
- var anchorAx = Plotly . Axes . getFromId ( gd , ax . anchor ) ;
339
+ var anchorAx = ax . _anchorAxis ;
344
340
if ( anchorAx ) {
345
- var counterMain = findMainAxis ( gd , anchorAx ) ;
341
+ var counterMain = anchorAx . _mainAxis ;
346
342
if ( counterAxes . indexOf ( counterMain ) === - 1 ) {
347
343
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
+ }
354
350
}
355
351
}
356
352
}
@@ -360,7 +356,8 @@ function findCounterAxes(gd, ax, axList) {
360
356
function findLineWidth ( gd , axes , side ) {
361
357
for ( var i = 0 ; i < axes . length ; i ++ ) {
362
358
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 ) ) {
364
361
return Drawing . crispRound ( gd , ax . linewidth ) ;
365
362
}
366
363
}
@@ -374,7 +371,7 @@ function findCounterAxisLineWidth(gd, ax, subplotCounterLineWidth,
374
371
375
372
// find all counteraxes for this one, then of these, find the
376
373
// first one that has a visible line on this side
377
- var mainAxis = findMainAxis ( gd , ax ) ;
374
+ var mainAxis = ax . _mainAxis ;
378
375
var counterAxes = findCounterAxes ( gd , mainAxis , axList ) ;
379
376
380
377
var lineWidth = findLineWidth ( gd , counterAxes , side ) ;
0 commit comments