@@ -5,12 +5,15 @@ import { Cluster, hierarchy } from '@visx/hierarchy';
5
5
import { LinkVertical } from '@visx/shape' ;
6
6
import { LinearGradient } from '@visx/gradient' ;
7
7
8
- const citrus = '#ddf163' ;
9
- const white = '#ffffff' ;
10
- export const green = '#79d259' ;
11
- const aqua = '#37ac8c' ;
8
+ const blue = '#acdbdf' ;
9
+ const white = '#f0ece2' ;
10
+
11
+ export const lightorange = '#F9D976' ;
12
+ const orange = '#F39F86' ;
13
+
12
14
const merlinsbeard = '#f7f7f3' ;
13
15
export const background = '#242529' ;
16
+ const root = '#d2f5e3' ;
14
17
15
18
// interface NodeShape {
16
19
// name: string;
@@ -39,7 +42,7 @@ function clusterDataPopulate(props) {
39
42
if ( ! memoizeObj [ key ] . includes ( atomCompObj [ key ] [ i ] ) ) {
40
43
if ( ! clusterData . children [ counter ] . children )
41
44
clusterData . children [ counter ] . children = [ ] ;
42
- clusterData . children [ counter ] . children . push ( {
45
+ clusterData . children [ counter ] . children . push ( {
43
46
name : atomCompObj [ key ] [ i ] ,
44
47
} ) ;
45
48
}
@@ -77,8 +80,8 @@ function Node({ node }) {
77
80
{ node . depth !== 0 && (
78
81
< circle
79
82
r = { 12 }
80
- fill = { background }
81
- stroke = { isParent ? white : citrus }
83
+ fill = { isParent ? white : blue }
84
+ stroke = { isParent ? white : blue }
82
85
// onClick={() => {
83
86
// alert(`clicked: ${JSON.stringify(node.data.name)}`);
84
87
// }}
@@ -89,8 +92,9 @@ function Node({ node }) {
89
92
fontSize = { 9 }
90
93
fontFamily = "Arial"
91
94
textAnchor = "middle"
95
+ y = "-20"
92
96
style = { { pointerEvents : 'none' } }
93
- fill = { isParent ? white : citrus }
97
+ fill = { isParent ? white : blue }
94
98
>
95
99
{ node . data . name }
96
100
</ text >
@@ -105,18 +109,21 @@ function RootNode({ node }) {
105
109
const centerY = - height / 2 ;
106
110
107
111
return (
108
- < Group top = { node . y } left = { node . x } >
112
+ < Group top = { node . y } left = { node . x } >
109
113
< rect
110
114
width = { width }
111
115
height = { height }
116
+ fill = { root }
112
117
y = { centerY }
113
118
x = { centerX }
119
+ rx = "10"
120
+ ry = "10"
114
121
fill = "url('#top')"
115
122
/>
116
123
< text
117
124
dy = ".33em"
118
- top = { node . y }
119
- left = { node . x }
125
+ top = { node . y }
126
+ left = { node . x }
120
127
fontSize = { 9 }
121
128
fontFamily = "Arial"
122
129
textAnchor = "middle"
@@ -129,7 +136,7 @@ function RootNode({ node }) {
129
136
) ;
130
137
}
131
138
132
- const defaultMargin = { top : 40 , left : 0 , right : 0 , bottom : 40 } ;
139
+ const defaultMargin = { top : 40 , left : 0 , right : 0 , bottom : 40 } ;
133
140
134
141
// export type DendrogramProps = {
135
142
// width: number;
@@ -143,7 +150,6 @@ export default function Example({
143
150
margin = defaultMargin ,
144
151
snapshots,
145
152
} ) {
146
-
147
153
clusterDataPopulate ( snapshots ) ;
148
154
149
155
const data = useMemo ( ( ) => hierarchy ( clusterData ) , [ ] ) ;
@@ -152,7 +158,8 @@ export default function Example({
152
158
153
159
return width < 10 ? null : (
154
160
< svg width = { width } height = { height } >
155
- < LinearGradient id = "top" from = { green } to = { aqua } />
161
+ < LinearGradient id = "top" from = { lightorange } to = { orange } />
162
+
156
163
< rect width = { width } height = { height } rx = { 14 } fill = { background } />
157
164
158
165
< Cluster root = { data } size = { [ xMax , yMax ] } >
0 commit comments