Skip to content

Commit 88da53e

Browse files
committed
added duration text output to d3
1 parent 83d69ad commit 88da53e

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

dev-reactime/linkFiber.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ module.exports = (snap, mode) => {
9292
function createTree(currentFiber, tree = new Tree('root')) {
9393
// Base case: child or sibling pointed to null
9494
if (!currentFiber) return tree;
95+
console.log("createTree -> currentFiber", currentFiber);
9596

9697
// These have the newest state. We update state and then
9798
// called updateSnapshotTree()

src/app/components/PerfView.jsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@ const chartData = {
4141
],
4242
};
4343

44-
// const chartData = {
45-
// name: 'App', index: 1, val3: 50000, timeData: { actualDuration: 35000 }, children: [
46-
// { name: 'DisplayPanel', index: 2, timeData: { actualDuration: 35000 }, val3: 17010 },
47-
// { name: 'Button Panel', index: 3, timeData: { actualDuration: 35000 }, val3: 50000, children: [
48-
// { name: 'Button', timeData: { actualDuration: 35000 }, val3: 10000 },
49-
// { name: 'Button', timeData: { actualDuration: 35000 }, val3: 2047 },
50-
// ],
51-
// },
52-
// { name: 'MainSlider', timeData: { actualDuration: 35000 }, val3: 5176 },
53-
// ],
54-
// };
55-
56-
5744
const PerfView = ({ width = 200, height = 200, chartData }) => {
5845

5946
console.log("PerfView -> chartData", chartData)
@@ -100,7 +87,7 @@ const PerfView = ({ width = 200, height = 200, chartData }) => {
10087
.on('click', d => focus !== d && (zoom(d), d3.event.stopPropagation()));
10188

10289
const label = svg.append('g')
103-
.style('font', '10px sans-serif')
90+
.style('font', '11px sans-serif')
10491
.attr('pointer-events', 'none')
10592
.attr('text-anchor', 'middle')
10693
.selectAll('text')
@@ -110,7 +97,7 @@ const PerfView = ({ width = 200, height = 200, chartData }) => {
11097
.append('text')
11198
.style('fill-opacity', d => (d.parent === packedRoot ? 1 : 0))
11299
.style('display', d => (d.parent === packedRoot ? 'inline' : 'none'))
113-
.text(d => d.data.name);
100+
.text(d => `${d.data.name}: ${Number.parseFloat(d.data.actualDuration).toFixed(2)}ms`);
114101

115102
console.log('PerfView -> node', node);
116103
zoomTo([packedRoot.x, packedRoot.y, packedRoot.r * 2]);

0 commit comments

Comments
 (0)