66* LICENSE file in the root directory of this source tree.
77*/
88
9-
109'use strict' ;
1110
1211var Fx = require ( '../../components/fx' ) ;
@@ -64,17 +63,19 @@ module.exports = function hoverPoints(pointData, xval, yval) {
6463 pointData . lon = lonlat [ 0 ] ;
6564 pointData . lat = lonlat [ 1 ] ;
6665
66+ var ax = geo . mockAxis ;
67+ pointData . lonLabel = Axes . tickText ( ax , ax . c2l ( pointData . lon ) , 'hover' ) . text ;
68+ pointData . latLabel = Axes . tickText ( ax , ax . c2l ( pointData . lat ) , 'hover' ) . text ;
69+
6770 pointData . color = getTraceColor ( trace , di ) ;
68- pointData . extraText = getExtraText ( trace , di , geo . mockAxis , cd [ 0 ] . t . labels ) ;
71+ pointData . extraText = getExtraText ( trace , di , pointData , cd [ 0 ] . t . labels ) ;
6972 pointData . hovertemplate = trace . hovertemplate ;
7073
7174 return [ pointData ] ;
7275} ;
7376
74- function getExtraText ( trace , pt , axis , labels ) {
75- if ( trace . hovertemplate ) {
76- return ;
77- }
77+ function getExtraText ( trace , pt , pointData , labels ) {
78+ if ( trace . hovertemplate ) return ;
7879
7980 var hoverinfo = pt . hi || trace . hoverinfo ;
8081
@@ -88,18 +89,16 @@ function getExtraText(trace, pt, axis, labels) {
8889 var hasText = ( parts . indexOf ( 'text' ) !== - 1 ) ;
8990 var text = [ ] ;
9091
91- function format ( val ) {
92- return Axes . tickText ( axis , axis . c2l ( val ) , 'hover' ) . text + '\u00B0' ;
93- }
92+ function format ( val ) { return val + '\u00B0' ; }
9493
9594 if ( hasLocation ) {
9695 text . push ( pt . loc ) ;
9796 } else if ( hasLon && hasLat ) {
98- text . push ( '(' + format ( pt . lonlat [ 0 ] ) + ', ' + format ( pt . lonlat [ 1 ] ) + ')' ) ;
97+ text . push ( '(' + format ( pointData . lonLabel ) + ', ' + format ( pointData . latLabel ) + ')' ) ;
9998 } else if ( hasLon ) {
100- text . push ( labels . lon + format ( pt . lonlat [ 0 ] ) ) ;
99+ text . push ( labels . lon + format ( pointData . lonLabel ) ) ;
101100 } else if ( hasLat ) {
102- text . push ( labels . lat + format ( pt . lonlat [ 1 ] ) ) ;
101+ text . push ( labels . lat + format ( pointData . latLabel ) ) ;
103102 }
104103
105104 if ( hasText ) {
0 commit comments