@@ -3124,49 +3124,70 @@ axes.drawLabels = function(gd, ax, opts) {
3124
3124
} // TODO: hide mathjax?
3125
3125
} ) ;
3126
3126
3127
- if ( ax . _anchorAxis ) {
3128
- ax . _anchorAxis . _visibleLabelMin = visibleLabelMin ;
3129
- ax . _anchorAxis . _visibleLabelMax = visibleLabelMax ;
3127
+ for ( var subplot in fullLayout . _plots ) {
3128
+ var plotinfo = fullLayout . _plots [ subplot ] ;
3129
+ if ( ax . _id !== plotinfo . xaxis . _id && ax . _id !== plotinfo . yaxis . _id ) continue ;
3130
+ var anchorAx = isX ? plotinfo . yaxis : plotinfo . xaxis ;
3131
+ if ( anchorAx ) {
3132
+ anchorAx [ '_visibleLabelMin_' + ax . _id ] = visibleLabelMin ;
3133
+ anchorAx [ '_visibleLabelMax_' + ax . _id ] = visibleLabelMax ;
3134
+ }
3130
3135
}
3131
3136
} ;
3132
3137
3133
3138
ax . _hideCounterAxisInsideTickLabels = function ( partialOpts ) {
3134
- if ( insideTicklabelposition ( ax . _anchorAxis || { } ) ) {
3135
- ( partialOpts || [
3136
- ZERO_PATH ,
3137
- GRID_PATH ,
3138
- TICK_PATH ,
3139
- TICK_TEXT
3140
- ] ) . forEach ( function ( e ) {
3141
- var isPeriodLabel =
3142
- e . K === 'tick' &&
3143
- e . L === 'text' &&
3144
- ax . ticklabelmode === 'period' ;
3145
-
3146
- var sel ;
3147
- if ( e . K === ZERO_PATH . K ) sel = opts . plotinfo . zerolinelayer . selectAll ( '.' + ax . _id + 'zl' ) ;
3148
- else if ( e . K === GRID_PATH . K ) sel = opts . plotinfo . gridlayer . selectAll ( '.' + ax . _id ) ;
3149
- else sel = opts . plotinfo [ ax . _id . charAt ( 0 ) + 'axislayer' ] ;
3150
-
3151
- sel . each ( function ( ) {
3152
- var w = d3 . select ( this ) ;
3153
- if ( e . L ) w = w . selectAll ( e . L ) ;
3154
-
3155
- w . each ( function ( d ) {
3156
- var q = ax . l2p (
3157
- isPeriodLabel ? getPosX ( d ) : d . x
3158
- ) + ax . _offset ;
3159
-
3160
- var t = d3 . select ( this ) ;
3161
- if ( q < ax . _visibleLabelMax && q > ax . _visibleLabelMin ) {
3162
- t . style ( 'display' , 'none' ) ; // hidden
3163
- } else if ( e . K === 'tick' ) {
3164
- t . style ( 'display' , null ) ; // visible
3165
- }
3139
+ var isX = ax . _id . charAt ( 0 ) === 'x' ;
3140
+
3141
+ var anchoredAxes = [ ] ;
3142
+ for ( var subplot in fullLayout . _plots ) {
3143
+ var plotinfo = fullLayout . _plots [ subplot ] ;
3144
+ if ( ax . _id !== plotinfo . xaxis . _id && ax . _id !== plotinfo . yaxis . _id ) continue ;
3145
+ anchoredAxes . push ( isX ? plotinfo . yaxis : plotinfo . xaxis ) ;
3146
+ }
3147
+
3148
+ anchoredAxes . forEach ( function ( anchorAx , idx ) {
3149
+ if ( anchorAx && insideTicklabelposition ( anchorAx ) ) {
3150
+ ( partialOpts || [
3151
+ ZERO_PATH ,
3152
+ GRID_PATH ,
3153
+ TICK_PATH ,
3154
+ TICK_TEXT
3155
+ ] ) . forEach ( function ( e ) {
3156
+ var isPeriodLabel =
3157
+ e . K === 'tick' &&
3158
+ e . L === 'text' &&
3159
+ ax . ticklabelmode === 'period' ;
3160
+
3161
+ var mainPlotinfo = fullLayout . _plots [ ax . _mainSubplot ] ;
3162
+
3163
+ var sel ;
3164
+ if ( e . K === ZERO_PATH . K ) sel = mainPlotinfo . zerolinelayer . selectAll ( '.' + ax . _id + 'zl' ) ;
3165
+ else if ( e . K === GRID_PATH . K ) sel = mainPlotinfo . gridlayer . selectAll ( '.' + ax . _id ) ;
3166
+ else sel = mainPlotinfo [ ax . _id . charAt ( 0 ) + 'axislayer' ] ;
3167
+
3168
+ sel . each ( function ( ) {
3169
+ var w = d3 . select ( this ) ;
3170
+ if ( e . L ) w = w . selectAll ( e . L ) ;
3171
+
3172
+ w . each ( function ( d ) {
3173
+ var q = ax . l2p (
3174
+ isPeriodLabel ? getPosX ( d ) : d . x
3175
+ ) + ax . _offset ;
3176
+
3177
+ var t = d3 . select ( this ) ;
3178
+ if (
3179
+ q < ax [ '_visibleLabelMax_' + anchorAx . _id ] &&
3180
+ q > ax [ '_visibleLabelMin_' + anchorAx . _id ]
3181
+ ) {
3182
+ t . style ( 'display' , 'none' ) ; // hidden
3183
+ } else if ( e . K === 'tick' && ! idx ) {
3184
+ t . style ( 'display' , null ) ; // visible
3185
+ }
3186
+ } ) ;
3166
3187
} ) ;
3167
3188
} ) ;
3168
- } ) ;
3169
- }
3189
+ }
3190
+ } ) ;
3170
3191
} ;
3171
3192
3172
3193
// make sure all labels are correctly positioned at their base angle
0 commit comments