@d3plus/docs 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +51 -0
- package/.storybook/manager-head.html +46 -0
- package/.storybook/manager.js +10 -0
- package/.storybook/preview-head.html +69 -0
- package/.storybook/preview.jsx +134 -0
- package/.storybook/theme.js +16 -0
- package/README.md +1 -0
- package/args/color/colorAdd.args.jsx +71 -0
- package/args/color/colorAssign.args.jsx +40 -0
- package/args/color/colorContrast.args.jsx +40 -0
- package/args/color/colorDefaults.args.jsx +8 -0
- package/args/color/colorLegible.args.jsx +24 -0
- package/args/color/colorLighter.args.jsx +40 -0
- package/args/color/colorSubtract.args.jsx +71 -0
- package/args/core/charts/AreaPlot.args.jsx +72 -0
- package/args/core/charts/BarChart.args.jsx +88 -0
- package/args/core/charts/BoxWhisker.args.jsx +73 -0
- package/args/core/charts/BumpChart.args.jsx +133 -0
- package/args/core/charts/Donut.args.jsx +58 -0
- package/args/core/charts/Geomap.args.jsx +363 -0
- package/args/core/charts/LinePlot.args.jsx +57 -0
- package/args/core/charts/Matrix.args.jsx +194 -0
- package/args/core/charts/Network.args.jsx +310 -0
- package/args/core/charts/Pack.args.jsx +171 -0
- package/args/core/charts/Pie.args.jsx +148 -0
- package/args/core/charts/Plot.args.jsx +685 -0
- package/args/core/charts/Priestley.args.jsx +118 -0
- package/args/core/charts/Radar.args.jsx +120 -0
- package/args/core/charts/RadialMatrix.args.jsx +197 -0
- package/args/core/charts/Rings.args.jsx +228 -0
- package/args/core/charts/Sankey.args.jsx +248 -0
- package/args/core/charts/StackedArea.args.jsx +26 -0
- package/args/core/charts/Tree.args.jsx +88 -0
- package/args/core/charts/Treemap.args.jsx +181 -0
- package/args/core/charts/Viz.args.jsx +1383 -0
- package/args/core/components/Axis.args.jsx +600 -0
- package/args/core/components/AxisBottom.args.jsx +42 -0
- package/args/core/components/AxisLeft.args.jsx +42 -0
- package/args/core/components/AxisRight.args.jsx +42 -0
- package/args/core/components/AxisTop.args.jsx +42 -0
- package/args/core/components/ColorScale.args.jsx +456 -0
- package/args/core/components/Legend.args.jsx +289 -0
- package/args/core/components/TextBox.args.jsx +554 -0
- package/args/core/components/Timeline.args.jsx +401 -0
- package/args/core/components/Tooltip.args.jsx +453 -0
- package/args/core/shapes/Area.args.jsx +190 -0
- package/args/core/shapes/Bar.args.jsx +176 -0
- package/args/core/shapes/Box.args.jsx +248 -0
- package/args/core/shapes/Circle.args.jsx +84 -0
- package/args/core/shapes/Image.args.jsx +177 -0
- package/args/core/shapes/Line.args.jsx +127 -0
- package/args/core/shapes/Path.args.jsx +84 -0
- package/args/core/shapes/Rect.args.jsx +85 -0
- package/args/core/shapes/Shape.args.jsx +633 -0
- package/args/core/shapes/Whisker.args.jsx +204 -0
- package/args/core/utils/BaseClass.args.jsx +65 -0
- package/args/core/utils/RESET.args.jsx +8 -0
- package/args/core/utils/accessor.args.jsx +39 -0
- package/args/core/utils/configPrep.args.jsx +56 -0
- package/args/core/utils/constant.args.jsx +24 -0
- package/args/core/utils/uuid.args.jsx +8 -0
- package/args/data/dataConcat.args.jsx +40 -0
- package/args/data/dataFold.args.jsx +56 -0
- package/args/data/dataLoad.args.jsx +65 -0
- package/args/data/isData.args.jsx +24 -0
- package/args/data/merge.args.jsx +39 -0
- package/args/data/unique.args.jsx +37 -0
- package/args/dom/assign.args.jsx +23 -0
- package/args/dom/attrize.args.jsx +39 -0
- package/args/dom/date.args.jsx +23 -0
- package/args/dom/elem.args.jsx +135 -0
- package/args/dom/fontExists.args.jsx +24 -0
- package/args/dom/htmlDecode.args.jsx +23 -0
- package/args/dom/isObject.args.jsx +23 -0
- package/args/dom/parseSides.args.jsx +24 -0
- package/args/dom/prefix.args.jsx +8 -0
- package/args/dom/rtl.args.jsx +8 -0
- package/args/dom/stylize.args.jsx +39 -0
- package/args/dom/textWidth.args.jsx +39 -0
- package/args/export/saveElement.args.jsx +99 -0
- package/args/format/format.args.jsx +24 -0
- package/args/format/formatAbbreviate.args.jsx +39 -0
- package/args/format/formatDate.args.jsx +53 -0
- package/args/format/formatDefaultLocale.args.jsx +24 -0
- package/args/locales/dictionaries/formatLocale.args.jsx +8 -0
- package/args/math/closest.args.jsx +39 -0
- package/args/math/largestRect.args.jsx +56 -0
- package/args/math/lineIntersection.args.jsx +69 -0
- package/args/math/path2polygon.args.jsx +40 -0
- package/args/math/pointDistance.args.jsx +39 -0
- package/args/math/pointDistanceSquared.args.jsx +39 -0
- package/args/math/pointRotate.args.jsx +55 -0
- package/args/math/polygonInside.args.jsx +39 -0
- package/args/math/polygonRayCast.args.jsx +55 -0
- package/args/math/polygonRotate.args.jsx +55 -0
- package/args/math/segmentBoxContains.args.jsx +54 -0
- package/args/math/segmentsIntersect.args.jsx +69 -0
- package/args/math/shapeEdgePoint.args.jsx +39 -0
- package/args/react/D3plusContext.args.jsx +8 -0
- package/args/react/Renderer.args.jsx +53 -0
- package/args/text/fontFamily.args.jsx +8 -0
- package/args/text/fontFamilyStringify.args.jsx +23 -0
- package/args/text/stringify.args.jsx +23 -0
- package/args/text/strip.args.jsx +38 -0
- package/args/text/textSplit.args.jsx +23 -0
- package/args/text/textWrap.args.jsx +8 -0
- package/args/text/titleCase.args.jsx +24 -0
- package/args/text/trim.args.jsx +23 -0
- package/args/text/trimLeft.args.jsx +23 -0
- package/args/text/trimRight.args.jsx +23 -0
- package/docs/Accessibility.mdx +70 -0
- package/docs/HomeChart.jsx +38 -0
- package/docs/Introduction.mdx +130 -0
- package/docs/Logo-Frames.js +352 -0
- package/docs/Logo.jsx +30 -0
- package/helpers/configify.js +18 -0
- package/helpers/funcify.js +14 -0
- package/helpers/stringify.js +30 -0
- package/package.json +44 -0
- package/packages/color/colorAdd.stories.jsx +23 -0
- package/packages/color/colorAssign.stories.jsx +23 -0
- package/packages/color/colorContrast.stories.jsx +23 -0
- package/packages/color/colorDefaults.stories.jsx +23 -0
- package/packages/color/colorLegible.stories.jsx +23 -0
- package/packages/color/colorLighter.stories.jsx +23 -0
- package/packages/color/colorSubtract.stories.jsx +23 -0
- package/packages/core/charts/AreaPlot.stories.jsx +74 -0
- package/packages/core/charts/BarChart.stories.jsx +307 -0
- package/packages/core/charts/BoxWhisker.stories.jsx +204 -0
- package/packages/core/charts/BumpChart.stories.jsx +52 -0
- package/packages/core/charts/Donut.stories.jsx +41 -0
- package/packages/core/charts/Geomap.stories.jsx +186 -0
- package/packages/core/charts/LinePlot.stories.jsx +564 -0
- package/packages/core/charts/Matrix.stories.jsx +36 -0
- package/packages/core/charts/Network.stories.jsx +99 -0
- package/packages/core/charts/Pack.stories.jsx +40 -0
- package/packages/core/charts/Pie.stories.jsx +40 -0
- package/packages/core/charts/Plot.stories.jsx +180 -0
- package/packages/core/charts/Priestley.stories.jsx +60 -0
- package/packages/core/charts/Radar.stories.jsx +60 -0
- package/packages/core/charts/RadialMatrix.stories.jsx +36 -0
- package/packages/core/charts/Rings.stories.jsx +41 -0
- package/packages/core/charts/Sankey.stories.jsx +41 -0
- package/packages/core/charts/StackedArea.stories.jsx +107 -0
- package/packages/core/charts/Tree.stories.jsx +27 -0
- package/packages/core/charts/Treemap.stories.jsx +81 -0
- package/packages/core/charts/Viz.stories.jsx +27 -0
- package/packages/core/components/Axis.stories.jsx +27 -0
- package/packages/core/components/AxisBottom.stories.jsx +27 -0
- package/packages/core/components/AxisLeft.stories.jsx +27 -0
- package/packages/core/components/AxisRight.stories.jsx +27 -0
- package/packages/core/components/AxisTop.stories.jsx +27 -0
- package/packages/core/components/ColorScale.stories.jsx +44 -0
- package/packages/core/components/Legend.stories.jsx +49 -0
- package/packages/core/components/TextBox.stories.jsx +222 -0
- package/packages/core/components/Timeline.stories.jsx +37 -0
- package/packages/core/components/Tooltip.stories.jsx +40 -0
- package/packages/core/shapes/Area.stories.jsx +27 -0
- package/packages/core/shapes/Bar.stories.jsx +27 -0
- package/packages/core/shapes/Box.stories.jsx +27 -0
- package/packages/core/shapes/Circle.stories.jsx +27 -0
- package/packages/core/shapes/Image.stories.jsx +27 -0
- package/packages/core/shapes/Line.stories.jsx +27 -0
- package/packages/core/shapes/Path.stories.jsx +27 -0
- package/packages/core/shapes/Rect.stories.jsx +27 -0
- package/packages/core/shapes/Shape.stories.jsx +27 -0
- package/packages/core/shapes/Whisker.stories.jsx +27 -0
- package/packages/core/utils/BaseClass.stories.jsx +27 -0
- package/packages/core/utils/RESET.stories.jsx +23 -0
- package/packages/core/utils/accessor.stories.jsx +23 -0
- package/packages/core/utils/configPrep.stories.jsx +23 -0
- package/packages/core/utils/constant.stories.jsx +23 -0
- package/packages/core/utils/uuid.stories.jsx +23 -0
- package/packages/data/dataConcat.stories.jsx +23 -0
- package/packages/data/dataFold.stories.jsx +23 -0
- package/packages/data/dataLoad.stories.jsx +23 -0
- package/packages/data/isData.stories.jsx +23 -0
- package/packages/data/merge.stories.jsx +23 -0
- package/packages/data/unique.stories.jsx +23 -0
- package/packages/dom/assign.stories.jsx +23 -0
- package/packages/dom/attrize.stories.jsx +23 -0
- package/packages/dom/date.stories.jsx +23 -0
- package/packages/dom/elem.stories.jsx +23 -0
- package/packages/dom/fontExists.stories.jsx +23 -0
- package/packages/dom/htmlDecode.stories.jsx +23 -0
- package/packages/dom/isObject.stories.jsx +23 -0
- package/packages/dom/parseSides.stories.jsx +23 -0
- package/packages/dom/prefix.stories.jsx +23 -0
- package/packages/dom/rtl.stories.jsx +23 -0
- package/packages/dom/stylize.stories.jsx +23 -0
- package/packages/dom/textWidth.stories.jsx +23 -0
- package/packages/export/saveElement.stories.jsx +23 -0
- package/packages/format/format.stories.jsx +23 -0
- package/packages/format/formatAbbreviate.stories.jsx +23 -0
- package/packages/format/formatDate.stories.jsx +23 -0
- package/packages/format/formatDefaultLocale.stories.jsx +23 -0
- package/packages/locales/dictionaries/formatLocale.stories.jsx +23 -0
- package/packages/math/closest.stories.jsx +23 -0
- package/packages/math/largestRect.stories.jsx +23 -0
- package/packages/math/lineIntersection.stories.jsx +23 -0
- package/packages/math/path2polygon.stories.jsx +23 -0
- package/packages/math/pointDistance.stories.jsx +23 -0
- package/packages/math/pointDistanceSquared.stories.jsx +23 -0
- package/packages/math/pointRotate.stories.jsx +23 -0
- package/packages/math/polygonInside.stories.jsx +23 -0
- package/packages/math/polygonRayCast.stories.jsx +23 -0
- package/packages/math/polygonRotate.stories.jsx +23 -0
- package/packages/math/segmentBoxContains.stories.jsx +23 -0
- package/packages/math/segmentsIntersect.stories.jsx +23 -0
- package/packages/math/shapeEdgePoint.stories.jsx +23 -0
- package/packages/react/D3plusContext.stories.jsx +23 -0
- package/packages/react/Renderer.stories.jsx +23 -0
- package/packages/text/fontFamily.stories.jsx +23 -0
- package/packages/text/fontFamilyStringify.stories.jsx +23 -0
- package/packages/text/stringify.stories.jsx +23 -0
- package/packages/text/strip.stories.jsx +23 -0
- package/packages/text/textSplit.stories.jsx +23 -0
- package/packages/text/textWrap.stories.jsx +23 -0
- package/packages/text/titleCase.stories.jsx +23 -0
- package/packages/text/trim.stories.jsx +23 -0
- package/packages/text/trimLeft.stories.jsx +23 -0
- package/packages/text/trimRight.stories.jsx +23 -0
- package/static/data/city_coords.json +224 -0
- package/static/images/favicon.ico +0 -0
- package/static/images/touchicon.png +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {argTypes as plotArgTypes} from "./Plot.args.jsx";
|
|
6
|
+
import {assign} from "@d3plus/dom";
|
|
7
|
+
|
|
8
|
+
import {LinePlot as D3plusLinePlot} from "@d3plus/react";
|
|
9
|
+
export const LinePlot = ({ config }) => <D3plusLinePlot config={config} />;
|
|
10
|
+
|
|
11
|
+
export const argTypes = assign(
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filters out unused argTypes from the Plot primitive and
|
|
15
|
+
* overrides any defaults that have been changed in LinePlot
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(plotArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(shape|zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = plotArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* LinePlot-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
discrete: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "text"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: "x",
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
summary: "x"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
required: false,
|
|
38
|
+
summary: "string"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
shape: {
|
|
42
|
+
control: {
|
|
43
|
+
type: "text"
|
|
44
|
+
},
|
|
45
|
+
defaultValue: "Line",
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: {
|
|
48
|
+
summary: "Line"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
summary: "function | string"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {argTypes as vizArgTypes} from "./Viz.args.jsx";
|
|
6
|
+
import {assign} from "@d3plus/dom";
|
|
7
|
+
|
|
8
|
+
import {Matrix as D3plusMatrix} from "@d3plus/react";
|
|
9
|
+
export const Matrix = ({ config }) => <D3plusMatrix config={config} />;
|
|
10
|
+
|
|
11
|
+
export const argTypes = assign(
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filters out unused argTypes from the Viz primitive and
|
|
15
|
+
* overrides any defaults that have been changed in Matrix
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Matrix-specific methods
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
cellPadding: {
|
|
26
|
+
control: {
|
|
27
|
+
type: "number"
|
|
28
|
+
},
|
|
29
|
+
defaultValue: 2,
|
|
30
|
+
table: {
|
|
31
|
+
defaultValue: {
|
|
32
|
+
summary: 2
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
required: false,
|
|
37
|
+
summary: "number"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
column: {
|
|
41
|
+
control: {
|
|
42
|
+
type: "text"
|
|
43
|
+
},
|
|
44
|
+
defaultValue: "d => d[\"column\"]",
|
|
45
|
+
table: {
|
|
46
|
+
defaultValue: {
|
|
47
|
+
detail: "d => d[\"column\"]",
|
|
48
|
+
summary: "function"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
summary: "string | function"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
columnConfig: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "object"
|
|
59
|
+
},
|
|
60
|
+
defaultValue: "assign({orient: top}, defaultAxisConfig)",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
summary: "assign({orient: top}, defaultAxisConfig)"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
required: true,
|
|
68
|
+
summary: "object"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
columnList: {
|
|
72
|
+
control: {
|
|
73
|
+
type: "array"
|
|
74
|
+
},
|
|
75
|
+
table: {
|
|
76
|
+
defaultValue: {
|
|
77
|
+
summary: "undefined"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
type: {
|
|
81
|
+
required: false,
|
|
82
|
+
summary: "array"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
columnSort: {
|
|
86
|
+
control: {},
|
|
87
|
+
defaultValue: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
88
|
+
table: {
|
|
89
|
+
defaultValue: {
|
|
90
|
+
detail: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
91
|
+
summary: "function"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
type: {
|
|
95
|
+
required: false,
|
|
96
|
+
summary: "function"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
label: {
|
|
100
|
+
control: {
|
|
101
|
+
type: "text"
|
|
102
|
+
},
|
|
103
|
+
defaultValue: "(d, i) => `${getProp.bind(this)(row, d, i)} / ${getProp.bind(this)(column, d, i)}`",
|
|
104
|
+
table: {
|
|
105
|
+
defaultValue: {
|
|
106
|
+
detail: "(d, i) => `${getProp.bind(this)(row, d, i)} / ${getProp.bind(this)(column, d, i)}`",
|
|
107
|
+
summary: "function"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
type: {
|
|
111
|
+
required: false,
|
|
112
|
+
summary: "function | string"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
on: {
|
|
116
|
+
control: {
|
|
117
|
+
type: "text"
|
|
118
|
+
},
|
|
119
|
+
defaultValue: {
|
|
120
|
+
"mousemove.shape": "(d, i, x, event) => {\n defaultMouseMoveShape(d, i, x, event);\n const row = getProp.bind(this)(\"row\", d, i);\n const column = getProp.bind(this)(\"column\", d, i);\n this.hover((h, ii)=>getProp.bind(this)(\"row\", h, ii) === row || getProp.bind(this)(\"column\", h, ii) === column);\n}"
|
|
121
|
+
},
|
|
122
|
+
table: {
|
|
123
|
+
defaultValue: {
|
|
124
|
+
summary: {
|
|
125
|
+
"mousemove.shape": "(d, i, x, event) => {\n defaultMouseMoveShape(d, i, x, event);\n const row = getProp.bind(this)(\"row\", d, i);\n const column = getProp.bind(this)(\"column\", d, i);\n this.hover((h, ii)=>getProp.bind(this)(\"row\", h, ii) === row || getProp.bind(this)(\"column\", h, ii) === column);\n}"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
type: {
|
|
130
|
+
required: false,
|
|
131
|
+
summary: "string"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
row: {
|
|
135
|
+
control: {
|
|
136
|
+
type: "text"
|
|
137
|
+
},
|
|
138
|
+
defaultValue: "d => d[\"row\"]",
|
|
139
|
+
table: {
|
|
140
|
+
defaultValue: {
|
|
141
|
+
detail: "d => d[\"row\"]",
|
|
142
|
+
summary: "function"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
type: {
|
|
146
|
+
required: false,
|
|
147
|
+
summary: "string | function"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
rowConfig: {
|
|
151
|
+
control: {
|
|
152
|
+
type: "object"
|
|
153
|
+
},
|
|
154
|
+
defaultValue: "assign({orient: left}, defaultAxisConfig)",
|
|
155
|
+
table: {
|
|
156
|
+
defaultValue: {
|
|
157
|
+
summary: "assign({orient: left}, defaultAxisConfig)"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
type: {
|
|
161
|
+
required: true,
|
|
162
|
+
summary: "object"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
rowList: {
|
|
166
|
+
control: {
|
|
167
|
+
type: "array"
|
|
168
|
+
},
|
|
169
|
+
table: {
|
|
170
|
+
defaultValue: {
|
|
171
|
+
summary: "undefined"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
type: {
|
|
175
|
+
required: false,
|
|
176
|
+
summary: "array"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
rowSort: {
|
|
180
|
+
control: {},
|
|
181
|
+
defaultValue: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
182
|
+
table: {
|
|
183
|
+
defaultValue: {
|
|
184
|
+
detail: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
185
|
+
summary: "function"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
type: {
|
|
189
|
+
required: false,
|
|
190
|
+
summary: "function"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
);
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {argTypes as vizArgTypes} from "./Viz.args.jsx";
|
|
6
|
+
import {assign} from "@d3plus/dom";
|
|
7
|
+
|
|
8
|
+
import {Network as D3plusNetwork} from "@d3plus/react";
|
|
9
|
+
export const Network = ({ config }) => <D3plusNetwork config={config} />;
|
|
10
|
+
|
|
11
|
+
export const argTypes = assign(
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filters out unused argTypes from the Viz primitive and
|
|
15
|
+
* overrides any defaults that have been changed in Network
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Network-specific methods
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
hover: {
|
|
26
|
+
control: {},
|
|
27
|
+
table: {
|
|
28
|
+
defaultValue: {
|
|
29
|
+
summary: "undefined"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
type: {
|
|
33
|
+
required: false,
|
|
34
|
+
summary: "function"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
linkSize: {
|
|
38
|
+
control: {
|
|
39
|
+
type: "name"
|
|
40
|
+
},
|
|
41
|
+
defaultValue: 1,
|
|
42
|
+
table: {
|
|
43
|
+
defaultValue: {
|
|
44
|
+
summary: 1
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
required: false,
|
|
49
|
+
summary: "function | name"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
linkSizeMin: {
|
|
53
|
+
control: {
|
|
54
|
+
type: "number"
|
|
55
|
+
},
|
|
56
|
+
defaultValue: 1,
|
|
57
|
+
table: {
|
|
58
|
+
defaultValue: {
|
|
59
|
+
summary: 1
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
type: {
|
|
63
|
+
required: false,
|
|
64
|
+
summary: "number"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
linkSizeScale: {
|
|
68
|
+
control: {
|
|
69
|
+
type: "text"
|
|
70
|
+
},
|
|
71
|
+
defaultValue: "sqrt",
|
|
72
|
+
table: {
|
|
73
|
+
defaultValue: {
|
|
74
|
+
summary: "sqrt"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
type: {
|
|
78
|
+
required: false,
|
|
79
|
+
summary: "string"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
links: {
|
|
83
|
+
control: {
|
|
84
|
+
type: "array"
|
|
85
|
+
},
|
|
86
|
+
defaultValue: "[\n\n]",
|
|
87
|
+
description: "= []",
|
|
88
|
+
table: {
|
|
89
|
+
defaultValue: {
|
|
90
|
+
summary: "[\n\n]"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
type: {
|
|
94
|
+
required: true,
|
|
95
|
+
summary: "array | string"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
noDataMessage: {
|
|
99
|
+
control: {
|
|
100
|
+
type: "boolean"
|
|
101
|
+
},
|
|
102
|
+
defaultValue: false,
|
|
103
|
+
table: {
|
|
104
|
+
defaultValue: {
|
|
105
|
+
summary: false
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
type: {
|
|
109
|
+
required: false,
|
|
110
|
+
summary: "boolean"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
nodeGroupBy: {
|
|
114
|
+
control: {
|
|
115
|
+
type: "text"
|
|
116
|
+
},
|
|
117
|
+
defaultValue: "[\nd => d[\"id\"]\n]",
|
|
118
|
+
table: {
|
|
119
|
+
defaultValue: {
|
|
120
|
+
detail: "[\nd => d[\"id\"]\n]",
|
|
121
|
+
summary: "function"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
type: {
|
|
125
|
+
required: false,
|
|
126
|
+
summary: "string | function | array"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
nodes: {
|
|
130
|
+
control: {
|
|
131
|
+
type: "array"
|
|
132
|
+
},
|
|
133
|
+
defaultValue: "[\n\n]",
|
|
134
|
+
description: "= []",
|
|
135
|
+
table: {
|
|
136
|
+
defaultValue: {
|
|
137
|
+
summary: "[\n\n]"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
type: {
|
|
141
|
+
required: true,
|
|
142
|
+
summary: "array | string"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
on: {
|
|
146
|
+
control: {
|
|
147
|
+
type: "text"
|
|
148
|
+
},
|
|
149
|
+
defaultValue: {
|
|
150
|
+
"click.legend": "(d, i, x, event) => {\n const ids = this._id(d);\n let id = this._ids(d);\n id = id[id.length - 1];\n if (this._hover && this._drawDepth >= this._groupBy.length - 1) {\n if (this._focus && this._focus === ids) {\n this.active(false);\n this._focus = undefined;\n this._zoomToBounds(null);\n } else {\n this.hover(false);\n const nodes = ids.map((id)=>this._nodeLookup[id]);\n const filterIds = [\n `${id}`\n ];\n let xDomain = [\n nodes[0].x - nodes[0].r,\n nodes[0].x + nodes[0].r\n ], yDomain = [\n nodes[0].y - nodes[0].r,\n nodes[0].y + nodes[0].r\n ];\n nodes.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.active((h, x)=>{\n if (h.source && h.target) return filterIds.includes(h.source.id) && filterIds.includes(h.target.id);\n else {\n const myIds = this._ids(h, x);\n return filterIds.includes(`${myIds[myIds.length - 1]}`);\n }\n });\n this._focus = ids;\n const t = zoomTransform(this._container.node());\n xDomain = xDomain.map((d)=>d * t.k + t.x);\n yDomain = yDomain.map((d)=>d * t.k + t.y);\n this._zoomToBounds([\n [\n xDomain[0],\n yDomain[0]\n ],\n [\n xDomain[1],\n yDomain[1]\n ]\n ]);\n }\n this._on.mouseenter.bind(this)(d, i, x, event);\n this._on[\"mousemove.legend\"].bind(this)(d, i, x, event);\n }\n}",
|
|
151
|
+
"click.shape": "(d, i, x, event) => {\n this._tooltipClass.data([]).render();\n if (this._hover && this._drawDepth >= this._groupBy.length - 1) {\n const id = getNodeId.bind(this)(d, i);\n if (this._focus && this._focus === id) {\n this.active(false);\n this._on.mouseenter.bind(this)(d, i, x, event);\n this._focus = undefined;\n this._zoomToBounds(null);\n } else {\n this.hover(false);\n const links = this._linkLookup[id], node = this._nodeLookup[id];\n const filterIds = [\n id\n ];\n let xDomain = [\n node.x - node.r,\n node.x + node.r\n ], yDomain = [\n node.y - node.r,\n node.y + node.r\n ];\n links.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.active((h, x)=>{\n if (h.source && h.target) return h.source.id === id || h.target.id === id;\n else return filterIds.includes(getNodeId.bind(this)(h, x));\n });\n this._focus = id;\n const t = zoomTransform(this._container.node());\n xDomain = xDomain.map((d)=>d * t.k + t.x);\n yDomain = yDomain.map((d)=>d * t.k + t.y);\n this._zoomToBounds([\n [\n xDomain[0],\n yDomain[0]\n ],\n [\n xDomain[1],\n yDomain[1]\n ]\n ]);\n }\n }\n}",
|
|
152
|
+
mouseenter: "() => {\n }",
|
|
153
|
+
"mouseleave.shape": "() => {\n this.hover(false);\n}",
|
|
154
|
+
"mousemove.shape": "(d, i, x, event) => {\n defaultMouseMove(d, i, x, event);\n const id = getNodeId.bind(this)(d, i), links = this._linkLookup[id] || [], node = this._nodeLookup[id];\n const filterIds = [\n id\n ];\n const xDomain = [\n node.x - node.r,\n node.x + node.r\n ], yDomain = [\n node.y - node.r,\n node.y + node.r\n ];\n links.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.hover((h, x)=>{\n if (h.source && h.target) return h.source.id === id || h.target.id === id;\n else return filterIds.includes(`${this._ids(h, x)[this._drawDepth]}`);\n });\n}"
|
|
155
|
+
},
|
|
156
|
+
table: {
|
|
157
|
+
defaultValue: {
|
|
158
|
+
summary: {
|
|
159
|
+
"click.legend": "(d, i, x, event) => {\n const ids = this._id(d);\n let id = this._ids(d);\n id = id[id.length - 1];\n if (this._hover && this._drawDepth >= this._groupBy.length - 1) {\n if (this._focus && this._focus === ids) {\n this.active(false);\n this._focus = undefined;\n this._zoomToBounds(null);\n } else {\n this.hover(false);\n const nodes = ids.map((id)=>this._nodeLookup[id]);\n const filterIds = [\n `${id}`\n ];\n let xDomain = [\n nodes[0].x - nodes[0].r,\n nodes[0].x + nodes[0].r\n ], yDomain = [\n nodes[0].y - nodes[0].r,\n nodes[0].y + nodes[0].r\n ];\n nodes.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.active((h, x)=>{\n if (h.source && h.target) return filterIds.includes(h.source.id) && filterIds.includes(h.target.id);\n else {\n const myIds = this._ids(h, x);\n return filterIds.includes(`${myIds[myIds.length - 1]}`);\n }\n });\n this._focus = ids;\n const t = zoomTransform(this._container.node());\n xDomain = xDomain.map((d)=>d * t.k + t.x);\n yDomain = yDomain.map((d)=>d * t.k + t.y);\n this._zoomToBounds([\n [\n xDomain[0],\n yDomain[0]\n ],\n [\n xDomain[1],\n yDomain[1]\n ]\n ]);\n }\n this._on.mouseenter.bind(this)(d, i, x, event);\n this._on[\"mousemove.legend\"].bind(this)(d, i, x, event);\n }\n}",
|
|
160
|
+
"click.shape": "(d, i, x, event) => {\n this._tooltipClass.data([]).render();\n if (this._hover && this._drawDepth >= this._groupBy.length - 1) {\n const id = getNodeId.bind(this)(d, i);\n if (this._focus && this._focus === id) {\n this.active(false);\n this._on.mouseenter.bind(this)(d, i, x, event);\n this._focus = undefined;\n this._zoomToBounds(null);\n } else {\n this.hover(false);\n const links = this._linkLookup[id], node = this._nodeLookup[id];\n const filterIds = [\n id\n ];\n let xDomain = [\n node.x - node.r,\n node.x + node.r\n ], yDomain = [\n node.y - node.r,\n node.y + node.r\n ];\n links.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.active((h, x)=>{\n if (h.source && h.target) return h.source.id === id || h.target.id === id;\n else return filterIds.includes(getNodeId.bind(this)(h, x));\n });\n this._focus = id;\n const t = zoomTransform(this._container.node());\n xDomain = xDomain.map((d)=>d * t.k + t.x);\n yDomain = yDomain.map((d)=>d * t.k + t.y);\n this._zoomToBounds([\n [\n xDomain[0],\n yDomain[0]\n ],\n [\n xDomain[1],\n yDomain[1]\n ]\n ]);\n }\n }\n}",
|
|
161
|
+
mouseenter: "() => {\n }",
|
|
162
|
+
"mouseleave.shape": "() => {\n this.hover(false);\n}",
|
|
163
|
+
"mousemove.shape": "(d, i, x, event) => {\n defaultMouseMove(d, i, x, event);\n const id = getNodeId.bind(this)(d, i), links = this._linkLookup[id] || [], node = this._nodeLookup[id];\n const filterIds = [\n id\n ];\n const xDomain = [\n node.x - node.r,\n node.x + node.r\n ], yDomain = [\n node.y - node.r,\n node.y + node.r\n ];\n links.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.hover((h, x)=>{\n if (h.source && h.target) return h.source.id === id || h.target.id === id;\n else return filterIds.includes(`${this._ids(h, x)[this._drawDepth]}`);\n });\n}"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
type: {
|
|
168
|
+
required: false,
|
|
169
|
+
summary: "string"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
shape: {
|
|
173
|
+
control: {
|
|
174
|
+
type: "text"
|
|
175
|
+
},
|
|
176
|
+
defaultValue: "Circle",
|
|
177
|
+
table: {
|
|
178
|
+
defaultValue: {
|
|
179
|
+
summary: "Circle"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
type: {
|
|
183
|
+
required: false,
|
|
184
|
+
summary: "function | string"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
shapeConfig: {
|
|
188
|
+
control: {
|
|
189
|
+
type: "object"
|
|
190
|
+
},
|
|
191
|
+
defaultValue: "assign(this._shapeConfig, {ariaLabel: (d, i) => {\n const validSize = this._size ? `, ${this._size(d, i)}` : \"\";\n return `${this._drawLabel(d, i)}${validSize}.`;\n}, labelConfig: {duration: 0, fontMin: 1, fontResize: true, labelPadding: 0, textAnchor: middle, verticalAlign: middle}, Path: {fill: none, label: false, stroke: #eee}})",
|
|
192
|
+
table: {
|
|
193
|
+
defaultValue: {
|
|
194
|
+
detail: "assign(this._shapeConfig, {ariaLabel: (d, i) => {\n const validSize = this._size ? `, ${this._size(d, i)}` : \"\";\n return `${this._drawLabel(d, i)}${validSize}.`;\n}, labelConfig: {duration: 0, fontMin: 1, fontResize: true, labelPadding: 0, textAnchor: middle, verticalAlign: middle}, Path: {fill: none, label: false, stroke: #eee}})",
|
|
195
|
+
summary: "function"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
type: {
|
|
199
|
+
required: false,
|
|
200
|
+
summary: "object"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
size: {
|
|
204
|
+
control: {
|
|
205
|
+
type: "text"
|
|
206
|
+
},
|
|
207
|
+
table: {
|
|
208
|
+
defaultValue: {
|
|
209
|
+
summary: "undefined"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
type: {
|
|
213
|
+
required: false,
|
|
214
|
+
summary: "function | string"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
sizeMax: {
|
|
218
|
+
control: {
|
|
219
|
+
type: "number"
|
|
220
|
+
},
|
|
221
|
+
table: {
|
|
222
|
+
defaultValue: {
|
|
223
|
+
summary: "undefined"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
type: {
|
|
227
|
+
required: false,
|
|
228
|
+
summary: "number"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
sizeMin: {
|
|
232
|
+
control: {
|
|
233
|
+
type: "number"
|
|
234
|
+
},
|
|
235
|
+
defaultValue: 5,
|
|
236
|
+
table: {
|
|
237
|
+
defaultValue: {
|
|
238
|
+
summary: 5
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
type: {
|
|
242
|
+
required: false,
|
|
243
|
+
summary: "number"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
sizeScale: {
|
|
247
|
+
control: {
|
|
248
|
+
type: "text"
|
|
249
|
+
},
|
|
250
|
+
defaultValue: "sqrt",
|
|
251
|
+
table: {
|
|
252
|
+
defaultValue: {
|
|
253
|
+
summary: "sqrt"
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
type: {
|
|
257
|
+
required: false,
|
|
258
|
+
summary: "string"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
x: {
|
|
262
|
+
control: {
|
|
263
|
+
type: "text"
|
|
264
|
+
},
|
|
265
|
+
defaultValue: "d => d[\"x\"]",
|
|
266
|
+
table: {
|
|
267
|
+
defaultValue: {
|
|
268
|
+
detail: "d => d[\"x\"]",
|
|
269
|
+
summary: "function"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
type: {
|
|
273
|
+
required: false,
|
|
274
|
+
summary: "function | string"
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
y: {
|
|
278
|
+
control: {
|
|
279
|
+
type: "text"
|
|
280
|
+
},
|
|
281
|
+
defaultValue: "d => d[\"y\"]",
|
|
282
|
+
table: {
|
|
283
|
+
defaultValue: {
|
|
284
|
+
detail: "d => d[\"y\"]",
|
|
285
|
+
summary: "function"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
type: {
|
|
289
|
+
required: false,
|
|
290
|
+
summary: "function | string"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
zoom: {
|
|
294
|
+
control: {
|
|
295
|
+
type: "boolean"
|
|
296
|
+
},
|
|
297
|
+
defaultValue: true,
|
|
298
|
+
description: "= false",
|
|
299
|
+
table: {
|
|
300
|
+
defaultValue: {
|
|
301
|
+
summary: true
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
type: {
|
|
305
|
+
required: true,
|
|
306
|
+
summary: "boolean"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
);
|