@@ -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 red = '#D7816A' ;
12
+ const orange = '#BD4F6C' ;
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,9 +92,9 @@ function Node({ node }) {
89
92
fontSize = { 9 }
90
93
fontFamily = "Arial"
91
94
textAnchor = "middle"
92
- y = "-20"
95
+ y = "-20"
93
96
style = { { pointerEvents : 'none' } }
94
- fill = { isParent ? white : citrus }
97
+ fill = { isParent ? white : blue }
95
98
>
96
99
{ node . data . name }
97
100
</ text >
@@ -106,18 +109,21 @@ function RootNode({ node }) {
106
109
const centerY = - height / 2 ;
107
110
108
111
return (
109
- < Group top = { node . y } left = { node . x } >
112
+ < Group top = { node . y } left = { node . x } >
110
113
< rect
111
114
width = { width }
112
115
height = { height }
116
+ fill = { root }
113
117
y = { centerY }
114
118
x = { centerX }
119
+ rx = "10"
120
+ ry = "10"
115
121
fill = "url('#top')"
116
122
/>
117
123
< text
118
124
dy = ".33em"
119
- top = { node . y }
120
- left = { node . x }
125
+ top = { node . y }
126
+ left = { node . x }
121
127
fontSize = { 9 }
122
128
fontFamily = "Arial"
123
129
textAnchor = "middle"
@@ -130,7 +136,7 @@ function RootNode({ node }) {
130
136
) ;
131
137
}
132
138
133
- const defaultMargin = { top : 40 , left : 0 , right : 0 , bottom : 40 } ;
139
+ const defaultMargin = { top : 40 , left : 0 , right : 0 , bottom : 40 } ;
134
140
135
141
// export type DendrogramProps = {
136
142
// width: number;
@@ -144,7 +150,6 @@ export default function Example({
144
150
margin = defaultMargin ,
145
151
snapshots,
146
152
} ) {
147
-
148
153
clusterDataPopulate ( snapshots ) ;
149
154
150
155
const data = useMemo ( ( ) => hierarchy ( clusterData ) , [ ] ) ;
@@ -153,7 +158,8 @@ export default function Example({
153
158
154
159
return width < 10 ? null : (
155
160
< svg width = { width } height = { height } >
156
- < LinearGradient id = "top" from = { green } to = { aqua } />
161
+ < LinearGradient id = "top" from = { red } to = { orange } />
162
+
157
163
< rect width = { width } height = { height } rx = { 14 } fill = { background } />
158
164
159
165
< Cluster root = { data } size = { [ xMax , yMax ] } >
0 commit comments