Skip to content

Commit 742ec76

Browse files
committed
non working
1 parent 85ccb13 commit 742ec76

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/app/components/PerfView.jsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ import React, { useEffect, useRef } from 'react';
1111
import * as d3 from 'd3';
1212
import { addNewSnapshots } from '../actions/actions';
1313

14-
const chartData = {
15-
name: 'App',
16-
actualDuration: 35000,
17-
value: 17010,
18-
children: [
19-
{ name: 'DisplayPanel', actualDuration: 35000, value: 17010 },
20-
{ name: 'AltDisplay', actualDuration: 35000, value: 5842 },
21-
{ name: 'MarketSContainer', actualDuration: 35000, value: 1041 },
22-
{ name: 'MainSlider', actualDuration: 35000, value: 5176 },
23-
],
24-
};
14+
// const chartData = {
15+
// name: 'App',
16+
// actualDuration: 35000,
17+
// value: 17010,
18+
// children: [
19+
// { name: 'DisplayPanel', actualDuration: 35000, value: 17010 },
20+
// { name: 'AltDisplay', actualDuration: 35000, value: 5842 },
21+
// { name: 'MarketSContainer', actualDuration: 35000, value: 1041 },
22+
// { name: 'MainSlider', actualDuration: 35000, value: 5176 },
23+
// ],
24+
// };
2525

2626
const PerfView = ({
2727
width = 200,
2828
height = 200,
29-
// snapshots
29+
snapshots
3030
}) => {
3131
// const chartData = snapshots;
32-
// const chartData = snapshots[snapshots.length - 1].children[0];
33-
// console.log("snapshots", snapshots);
32+
console.log("snapshots", snapshots);
33+
const chartData = snapshots[snapshots.length - 1].children[0];
3434
console.log("chartData", chartData);
3535

3636
const svgRef = useRef(null);
@@ -45,8 +45,8 @@ const PerfView = ({
4545
const packFunc = data => d3.pack()
4646
.size([width, height])
4747
.padding(3)(d3.hierarchy(data)
48-
.sum(d => d.actualDuration)
49-
.sort((a, b) => b.actualDuration - a.actualDuration));
48+
.sum(d => d.componentData.actualDuration)
49+
.sort((a, b) => b.componentData.actualDuration - a.componentData.actualDuration));
5050

5151
useEffect(() => {
5252
const packedRoot = packFunc(chartData);
@@ -80,7 +80,7 @@ const PerfView = ({
8080
.append('text')
8181
.style('fill-opacity', d => (d.parent === packedRoot ? 1 : 0))
8282
.style('display', d => (d.parent === packedRoot ? 'inline' : 'none'))
83-
.text(d => `${d.name}: ${Number.parseFloat(d.actualDuration).toFixed(2)}ms`);
83+
.text(d => `${d.data.name}: ${Number.parseFloat(d.data.actualDuration).toFixed(2)}ms`);
8484

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

src/app/components/StateRoute.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const StateRoute = ({
4545

4646
const renderPerfView = () => {
4747
if (hierarchy) {
48-
return <PerfView width={600} height={600} snapshots={snapshot} />; // ref={windowRef}
48+
return <PerfView width={600} height={600} snapshots={snapshots} />; // ref={windowRef}
4949
}
5050
return <div className="noState">{NO_STATE_MSG}</div>;
5151
};

0 commit comments

Comments
 (0)