Skip to content

Commit 0d16fca

Browse files
authored
Merge branch 'staging' into extension
2 parents a598782 + abe8175 commit 0d16fca

File tree

4 files changed

+47
-27
lines changed

4 files changed

+47
-27
lines changed

src/app/components/Chart.jsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ class Chart extends Component {
4646

4747
maked3Tree() {
4848
this.removed3Tree();
49-
const margin = {
50-
top: 0,
51-
right: 60,
52-
bottom: 200,
53-
left: 120,
54-
};
55-
const width = 600 - margin.right - margin.left;
56-
const height = 700 - margin.top - margin.bottom;
49+
// const margin = {
50+
// top: 0,
51+
// right: 60,
52+
// bottom: 200,
53+
// left: 120,
54+
// };
55+
const width = 600; // - margin.right - margin.left;
56+
const height = 600; // 700 - margin.top - margin.bottom;
5757
const chartContainer = d3.select(this.chartRef.current)
5858
.append('svg') // chartContainer is now pointing to svg
5959
.attr('width', width)
@@ -202,7 +202,11 @@ class Chart extends Component {
202202
}
203203

204204
render() {
205-
return <div ref={this.chartRef} className="d3Container" />;
205+
return (
206+
<div className="history-d3-container">
207+
<div ref={this.chartRef} className="history-d3-div" />
208+
</div>
209+
);
206210
}
207211
}
208212

src/app/components/ErrorHandler.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ErrorHandler extends React.Component {
1212
}
1313

1414
render() {
15-
return this.state.errorOccurred ? <h1>An error occurred</h1> : this.props.children
15+
return this.state.errorOccurred ? <div margin="8px">Unexpected Error</div> : this.props.children
1616
}
1717
}
1818

src/app/components/PerfView.jsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
4242
const packFunc = useCallback(data => {
4343
return d3.pack()
4444
.size([width, height])
45+
// .radius(d => { return d.r; })
4546
.padding(3)(d3.hierarchy(data)
46-
.sum(d => { return d.componentData.actualDuration || 0; })
47-
.sort((a, b) => { return b.value - a.value; }));
47+
.sum(d => { return d.componentData.actualDuration || 0; })
48+
.sort((a, b) => { return b.value - a.value; }));
4849
}, [width, height]);
4950

5051
// If indexToDisplay changes, clear old tree nodes
@@ -55,12 +56,14 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
5556
}, [indexToDisplay, svgRef]);
5657

5758
useEffect(() => {
58-
59+
// console.log(`***** useEffect - MAIN -> snapshots[${indexToDisplay}]`, snapshots[indexToDisplay]);
60+
5961
// Error, no App-level component present
6062
if (snapshots[indexToDisplay].children.length < 1) return;
6163

6264
// Generate tree with our data
6365
const packedRoot = packFunc(snapshots[indexToDisplay]);
66+
console.log('PerfView -> packedRoot', packedRoot);
6467

6568
// Set initial focus to root node
6669
let curFocus = packedRoot;
@@ -80,13 +83,12 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
8083
.enter().append('circle')
8184
.attr('fill', d => (d.children ? colorScale(d.depth) : 'white'))
8285
.attr('pointer-events', d => (!d.children ? 'none' : null))
83-
.on('mouseover', () => d3.select(this).attr('stroke', '#000'))
84-
.on('mouseout', () => d3.select(this).attr('stroke', null))
86+
.on('mouseover', function () { d3.select(this).attr('stroke', '#000'); })
87+
.on('mouseout', function () { d3.select(this).attr('stroke', null); })
8588
.on('click', d => curFocus !== d && (zoomToNode(d), d3.event.stopPropagation()));
8689

8790
// Generate text labels. Set (only) root to visible initially
8891
const label = svg.append('g')
89-
// .style('fill', 'rgb(231, 231, 231)')
9092
.attr('class', 'perf-chart-labels')
9193
.selectAll('text')
9294
.data(packedRoot.descendants())
@@ -133,11 +135,16 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
133135
}
134136
}, [colorScale, packFunc, width, height, indexToDisplay, snapshots]);
135137

136-
return <svg className="perfContainer" ref={svgRef} />;
138+
return (
139+
<div className="perf-d3-container">
140+
<svg className="perf-d3-svg" ref={svgRef} />
141+
{/* <span>TEST</span> */}
142+
</div>
143+
);
137144
};
138145

139146
export default PerfView;
140147

141148

142149
// d3.quantize(d3.interpolateHcl('#60c96e', '#4d4193'), 10);
143-
// const colorScale = d3.scaleOrdinal(colorScheme);
150+
// const colorScale = d3.scaleOrdinal(colorScheme);

src/app/styles/components/d3graph.css

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,31 @@ div.tooltip {
9393
left: 0;
9494
}
9595

96-
.perfContainer {
97-
display: block;
98-
/* margin: 0 -14px;
99-
background-color: hsl(152,80%,80%); */
96+
.history-d3-container {
97+
display: flex;
98+
flex-direction: column;
99+
justify-content: space-between;
100+
height: calc(100% - 70px);
100101
/* border: 2px solid red; */
101102
}
102103

103-
.d3divContainer {
104-
/* display: flex;
104+
.perf-d3-container {
105+
display: flex;
105106
flex-direction: column;
106-
justify-content: space-between; */
107+
justify-content: space-between;
108+
height: calc(100% - 70px);
109+
/* border: 2px solid red; */
110+
}
111+
112+
.perf-d3-svg {
113+
display: block;
107114
}
108115

109116
.perf-chart-labels {
110-
font: 15px sans-serif;
111-
color: white;
117+
font: 12px sans-serif;
118+
/* color: white; */
119+
/* fill: rgb(231, 231, 231); */
120+
fill: #2a2f3a;
112121
pointer-events: none;
113122
text-anchor: middle;
114123
};

0 commit comments

Comments
 (0)