@@ -59,7 +59,6 @@ plotChoropleth.calcGeoJSON = function(trace, topojson) {
59
59
60
60
plotChoropleth . plot = function ( geo , choroplethData , geoLayout ) {
61
61
var framework = geo . framework ,
62
- topojson = geo . topojson ,
63
62
gChoropleth = framework . select ( 'g.choroplethlayer' ) ,
64
63
gBaseLayer = framework . select ( 'g.baselayer' ) ,
65
64
gBaseLayerOverChoropleth = framework . select ( 'g.baselayeroverchoropleth' ) ,
@@ -82,20 +81,20 @@ plotChoropleth.plot = function(geo, choroplethData, geoLayout) {
82
81
. each ( function ( trace ) {
83
82
if ( trace . visible !== true ) return ;
84
83
85
- var cdi = plotChoropleth . calcGeoJSON ( trace , topojson ) ,
84
+ var cdi = plotChoropleth . calcGeoJSON ( trace , geo . topojson ) ,
86
85
cleanHoverLabelsFunc = makeCleanHoverLabelsFunc ( geo , trace ) ;
87
86
88
- function handleMouseOver ( d ) {
87
+ function handleMouseOver ( pt , ptIndex ) {
89
88
if ( ! geo . showHover ) return ;
90
89
91
- var xy = geo . projection ( d . properties . ct ) ;
92
- cleanHoverLabelsFunc ( d ) ;
90
+ var xy = geo . projection ( pt . properties . ct ) ;
91
+ cleanHoverLabelsFunc ( pt ) ;
93
92
94
93
Plotly . Fx . loneHover ( {
95
94
x : xy [ 0 ] ,
96
95
y : xy [ 1 ] ,
97
- name : d . nameLabel ,
98
- text : d . textLabel
96
+ name : pt . nameLabel ,
97
+ text : pt . textLabel
99
98
} , {
100
99
container : geo . hoverContainer . node ( )
101
100
} ) ;
@@ -140,11 +139,11 @@ plotChoropleth.style = function(geo) {
140
139
sclFunc = makeScaleFunction ( scl , zmin , zmax ) ;
141
140
142
141
s . selectAll ( 'path.choroplethlocation' )
143
- . each ( function ( d ) {
142
+ . each ( function ( pt ) {
144
143
d3 . select ( this )
145
- . attr ( 'fill' , function ( d ) { return sclFunc ( d . z ) ; } )
146
- . call ( Color . stroke , d . mlc || markerLine . color )
147
- . call ( Drawing . dashLine , '' , d . mlw || markerLine . width ) ;
144
+ . attr ( 'fill' , function ( pt ) { return sclFunc ( pt . z ) ; } )
145
+ . call ( Color . stroke , pt . mlc || markerLine . color )
146
+ . call ( Drawing . dashLine , '' , pt . mlw || markerLine . width ) ;
148
147
} ) ;
149
148
} ) ;
150
149
} ;
@@ -153,9 +152,9 @@ function makeCleanHoverLabelsFunc(geo, trace) {
153
152
var hoverinfo = trace . hoverinfo ;
154
153
155
154
if ( hoverinfo === 'none' ) {
156
- return function cleanHoverLabelsFunc ( d ) {
157
- delete d . nameLabel ;
158
- delete d . textLabel ;
155
+ return function cleanHoverLabelsFunc ( pt ) {
156
+ delete pt . nameLabel ;
157
+ delete pt . textLabel ;
159
158
} ;
160
159
}
161
160
@@ -174,20 +173,21 @@ function makeCleanHoverLabelsFunc(geo, trace) {
174
173
return Plotly . Axes . tickText ( axis , axis . c2l ( val ) , 'hover' ) . text ;
175
174
}
176
175
177
- return function cleanHoverLabelsFunc ( d ) {
176
+ return function cleanHoverLabelsFunc ( pt ) {
178
177
// put location id in name label container
179
178
// if name isn't part of hoverinfo
180
179
var thisText = [ ] ;
181
180
182
- if ( hasIdAsNameLabel ) d . nameLabel = d . id ;
181
+ if ( hasIdAsNameLabel ) pt . nameLabel = pt . id ;
183
182
else {
184
- if ( hasName ) d . nameLabel = trace . name ;
185
- if ( hasLocation ) thisText . push ( d . id ) ;
183
+ if ( hasName ) pt . nameLabel = trace . name ;
184
+ if ( hasLocation ) thisText . push ( pt . id ) ;
186
185
}
187
186
188
- if ( hasZ ) thisText . push ( formatter ( d . z ) ) ;
189
- if ( hasText ) thisText . push ( d . tx ) ;
187
+ if ( hasZ ) thisText . push ( formatter ( pt . z ) ) ;
188
+ if ( hasText ) thisText . push ( pt . tx ) ;
189
+
190
+ pt . textLabel = thisText . join ( '<br>' ) ;
190
191
191
- d . textLabel = thisText . join ( '<br>' ) ;
192
192
} ;
193
193
}
0 commit comments