@@ -2972,11 +2972,13 @@ function calcLabelLevelBbox(ax, cls, mainLinePositionShift) {
29722972 // (like in fixLabelOverlaps) instead and use Axes.getPxPosition
29732973 // together with the makeLabelFns outputs and `tickangle`
29742974 // to compute one bbox per (tick value x tick style)
2975- var bb = Drawing . bBox ( thisLabel . node ( ) . parentNode ) ;
2976- top = Math . min ( top , bb . top ) ;
2977- bottom = Math . max ( bottom , bb . bottom ) ;
2978- left = Math . min ( left , bb . left ) ;
2979- right = Math . max ( right , bb . right ) ;
2975+ if ( thisLabel . node ( ) . style . display !== 'none' ) {
2976+ var bb = Drawing . bBox ( thisLabel . node ( ) . parentNode ) ;
2977+ top = Math . min ( top , bb . top ) ;
2978+ bottom = Math . max ( bottom , bb . bottom ) ;
2979+ left = Math . min ( left , bb . left ) ;
2980+ right = Math . max ( right , bb . right ) ;
2981+ }
29802982 } ) ;
29812983 } else {
29822984 var dummyCalc = axes . makeLabelFns ( ax , mainLinePositionShift ) ;
@@ -3669,7 +3671,7 @@ axes.drawLabels = function(gd, ax, opts) {
36693671 'text-anchor' : anchor
36703672 } ) ;
36713673
3672- thisText . style ( 'opacity ' , 1 ) ; // visible
3674+ thisText . style ( 'display ' , null ) ; // visible
36733675
36743676 if ( ax . _adjustTickLabelsOverflow ) {
36753677 ax . _adjustTickLabelsOverflow ( ) ;
@@ -3727,9 +3729,9 @@ axes.drawLabels = function(gd, ax, opts) {
37273729
37283730 var t = thisLabel . select ( 'text' ) ;
37293731 if ( adjust ) {
3730- if ( hideOverflow ) t . style ( 'opacity ' , 0 ) ; // hidden
3731- } else {
3732- t . style ( 'opacity ' , 1 ) ; // visible
3732+ if ( hideOverflow ) t . style ( 'display ' , 'none' ) ; // hidden
3733+ } else if ( t . node ( ) . style . display !== 'none' ) {
3734+ t . style ( 'display ' , null ) ;
37333735
37343736 if ( side === 'bottom' || side === 'right' ) {
37353737 visibleLabelMin = Math . min ( visibleLabelMin , isX ? bb . top : bb . left ) ;
@@ -3806,7 +3808,7 @@ axes.drawLabels = function(gd, ax, opts) {
38063808 q > ax [ '_visibleLabelMin_' + anchorAx . _id ]
38073809 ) {
38083810 t . style ( 'display' , 'none' ) ; // hidden
3809- } else if ( e . K === 'tick' && ! idx ) {
3811+ } else if ( e . K === 'tick' && ! idx && t . node ( ) . style . display !== 'none' ) {
38103812 t . style ( 'display' , null ) ; // visible
38113813 }
38123814 } ) ;
0 commit comments