@@ -119,6 +119,11 @@ export default function ComponentMap({
119
119
fontFamily : 'Roboto' ,
120
120
} ;
121
121
122
+ const formatRenderTime = ( time ) => {
123
+ time = time . toFixed ( 3 ) ;
124
+ return `${ time } ms ` ;
125
+ }
126
+
122
127
123
128
// controls for the map
124
129
const LinkComponent = getLinkComponent ( { layout, linkType, orientation } ) ;
@@ -167,6 +172,8 @@ export default function ComponentMap({
167
172
const width = widthFunc ( node . data . name ) ;
168
173
const height = 25 ;
169
174
175
+
176
+
170
177
let top : number ;
171
178
let left : number ;
172
179
if ( layout === 'polar' ) {
@@ -185,11 +192,13 @@ export default function ComponentMap({
185
192
const handleMouseOver = ( event ) => {
186
193
( ) => dispatch ( onHover ( node . data . rtid ) ) ;
187
194
const coords = localPoint ( event . target . ownerSVGElement , event ) ;
188
- console . log ( "I'm node.data.rtid" , node . data . rtid ) ;
195
+ const tooltipObj = Object . assign ( { } , node . data ) ;
196
+ if ( typeof tooltipObj . state === 'object' ) tooltipObj . state = 'stateful' ;
197
+ console . log ( "tooltipObj" , tooltipObj )
189
198
showTooltip ( {
190
199
tooltipLeft : coords . x ,
191
200
tooltipTop : coords . y ,
192
- tooltipData : "test"
201
+ tooltipData : tooltipObj
193
202
} ) ;
194
203
}
195
204
@@ -263,7 +272,13 @@ export default function ComponentMap({
263
272
left = { tooltipLeft }
264
273
style = { tooltipStyles }
265
274
>
266
- Tooltip Data: < strong > { tooltipData } </ strong >
275
+ < div style = { { } } >
276
+ { ' ' }
277
+ < strong > { tooltipData . name } </ strong > { ' ' }
278
+ </ div >
279
+ < div > State: { tooltipData . state } </ div >
280
+ < div > Render time: { formatRenderTime ( tooltipData . componentData . actualDuration ) } </ div >
281
+
267
282
</ TooltipInPortal >
268
283
) }
269
284
</ div >
0 commit comments