Skip to content

Commit 6809aca

Browse files
committed
Merge branch 'staging' into legend
2 parents b7fe6d3 + 98f602c commit 6809aca

File tree

8 files changed

+371
-301
lines changed

8 files changed

+371
-301
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ bower_components
1515
sandboxes/manual-tests/NextJS/.next
1616
.vscode
1717
src/app/components/Map.tsx
18+
package-lock.json

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"bower": "^1.8.8",
120120
"cookie": "^0.4.1",
121121
"d3": "^5.16.0",
122+
"d3-shape": "^2.0.0",
122123
"d3-zoom": "^1.8.3",
123124
"flatted": "^3.0.4",
124125
"immer": "^3.3.0",

src/app/components/AtomsRelationship.jsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import { Cluster, hierarchy } from '@visx/hierarchy';
55
import { LinkVertical } from '@visx/shape';
66
import { LinearGradient } from '@visx/gradient';
77

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+
1214
const merlinsbeard = '#f7f7f3';
1315
export const background = '#242529';
16+
const root = '#d2f5e3';
1417

1518
// interface NodeShape {
1619
// name: string;
@@ -39,7 +42,7 @@ function clusterDataPopulate(props) {
3942
if (!memoizeObj[key].includes(atomCompObj[key][i])) {
4043
if (!clusterData.children[counter].children)
4144
clusterData.children[counter].children = [];
42-
clusterData.children[counter].children.push({
45+
clusterData.children[counter].children.push({
4346
name: atomCompObj[key][i],
4447
});
4548
}
@@ -77,8 +80,8 @@ function Node({ node }) {
7780
{node.depth !== 0 && (
7881
<circle
7982
r={12}
80-
fill={background}
81-
stroke={isParent ? white : citrus}
83+
fill={isParent ? white : blue}
84+
stroke={isParent ? white : blue}
8285
// onClick={() => {
8386
// alert(`clicked: ${JSON.stringify(node.data.name)}`);
8487
// }}
@@ -89,8 +92,9 @@ function Node({ node }) {
8992
fontSize={9}
9093
fontFamily="Arial"
9194
textAnchor="middle"
95+
y = "-20"
9296
style={{ pointerEvents: 'none' }}
93-
fill={isParent ? white : citrus}
97+
fill={isParent ? white : blue}
9498
>
9599
{node.data.name}
96100
</text>
@@ -105,18 +109,21 @@ function RootNode({ node }) {
105109
const centerY = -height / 2;
106110

107111
return (
108-
<Group top = {node.y} left = {node.x}>
112+
<Group top={node.y} left={node.x}>
109113
<rect
110114
width={width}
111115
height={height}
116+
fill={root}
112117
y={centerY}
113118
x={centerX}
119+
rx="10"
120+
ry="10"
114121
fill="url('#top')"
115122
/>
116123
<text
117124
dy=".33em"
118-
top= {node.y}
119-
left = {node.x}
125+
top={node.y}
126+
left={node.x}
120127
fontSize={9}
121128
fontFamily="Arial"
122129
textAnchor="middle"
@@ -129,7 +136,7 @@ function RootNode({ node }) {
129136
);
130137
}
131138

132-
const defaultMargin = { top: 40, left: 0, right: 0, bottom: 40};
139+
const defaultMargin = { top: 40, left: 0, right: 0, bottom: 40 };
133140

134141
// export type DendrogramProps = {
135142
// width: number;
@@ -143,7 +150,6 @@ export default function Example({
143150
margin = defaultMargin,
144151
snapshots,
145152
}) {
146-
147153
clusterDataPopulate(snapshots);
148154

149155
const data = useMemo(() => hierarchy(clusterData), []);
@@ -152,7 +158,8 @@ export default function Example({
152158

153159
return width < 10 ? null : (
154160
<svg width={width} height={height}>
155-
<LinearGradient id="top" from={green} to={aqua} />
161+
<LinearGradient id="top" from={lightorange} to={orange} />
162+
156163
<rect width={width} height={height} rx={14} fill={background} />
157164

158165
<Cluster root={data} size={[xMax, yMax]}>

0 commit comments

Comments
 (0)