Skip to content

Commit 4040ddc

Browse files
committed
change chart to blue w white leaves
1 parent 198069d commit 4040ddc

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

src/app/components/PerfView.jsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import React, { useEffect, useState, useRef, useCallback } from 'react';
2020
import * as d3 from 'd3';
21+
import { schemeSet1 as colorScheme } from 'd3';
22+
2123
// import { addNewSnapshots } from '../actions/actions';
2224

2325

@@ -33,8 +35,15 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
3335
// Set up color scaling function
3436
const colorScale = d3.scaleLinear()
3537
.domain([0, 7])
36-
.range(['hsl(152,80%,80%)', 'hsl(228,30%,40%)'])
38+
.range(['hsl(200,60%,60%)', 'hsl(255,30%,30%)'])
3739
.interpolate(d3.interpolateHcl);
40+
// const colorScale = d3.scaleLinear()
41+
// .domain([0, 7])
42+
// .range(['#60c96e', '#4d4193'])
43+
// .interpolate(d3.interpolateHcl);
44+
45+
// d3.quantize(d3.interpolateHcl('#60c96e', '#4d4193'), 10);
46+
// const colorScale = d3.scaleOrdinal(colorScheme);
3847

3948
// Set up circle-packing layout function
4049
const packFunc = useCallback(data => {
@@ -47,7 +56,7 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
4756

4857
// If indexToDisplay changes, clear old tree nodes
4958
useEffect(() => {
50-
console.log('***** useEffect - CLEARING')
59+
console.log('***** useEffect - CLEARING');
5160
while (svgRef.current.hasChildNodes()) {
5261
svgRef.current.removeChild(svgRef.current.lastChild);
5362
}
@@ -61,7 +70,7 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
6170

6271
// Set initial focus root node
6372
let curFocus = packedRoot;
64-
73+
6574
// View [x, y, r]
6675
let view;
6776

@@ -75,21 +84,22 @@ const PerfView = ({ snapshots, viewIndex, width = 600, height = 600 }) => {
7584
.selectAll('circle')
7685
.data(packedRoot.descendants().slice(1))
7786
.enter().append('circle')
78-
.attr('fill', d => (d.children ? colorScale(d.depth) : 'white'))
79-
.attr('pointer-events', d => (!d.children ? 'none' : null))
80-
.on('mouseover', () => d3.select(this).attr('stroke', '#000'))
81-
.on('mouseout', () => d3.select(this).attr('stroke', null))
82-
.on('click', d => curFocus !== d && (zoomToNode(d), d3.event.stopPropagation()));
87+
.attr('fill', d => (d.children ? colorScale(d.depth) : 'white'))
88+
.attr('pointer-events', d => (!d.children ? 'none' : null))
89+
.on('mouseover', () => d3.select(this).attr('stroke', '#000'))
90+
.on('mouseout', () => d3.select(this).attr('stroke', null))
91+
.on('click', d => curFocus !== d && (zoomToNode(d), d3.event.stopPropagation()));
8392

8493
// Generate text labels. Set (only) root to visible initially
8594
const label = svg.append('g')
86-
.attr('class', 'perf-chart-labels')
95+
// .style('fill', 'rgb(231, 231, 231)')
96+
.attr('class', 'perf-chart-labels')
8797
.selectAll('text')
8898
.data(packedRoot.descendants())
8999
.enter().append('text')
90-
.style('fill-opacity', d => (d.parent === packedRoot ? 1 : 0))
91-
.style('display', d => (d.parent === packedRoot ? 'inline' : 'none'))
92-
.text(d => `${d.data.name}: \
100+
.style('fill-opacity', d => (d.parent === packedRoot ? 1 : 0))
101+
.style('display', d => (d.parent === packedRoot ? 'inline' : 'none'))
102+
.text(d => `${d.data.name}: \
93103
${Number.parseFloat(d.data.componentData.actualDuration).toFixed(2)}ms`);
94104

95105
// Remove any unused nodes

src/app/components/StateRoute.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const StateRoute = ({ snapshot, hierarchy, snapshots, viewIndex }) => {
3030

3131
const renderPerfView = () => {
3232
if (hierarchy) {
33-
return <PerfView viewIndex={viewIndex} snapshots={snapshots} />; // ref={windowRef}
33+
return <PerfView viewIndex={viewIndex} snapshots={snapshots} />;
3434
}
3535
return <div className="noState">{NO_STATE_MSG}</div>;
3636
};
@@ -65,3 +65,9 @@ StateRoute.propTypes = {
6565
};
6666

6767
export default StateRoute;
68+
69+
// <div>
70+
// <PerfView viewIndex={viewIndex} snapshots={snapshots} />
71+
// <div className="ancestorStatus">Test</div>
72+
// </div>
73+
// );

src/app/styles/components/d3graph.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,15 @@ div.tooltip {
101101
}
102102

103103
.d3divContainer {
104-
/* border: 1px solid blue; */
104+
display: flex;
105+
flex-direction: column;
106+
justify-content: space-between;
105107
}
106108

107109
.perf-chart-labels {
108-
font: 11px sans-serif;
110+
font: 15px sans-serif;
111+
color: white;
109112
pointer-events: none;
110113
text-anchor: middle;
111-
};
114+
};
115+

0 commit comments

Comments
 (0)