@@ -1494,7 +1494,7 @@ function getHoverLabelText(d, showCommonLabel, hovermode, fullLayout, t0, g) {
14941494// the other, though it hardly matters - there's just too much
14951495// information then.
14961496function hoverAvoidOverlaps ( hoverLabels , axKey , fullLayout ) {
1497- let crossAxKey = axKey === 'xa' ? 'ya' : 'xa' ;
1497+ var crossAxKey = axKey === 'xa' ? 'ya' : 'xa' ;
14981498 var nummoves = 0 ;
14991499 var axSign = 1 ;
15001500 var nLabels = hoverLabels . size ( ) ;
@@ -1505,29 +1505,30 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) {
15051505
15061506 hoverLabels . each ( function ( d ) {
15071507 var ax = d [ axKey ] ;
1508- let crossAx = d [ crossAxKey ] ;
1508+ var crossAx = d [ crossAxKey ] ;
15091509 var axIsX = ax . _id . charAt ( 0 ) === 'x' ;
15101510 var rng = ax . range ;
15111511
15121512 if ( k === 0 && rng && ( ( rng [ 0 ] > rng [ 1 ] ) !== axIsX ) ) {
15131513 axSign = - 1 ;
15141514 }
1515- let pmin , pmax ;
1516- if ( axIsX ) {
1517- if ( crossAx . side === 'left' ) {
1518- pmin = crossAx . _mainLinePosition ;
1519- pmax = fullLayout . width ;
1520- } else {
1521- pmin = 0 ;
1522- pmax = crossAx . _mainLinePosition ;
1523- }
1524- } else {
1525- if ( crossAx . side === 'top' ) {
1526- pmin = crossAx . _mainLinePosition ;
1527- pmax = fullLayout . height ;
1515+ var pmin = 0 ;
1516+ var pmax = ( axIsX ? fullLayout . width : fullLayout . height ) ;
1517+ if ( fullLayout . hovermode === 'x' || fullLayout . hovermode === 'y' ) {
1518+ if ( axIsX ) {
1519+ if ( crossAx . side === 'left' ) {
1520+ pmin = crossAx . _mainLinePosition ;
1521+ pmax = fullLayout . width ;
1522+ } else {
1523+ pmax = crossAx . _mainLinePosition ;
1524+ }
15281525 } else {
1529- pmin = 0 ;
1530- pmax = crossAx . _mainLinePosition ;
1526+ if ( crossAx . side === 'top' ) {
1527+ pmin = crossAx . _mainLinePosition ;
1528+ pmax = fullLayout . height ;
1529+ } else {
1530+ pmax = crossAx . _mainLinePosition ;
1531+ }
15311532 }
15321533 }
15331534
0 commit comments