@@ -54,7 +54,7 @@ const isTooltipValueValid = (
5454
5555export const MapTooltip = ( ) => {
5656 const [ hoverObjectType ] = useMapTooltip ( ) ;
57- const [ { interaction } ] = useInteraction ( ) ;
57+ const [ interaction ] = useInteraction ( ) ;
5858 const { identicalLayerComponentIds, areaLayer, symbolLayer } =
5959 useChartState ( ) as MapState ;
6060 const formatNumber = useFormatNumber ( ) ;
@@ -75,15 +75,15 @@ export const MapTooltip = () => {
7575 } ) ;
7676
7777 const areaTooltipState = useMemo ( ( ) => {
78- const obs = interaction . d ;
78+ const { observation } = interaction ;
7979
80- if ( areaLayer && obs ) {
80+ if ( areaLayer && observation ) {
8181 const { colors } = areaLayer ;
82- const value = colors . getValue ( obs ) ;
82+ const value = colors . getValue ( observation ) ;
8383
8484 if ( isTooltipValueValid ( value ) ) {
8585 const show = identicalLayerComponentIds || hoverObjectType === "area" ;
86- const color = rgbArrayToHex ( colors . getColor ( obs ) ) ;
86+ const color = rgbArrayToHex ( colors . getColor ( observation ) ) ;
8787 const textColor = getTooltipTextColor ( color ) ;
8888 const valueFormatter = ( d : number | null ) => {
8989 return formatNumberWithUnit (
@@ -98,7 +98,7 @@ export const MapTooltip = () => {
9898 value : typeof value === "number" ? valueFormatter ( value ) : value ,
9999 error :
100100 colors . type === "continuous"
101- ? colors . getFormattedError ?.( obs )
101+ ? colors . getFormattedError ?.( observation )
102102 : null ,
103103 componentId : colors . component . id ,
104104 label : colors . component . label ,
@@ -109,23 +109,23 @@ export const MapTooltip = () => {
109109 }
110110 } , [
111111 areaLayer ,
112- interaction . d ,
112+ interaction . observation ,
113113 identicalLayerComponentIds ,
114114 hoverObjectType ,
115115 formatNumber ,
116116 formatters ,
117117 ] ) ;
118118
119119 const symbolTooltipState = useMemo ( ( ) => {
120- const obs = interaction . d ;
120+ const { observation } = interaction ;
121121
122- if ( symbolLayer && obs ) {
122+ if ( symbolLayer && observation ) {
123123 const { colors } = symbolLayer ;
124- const value = symbolLayer . getValue ( obs ) ;
124+ const value = symbolLayer . getValue ( observation ) ;
125125
126126 if ( isTooltipValueValid ( value ) ) {
127127 const show = identicalLayerComponentIds || hoverObjectType === "symbol" ;
128- const color = rgbArrayToHex ( colors . getColor ( obs ) ) ;
128+ const color = rgbArrayToHex ( colors . getColor ( observation ) ) ;
129129 const textColor = getTooltipTextColor ( color ) ;
130130 const valueFormatter = ( d : number | null ) => {
131131 return formatNumberWithUnit (
@@ -151,15 +151,15 @@ export const MapTooltip = () => {
151151 preparedColors = {
152152 type : "categorical" as const ,
153153 component : colors . component ,
154- value : colors . getValue ( obs ) ,
154+ value : colors . getValue ( observation ) ,
155155 error : null ,
156156 color,
157157 textColor,
158158 sameAsValue : false ,
159159 } ;
160160 } else {
161- const rawValue = obs [ colors . component . id ] as number ;
162- const formattedError = colors . getFormattedError ?.( obs ) ;
161+ const rawValue = observation [ colors . component . id ] as number ;
162+ const formattedError = colors . getFormattedError ?.( observation ) ;
163163 preparedColors = {
164164 type : "continuous" ,
165165 component : colors . component ,
@@ -178,7 +178,7 @@ export const MapTooltip = () => {
178178
179179 return {
180180 value : valueFormatter ( value ) ,
181- error : formatSymbolError ?.( obs ) ,
181+ error : formatSymbolError ?.( observation ) ,
182182 measureDimension : symbolLayer . measureDimension ,
183183 show,
184184 color,
@@ -189,7 +189,7 @@ export const MapTooltip = () => {
189189 }
190190 } , [
191191 symbolLayer ,
192- interaction . d ,
192+ interaction . observation ,
193193 formatSymbolError ,
194194 identicalLayerComponentIds ,
195195 hoverObjectType ,
@@ -216,7 +216,7 @@ export const MapTooltip = () => {
216216
217217 return (
218218 < >
219- { interaction . mouse && interaction . d && (
219+ { interaction . mouse && interaction . observation && (
220220 < TooltipBox
221221 x = { interaction . mouse . x }
222222 y = { interaction . mouse . y - 20 }
@@ -230,8 +230,8 @@ export const MapTooltip = () => {
230230 sx = { { fontWeight : "bold" } }
231231 >
232232 { hoverObjectType === "area"
233- ? areaLayer ?. getLabel ( interaction . d )
234- : symbolLayer ?. getLabel ( interaction . d ) }
233+ ? areaLayer ?. getLabel ( interaction . observation )
234+ : symbolLayer ?. getLabel ( interaction . observation ) }
235235 </ Typography >
236236 < Box
237237 display = "grid"
0 commit comments