-
Notifications
You must be signed in to change notification settings - Fork 3
/
consts.js
41 lines (37 loc) · 1 KB
/
consts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { scaleSqrt, scaleOrdinal } from "d3-scale"
// set node, link, text color and dimensions
const nodeStrokeWidth = 2
const nodeTextOpacity = 0.8
const nodeTextSize = 12
const nodeTextFill = "gray"
const linkTextOpacity = 0
const linkTextSize = 8
const linkTextFill = "gray"
const transitionDuration = 750
const colorScale = scaleOrdinal()
.range(["#E10100", "#00bcd4", "#3f51b5"])
.domain(["root", "parent", "children"])
const radiusAccessor = (d) => 3
const nodeOpacityAccessor = () => 1
const nodeColorAccessor = (d) => colorScale(d.type)
const linkWidthAccessor = () => 2
const linkOpacityAccessor = () => 1
const linkColorAccessor = () => "gray"
const strengthAccessor = () => 0.5
export const defaultGraphElements = {
nodeStrokeWidth,
nodeTextOpacity,
nodeTextSize,
nodeTextFill,
linkTextOpacity,
linkTextSize,
linkTextFill,
transitionDuration,
radiusAccessor,
nodeOpacityAccessor,
nodeColorAccessor,
linkWidthAccessor,
linkOpacityAccessor,
linkColorAccessor,
strengthAccessor,
}