Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit e03c7da

Browse files
author
Brian Vaughn
committed
Show unrounded durations on hover for chart tooltips
1 parent 5cf07b2 commit e03c7da

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

plugins/Profiler/views/ChartNode.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,32 @@ type Props = {|
2424
onDoubleClick?: Function,
2525
placeLabelAboveNode?: boolean,
2626
theme: Theme,
27+
title: string,
2728
width: number,
2829
x: number,
2930
y: number,
3031
|};
3132

3233
const minWidthToDisplay = 35;
3334

34-
const ChartNode = ({ color, height, isDimmed = false, label, onClick, onDoubleClick, theme, width, x, y }: Props) => (
35+
const ChartNode = ({
36+
color,
37+
height,
38+
isDimmed = false,
39+
label,
40+
onClick,
41+
onDoubleClick,
42+
theme,
43+
title,
44+
width,
45+
x,
46+
y,
47+
}: Props) => (
3548
<g
3649
style={ChartAnimatedNode}
3750
transform={`translate(${x},${y})`}
3851
>
39-
<title>{label}</title>
52+
<title>{title}</title>
4053
<rect
4154
width={width}
4255
height={height}

plugins/Profiler/views/FiberRenderDurations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class ListItem extends PureComponent<any, void> {
171171
onClick={() => selectSnapshot(node.parentSnapshot)}
172172
onDoubleClick={stopInspecting}
173173
theme={theme}
174+
title={`${node.value}ms`}
174175
width={width}
175176
x={left}
176177
y={height - safeHeight}

plugins/Profiler/views/SnapshotFlamegraph.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ class ListItem extends PureComponent<any, void> {
270270
onClick={this.handleClick.bind(this, id, name)}
271271
onDoubleClick={this.handleDoubleClick.bind(this, id, name)}
272272
theme={itemData.theme}
273+
title={didRender ? `${name} (${actualDuration}ms)` : name}
273274
width={nodeWidth}
274275
x={nodeX - focusedNodeX}
275276
y={top}

plugins/Profiler/views/SnapshotRanked.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Node = {|
2525
id: any,
2626
label: string,
2727
name: string,
28+
title: string,
2829
value: number,
2930
|};
3031

@@ -199,6 +200,7 @@ class ListItem extends PureComponent<any, void> {
199200
onClick={this.handleClick}
200201
onDoubleClick={this.handleDoubleClick}
201202
theme={data.theme}
203+
title={node.title}
202204
width={Math.max(minBarWidth, scaleX(node.value))}
203205
x={0}
204206
y={top}
@@ -258,6 +260,7 @@ const convertSnapshotToChartData = (snapshot: Snapshot, showNativeNodes: boolean
258260
id: node.id,
259261
label: `${name} (${node.actualDuration.toFixed(2)}ms)`,
260262
name,
263+
title: `${name} (${node.actualDuration}ms)`,
261264
value: node.actualDuration,
262265
};
263266
})

0 commit comments

Comments
 (0)