Skip to content

Commit e0050b8

Browse files
Merge pull request #14 from oslabs-beta/staging
Added visx legend component and stylized visx performance chart
2 parents 1d373e1 + 84ca60d commit e0050b8

File tree

9 files changed

+668
-95
lines changed

9 files changed

+668
-95
lines changed

package-lock.json

Lines changed: 137 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,16 @@
106106
"webpack-cli": "^3.3.12"
107107
},
108108
"dependencies": {
109-
"@visx/glyph": "^1.0.0",
110-
"@visx/gradient": "^1.0.0",
111-
"@visx/group": "^1.0.0",
112-
"@visx/hierarchy": "^1.0.0",
109+
"@visx/axis": "^1.0.0",
110+
"@visx/grid": "^1.0.0",
113111
"@visx/legend": "^1.0.0",
114112
"@visx/responsive": "^1.0.0",
115113
"@visx/scale": "^1.0.0",
114+
"@visx/tooltip": "^1.0.0",
115+
"@visx/gradient": "^1.0.0",
116+
"@visx/group": "^1.0.0",
117+
"@visx/hierarchy": "^1.0.0",
118+
"@visx/glyph": "^1.0.0",
116119
"@visx/shape": "^1.0.0",
117120
"acorn": "^7.3.1",
118121
"acorn-jsx": "^5.2.0",

src/app/components/History.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ const filterHooks = (data: any[]) => {
3434
* @method maked3Tree :Creates a new D3 Tree
3535
*/
3636

37-
export default function History(props) {
37+
function History(props) {
3838
let { hierarchy } = props;
39-
console.log('hierarchy is', hierarchy);
4039
let root = JSON.parse(JSON.stringify(hierarchy));
4140
let isRecoil = false;
4241
let HistoryRef = React.createRef(root); //React.createRef(root);
@@ -251,9 +250,12 @@ export default function History(props) {
251250
return [(y = +y) * Math.cos((x -= Math.PI / 2)), y * Math.sin(x)];
252251
}
253252
};
253+
254254
return (
255255
<>
256256
<div ref={HistoryRef} className="history-d3-div" id="historyContainer" />
257257
</>
258258
);
259259
}
260+
261+
export default History;

src/app/components/PerfView.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,30 @@ interface PerfViewProps {
3131
}
3232

3333
const PerfView = (props: PerfViewProps) => {
34+
35+
// ------------- CIRCLES ----------------------
3436
const { viewIndex, width, height, setNoRenderData } = props;
3537
let { snapshots } = props;
3638
const adjustedSize = Math.min(width, height);
3739
const svgRef = useRef(null);
40+
41+
console.log(snapshots)
42+
43+
// const performances = []
44+
// snapshot = {
45+
// component1: 10,
46+
// component2: 24,
47+
// component3: 35,
48+
// others: 32
49+
// }
50+
51+
const performances = snapshots.reduce((acc,cur)=>{
52+
const snapshot = {};
53+
while (snapshot.keys.lenght
54+
}, []
55+
// iterate snapshots array
56+
// if i.children exists
57+
//
3858

3959
let indexToDisplay: number | null = null;
4060
if (viewIndex < 0) indexToDisplay = snapshots.length - 1;
@@ -85,7 +105,7 @@ const PerfView = (props: PerfViewProps) => {
85105
}, [indexToDisplay, svgRef]);
86106

87107
useEffect(() => {
88-
// Error, no App-level component present
108+
// Error, no App-level component presentnpm r
89109
if (snapshots[indexToDisplay].children.length < 1) return;
90110

91111
// Generate tree with our data
@@ -228,6 +248,9 @@ const PerfView = (props: PerfViewProps) => {
228248
handleNoRenderData,
229249
]);
230250

251+
// ------------- CIRCLES ----------------------
252+
253+
231254
return (
232255
<div className="perf-d3-container">
233256
<svg className="perf-d3-svg" ref={svgRef} />

0 commit comments

Comments
 (0)