@@ -59,7 +59,6 @@ plotChoropleth.calcGeoJSON = function(trace, topojson) {
5959
6060plotChoropleth . plot = function ( geo , choroplethData , geoLayout ) {
6161 var framework = geo . framework ,
62- topojson = geo . topojson ,
6362 gChoropleth = framework . select ( 'g.choroplethlayer' ) ,
6463 gBaseLayer = framework . select ( 'g.baselayer' ) ,
6564 gBaseLayerOverChoropleth = framework . select ( 'g.baselayeroverchoropleth' ) ,
@@ -82,20 +81,20 @@ plotChoropleth.plot = function(geo, choroplethData, geoLayout) {
8281 . each ( function ( trace ) {
8382 if ( trace . visible !== true ) return ;
8483
85- var cdi = plotChoropleth . calcGeoJSON ( trace , topojson ) ,
84+ var cdi = plotChoropleth . calcGeoJSON ( trace , geo . topojson ) ,
8685 cleanHoverLabelsFunc = makeCleanHoverLabelsFunc ( geo , trace ) ;
8786
88- function handleMouseOver ( d ) {
87+ function handleMouseOver ( pt , ptIndex ) {
8988 if ( ! geo . showHover ) return ;
9089
91- var xy = geo . projection ( d . properties . ct ) ;
92- cleanHoverLabelsFunc ( d ) ;
90+ var xy = geo . projection ( pt . properties . ct ) ;
91+ cleanHoverLabelsFunc ( pt ) ;
9392
9493 Plotly . Fx . loneHover ( {
9594 x : xy [ 0 ] ,
9695 y : xy [ 1 ] ,
97- name : d . nameLabel ,
98- text : d . textLabel
96+ name : pt . nameLabel ,
97+ text : pt . textLabel
9998 } , {
10099 container : geo . hoverContainer . node ( )
101100 } ) ;
@@ -140,11 +139,11 @@ plotChoropleth.style = function(geo) {
140139 sclFunc = makeScaleFunction ( scl , zmin , zmax ) ;
141140
142141 s . selectAll ( 'path.choroplethlocation' )
143- . each ( function ( d ) {
142+ . each ( function ( pt ) {
144143 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 ) ;
148147 } ) ;
149148 } ) ;
150149} ;
@@ -153,9 +152,9 @@ function makeCleanHoverLabelsFunc(geo, trace) {
153152 var hoverinfo = trace . hoverinfo ;
154153
155154 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 ;
159158 } ;
160159 }
161160
@@ -174,20 +173,21 @@ function makeCleanHoverLabelsFunc(geo, trace) {
174173 return Plotly . Axes . tickText ( axis , axis . c2l ( val ) , 'hover' ) . text ;
175174 }
176175
177- return function cleanHoverLabelsFunc ( d ) {
176+ return function cleanHoverLabelsFunc ( pt ) {
178177 // put location id in name label container
179178 // if name isn't part of hoverinfo
180179 var thisText = [ ] ;
181180
182- if ( hasIdAsNameLabel ) d . nameLabel = d . id ;
181+ if ( hasIdAsNameLabel ) pt . nameLabel = pt . id ;
183182 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 ) ;
186185 }
187186
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>' ) ;
190191
191- d . textLabel = thisText . join ( '<br>' ) ;
192192 } ;
193193}
0 commit comments