File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,19 @@ import { Chart } from 'react-google-charts';
10
10
function AtomsRelationship ( props ) {
11
11
console . log ( 'Props' , props . atomsRel ) ;
12
12
13
+ const { atomsRel} = props
14
+
15
+
13
16
return (
14
17
< div className = "history-d3-container" >
15
- < Chart
18
+ { atomsRel && (
19
+ < Chart
16
20
width = { '100%' }
17
21
height = { '100%' }
18
22
chartType = "Sankey"
19
23
options = { {
20
24
sankey : {
21
- link : { color : { fill : '#c6e6f ' , fillOpacity : 0.1 } } ,
25
+ link : { color : { fill : '#gray ' , fillOpacity : 0.1 } } ,
22
26
node : {
23
27
colors : [
24
28
'#4a91c7' ,
@@ -31,18 +35,23 @@ function AtomsRelationship(props) {
31
35
'#b7dbf8' ,
32
36
'#c6e6ff' ,
33
37
'#46edf2' ,
38
+ '#76f5f3' ,
34
39
'#95B6B7' ,
40
+ '#76dcde' ,
41
+ '#5fdaed' ,
35
42
] ,
43
+
36
44
label : { color : '#fff' , fontSize : '14' } ,
37
45
nodePadding : 50 ,
38
46
width : 15 ,
39
47
} ,
40
48
} ,
49
+ tooltip : { textStyle : { color : 'gray' , fontSize : 12 } } ,
41
50
} }
42
51
loader = { < div > Loading Chart</ div > }
43
- data = { [ [ 'Atom' , 'Selector' , '' ] , ...props . atomsRel ] }
52
+ data = { [ [ 'Atom' , 'Selector' , '' ] , ...atomsRel ] }
44
53
rootProps = { { 'data-testid' : '1' } }
45
- />
54
+ /> ) }
46
55
</ div >
47
56
) ;
48
57
}
Original file line number Diff line number Diff line change @@ -30,10 +30,6 @@ const filterHooks = (data: any[]) => {
30
30
return JSON . stringify ( data [ 0 ] . state ) ;
31
31
} ;
32
32
33
- interface HistoryProps {
34
- hierarchy : Record < string , unknown > ;
35
- }
36
-
37
33
38
34
/**
39
35
* @method maked3Tree :Creates a new D3 Tree
@@ -44,7 +40,6 @@ function History(props) {
44
40
let root = JSON . parse ( JSON . stringify ( hierarchy ) ) ;
45
41
let isRecoil = false ;
46
42
let HistoryRef = React . createRef ( root ) ; //React.createRef(root);
47
-
48
43
useEffect ( ( ) => {
49
44
maked3Tree ( ) ;
50
45
} , [ root ] ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ interface StateRouteProps {
32
32
children ?: any [ ] ;
33
33
AtomsRelationship ?: any [ ] ;
34
34
} ;
35
- hierarchy : object ;
35
+ hierarchy : any ;
36
36
snapshots : [ ] ;
37
37
viewIndex : number ;
38
38
}
@@ -44,6 +44,8 @@ const StateRoute = (props: StateRouteProps) => {
44
44
// console.log(snapshot.AtomsRelationship)
45
45
let isRecoil = snapshot . AtomsRelationship ? true : false ;
46
46
const [ noRenderData , setNoRenderData ] = useState ( false ) ;
47
+
48
+ // component map zoom state
47
49
const [ { x, y, k } , setZoomState ] : any = useState ( {
48
50
x : 150 ,
49
51
y : 250 ,
@@ -63,10 +65,11 @@ const StateRoute = (props: StateRouteProps) => {
63
65
// when the page is refreshed we may not have a hierarchy, so we need to check if hierarchy was initialized
64
66
// if true involk render chart with hierarchy
65
67
const renderHistory = ( ) => {
66
- if ( hierarchy ) {
68
+ if ( hierarchy . children . length > 0 ) {
69
+
67
70
return < History hierarchy = { hierarchy } /> ;
68
71
}
69
- return < div className = "noState" > { NO_STATE_MSG } </ div > ;
72
+ return < div className = "noState" > Application not compatible with history </ div > ;
70
73
} ;
71
74
72
75
const renderAtomsRelationship = ( ) => {
You can’t perform that action at this time.
0 commit comments