6
6
* LICENSE file in the root directory of this source tree.
7
7
*/
8
8
9
-
10
9
'use strict' ;
11
10
12
11
var Fx = require ( '../../components/fx' ) ;
@@ -64,17 +63,19 @@ module.exports = function hoverPoints(pointData, xval, yval) {
64
63
pointData . lon = lonlat [ 0 ] ;
65
64
pointData . lat = lonlat [ 1 ] ;
66
65
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
+
67
70
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 ) ;
69
72
pointData . hovertemplate = trace . hovertemplate ;
70
73
71
74
return [ pointData ] ;
72
75
} ;
73
76
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 ;
78
79
79
80
var hoverinfo = pt . hi || trace . hoverinfo ;
80
81
@@ -88,18 +89,16 @@ function getExtraText(trace, pt, axis, labels) {
88
89
var hasText = ( parts . indexOf ( 'text' ) !== - 1 ) ;
89
90
var text = [ ] ;
90
91
91
- function format ( val ) {
92
- return Axes . tickText ( axis , axis . c2l ( val ) , 'hover' ) . text + '\u00B0' ;
93
- }
92
+ function format ( val ) { return val + '\u00B0' ; }
94
93
95
94
if ( hasLocation ) {
96
95
text . push ( pt . loc ) ;
97
96
} else if ( hasLon && hasLat ) {
98
- text . push ( '(' + format ( pt . lonlat [ 0 ] ) + ', ' + format ( pt . lonlat [ 1 ] ) + ')' ) ;
97
+ text . push ( '(' + format ( pointData . lonLabel ) + ', ' + format ( pointData . latLabel ) + ')' ) ;
99
98
} else if ( hasLon ) {
100
- text . push ( labels . lon + format ( pt . lonlat [ 0 ] ) ) ;
99
+ text . push ( labels . lon + format ( pointData . lonLabel ) ) ;
101
100
} else if ( hasLat ) {
102
- text . push ( labels . lat + format ( pt . lonlat [ 1 ] ) ) ;
101
+ text . push ( labels . lat + format ( pointData . latLabel ) ) ;
103
102
}
104
103
105
104
if ( hasText ) {
0 commit comments