1
1
import React , { Component , useEffect , useState } from 'react' ;
2
2
import * as d3 from 'd3' ;
3
+ import Example from './legend' ;
3
4
4
5
/**
5
6
* @var colors: Colors array for the diffrerent node branches, each color is for a different branch
@@ -30,7 +31,6 @@ const filterHooks = (data: any[]) => {
30
31
return JSON . stringify ( data [ 0 ] . state ) ;
31
32
} ;
32
33
33
-
34
34
/**
35
35
* @method maked3Tree :Creates a new D3 Tree
36
36
*/
@@ -68,7 +68,7 @@ function History(props) {
68
68
const g = svgContainer
69
69
. append ( 'g' )
70
70
// this is changing where the graph is located physically
71
- . attr ( 'transform' , `translate(${ width / 2 + 4 } , ${ height / 2 + 2 } )` )
71
+ . attr ( 'transform' , `translate(${ width / 2 + 4 } , ${ height / 2 + 2 } )` ) ;
72
72
73
73
// d3.hierarchy constructs a root node from the specified hierarchical data
74
74
// (our object titled dataset), which must be an object representing the root node
@@ -83,7 +83,6 @@ function History(props) {
83
83
84
84
const d3root = tree ( hierarchy ) ;
85
85
86
-
87
86
g . selectAll ( '.link' )
88
87
// root.links() gets an array of all the links,
89
88
// where each element is an object containing a
@@ -109,12 +108,12 @@ function History(props) {
109
108
. append ( 'g' )
110
109
. style ( 'fill' , function ( d ) {
111
110
let loadTime ;
112
- if ( d . data . stateSnapshot . children [ 0 ] . componentData . actualDuration ) {
113
- loadTime = d . data . stateSnapshot . children [ 0 ] . componentData . actualDuration ;
114
- } else {
111
+ if ( d . data . stateSnapshot . children [ 0 ] . componentData . actualDuration ) {
112
+ loadTime =
113
+ d . data . stateSnapshot . children [ 0 ] . componentData . actualDuration ;
114
+ } else {
115
115
loadTime = 1 ;
116
116
}
117
-
118
117
119
118
if ( loadTime !== undefined ) {
120
119
if ( loadTime > 16 ) {
@@ -255,7 +254,8 @@ function History(props) {
255
254
256
255
return (
257
256
< >
258
- < div ref = { HistoryRef } className = "history-d3-div" id = "historyContainer" />
257
+ < div ref = { HistoryRef } className = "history-d3-div" id = "historyContainer" />
258
+ { /* <Example /> */ }
259
259
</ >
260
260
) ;
261
261
}
0 commit comments