@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,118 @@
|
|
|
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 {Priestley as D3plusPriestley} from "@d3plus/react";
|
|
9
|
+
export const Priestley = ({ config }) => <D3plusPriestley 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 Priestley
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Priestley-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
axisConfig: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "object"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: "{scale: time}",
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
summary: "{scale: time}"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
required: false,
|
|
38
|
+
summary: "object"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
end: {
|
|
42
|
+
control: {
|
|
43
|
+
type: "text"
|
|
44
|
+
},
|
|
45
|
+
defaultValue: "end",
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: {
|
|
48
|
+
summary: "end"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
summary: "function | string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
paddingInner: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "number"
|
|
59
|
+
},
|
|
60
|
+
defaultValue: 0.05,
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
summary: 0.05
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
required: false,
|
|
68
|
+
summary: "number"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
paddingOuter: {
|
|
72
|
+
control: {
|
|
73
|
+
type: "number"
|
|
74
|
+
},
|
|
75
|
+
defaultValue: 0.05,
|
|
76
|
+
table: {
|
|
77
|
+
defaultValue: {
|
|
78
|
+
summary: 0.05
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
type: {
|
|
82
|
+
required: false,
|
|
83
|
+
summary: "number"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
shapeConfig: {
|
|
87
|
+
control: {
|
|
88
|
+
type: "object"
|
|
89
|
+
},
|
|
90
|
+
defaultValue: "assign({}, this._shapeConfig, {ariaLabel: (d, i) => `${this._drawLabel(d, i)}, ${this._start(d, i)} - ${this._end(d, i)}.`})",
|
|
91
|
+
table: {
|
|
92
|
+
defaultValue: {
|
|
93
|
+
detail: "assign({}, this._shapeConfig, {ariaLabel: (d, i) => `${this._drawLabel(d, i)}, ${this._start(d, i)} - ${this._end(d, i)}.`})",
|
|
94
|
+
summary: "function"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
type: {
|
|
98
|
+
required: false,
|
|
99
|
+
summary: "object"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
start: {
|
|
103
|
+
control: {
|
|
104
|
+
type: "text"
|
|
105
|
+
},
|
|
106
|
+
defaultValue: "start",
|
|
107
|
+
table: {
|
|
108
|
+
defaultValue: {
|
|
109
|
+
summary: "start"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
type: {
|
|
113
|
+
required: false,
|
|
114
|
+
summary: "function | string"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
);
|
|
@@ -0,0 +1,120 @@
|
|
|
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 {Radar as D3plusRadar} from "@d3plus/react";
|
|
9
|
+
export const Radar = ({ config }) => <D3plusRadar 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 Radar
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Radar-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
axisConfig: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "object"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: "{shapeConfig: {fill: none, labelConfig: {fontColor: #999, padding: 0, textAnchor: (d, i, x) => x.textAnchor, verticalAlign: middle}, stroke: #eee, strokeWidth: 1}}",
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
detail: "{shapeConfig: {fill: none, labelConfig: {fontColor: #999, padding: 0, textAnchor: (d, i, x) => x.textAnchor, verticalAlign: middle}, stroke: #eee, strokeWidth: 1}}",
|
|
34
|
+
summary: "function"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
type: {
|
|
38
|
+
required: true,
|
|
39
|
+
summary: "object"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
discrete: {
|
|
43
|
+
control: {
|
|
44
|
+
type: "text"
|
|
45
|
+
},
|
|
46
|
+
defaultValue: "metric",
|
|
47
|
+
table: {
|
|
48
|
+
defaultValue: {
|
|
49
|
+
summary: "metric"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
type: {
|
|
53
|
+
required: false,
|
|
54
|
+
summary: "string"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
metric: {
|
|
58
|
+
control: {
|
|
59
|
+
type: "text"
|
|
60
|
+
},
|
|
61
|
+
defaultValue: "d => d[\"metric\"]",
|
|
62
|
+
table: {
|
|
63
|
+
defaultValue: {
|
|
64
|
+
detail: "d => d[\"metric\"]",
|
|
65
|
+
summary: "function"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
type: {
|
|
69
|
+
required: true,
|
|
70
|
+
summary: "function | string"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
outerPadding: {
|
|
74
|
+
control: {
|
|
75
|
+
type: "number"
|
|
76
|
+
},
|
|
77
|
+
defaultValue: 100,
|
|
78
|
+
table: {
|
|
79
|
+
defaultValue: {
|
|
80
|
+
summary: 100
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
type: {
|
|
84
|
+
required: false,
|
|
85
|
+
summary: "number"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
shape: {
|
|
89
|
+
control: {
|
|
90
|
+
type: "text"
|
|
91
|
+
},
|
|
92
|
+
defaultValue: "Path",
|
|
93
|
+
table: {
|
|
94
|
+
defaultValue: {
|
|
95
|
+
summary: "Path"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
type: {
|
|
99
|
+
required: false,
|
|
100
|
+
summary: "function | string"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
value: {
|
|
104
|
+
control: {
|
|
105
|
+
type: "text"
|
|
106
|
+
},
|
|
107
|
+
defaultValue: "d => d[\"value\"]",
|
|
108
|
+
table: {
|
|
109
|
+
defaultValue: {
|
|
110
|
+
detail: "d => d[\"value\"]",
|
|
111
|
+
summary: "function"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
type: {
|
|
115
|
+
required: true,
|
|
116
|
+
summary: "function | string"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
);
|
|
@@ -0,0 +1,197 @@
|
|
|
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 {RadialMatrix as D3plusRadialMatrix} from "@d3plus/react";
|
|
9
|
+
export const RadialMatrix = ({ config }) => <D3plusRadialMatrix 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 RadialMatrix
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* RadialMatrix-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
cellPadding: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "number"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: 2,
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
summary: 2
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
required: false,
|
|
38
|
+
summary: "number"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
column: {
|
|
42
|
+
control: {
|
|
43
|
+
type: "text"
|
|
44
|
+
},
|
|
45
|
+
defaultValue: "d => d[\"column\"]",
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: {
|
|
48
|
+
detail: "d => d[\"column\"]",
|
|
49
|
+
summary: "function"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
type: {
|
|
53
|
+
required: false,
|
|
54
|
+
summary: "string | function"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
columnConfig: {
|
|
58
|
+
control: {
|
|
59
|
+
type: "object"
|
|
60
|
+
},
|
|
61
|
+
defaultValue: "{shapeConfig: {labelConfig: {fontColor: #000, padding: 5, textAnchor: (d) => [\n0,\n180\n].includes(d.angle) ? middle : [\n2,\n3\n].includes(d.quadrant) ? end : start, verticalAlign: (d) => [\n90,\n270\n].includes(d.angle) ? middle : [\n2,\n1\n].includes(d.quadrant) ? bottom : top}}}",
|
|
62
|
+
table: {
|
|
63
|
+
defaultValue: {
|
|
64
|
+
detail: "{shapeConfig: {labelConfig: {fontColor: #000, padding: 5, textAnchor: (d) => [\n0,\n180\n].includes(d.angle) ? middle : [\n2,\n3\n].includes(d.quadrant) ? end : start, verticalAlign: (d) => [\n90,\n270\n].includes(d.angle) ? middle : [\n2,\n1\n].includes(d.quadrant) ? bottom : top}}}",
|
|
65
|
+
summary: "function"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
type: {
|
|
69
|
+
required: true,
|
|
70
|
+
summary: "object"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
columnList: {
|
|
74
|
+
control: {
|
|
75
|
+
type: "array"
|
|
76
|
+
},
|
|
77
|
+
table: {
|
|
78
|
+
defaultValue: {
|
|
79
|
+
summary: "undefined"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
type: {
|
|
83
|
+
required: false,
|
|
84
|
+
summary: "array"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
columnSort: {
|
|
88
|
+
control: {},
|
|
89
|
+
defaultValue: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
90
|
+
table: {
|
|
91
|
+
defaultValue: {
|
|
92
|
+
detail: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
93
|
+
summary: "function"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
type: {
|
|
97
|
+
required: false,
|
|
98
|
+
summary: "function"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
innerRadius: {
|
|
102
|
+
control: {
|
|
103
|
+
type: "number"
|
|
104
|
+
},
|
|
105
|
+
defaultValue: "(radius) => radius / 5",
|
|
106
|
+
table: {
|
|
107
|
+
defaultValue: {
|
|
108
|
+
detail: "(radius) => radius / 5",
|
|
109
|
+
summary: "function"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
type: {
|
|
113
|
+
required: false,
|
|
114
|
+
summary: "function | number"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
label: {
|
|
118
|
+
control: {
|
|
119
|
+
type: "text"
|
|
120
|
+
},
|
|
121
|
+
defaultValue: "(d, i) => `${getProp.bind(this)(row, d, i)} / ${getProp.bind(this)(column, d, i)}`",
|
|
122
|
+
table: {
|
|
123
|
+
defaultValue: {
|
|
124
|
+
detail: "(d, i) => `${getProp.bind(this)(row, d, i)} / ${getProp.bind(this)(column, d, i)}`",
|
|
125
|
+
summary: "function"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
type: {
|
|
129
|
+
required: false,
|
|
130
|
+
summary: "function | string"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
on: {
|
|
134
|
+
control: {
|
|
135
|
+
type: "text"
|
|
136
|
+
},
|
|
137
|
+
defaultValue: {
|
|
138
|
+
"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}"
|
|
139
|
+
},
|
|
140
|
+
table: {
|
|
141
|
+
defaultValue: {
|
|
142
|
+
summary: {
|
|
143
|
+
"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}"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
type: {
|
|
148
|
+
required: false,
|
|
149
|
+
summary: "string"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
row: {
|
|
153
|
+
control: {
|
|
154
|
+
type: "text"
|
|
155
|
+
},
|
|
156
|
+
defaultValue: "d => d[\"row\"]",
|
|
157
|
+
table: {
|
|
158
|
+
defaultValue: {
|
|
159
|
+
detail: "d => d[\"row\"]",
|
|
160
|
+
summary: "function"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
type: {
|
|
164
|
+
required: false,
|
|
165
|
+
summary: "string | function"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
rowList: {
|
|
169
|
+
control: {
|
|
170
|
+
type: "array"
|
|
171
|
+
},
|
|
172
|
+
table: {
|
|
173
|
+
defaultValue: {
|
|
174
|
+
summary: "undefined"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
type: {
|
|
178
|
+
required: false,
|
|
179
|
+
summary: "array"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
rowSort: {
|
|
183
|
+
control: {},
|
|
184
|
+
defaultValue: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
185
|
+
table: {
|
|
186
|
+
defaultValue: {
|
|
187
|
+
detail: "(a, b) => `${a}`.localeCompare(`${b}`)",
|
|
188
|
+
summary: "function"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
type: {
|
|
192
|
+
required: false,
|
|
193
|
+
summary: "function"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
);
|
|
@@ -0,0 +1,228 @@
|
|
|
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 {Rings as D3plusRings} from "@d3plus/react";
|
|
9
|
+
export const Rings = ({ config }) => <D3plusRings 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 Rings
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Rings-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
center: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "text"
|
|
29
|
+
},
|
|
30
|
+
table: {
|
|
31
|
+
defaultValue: {
|
|
32
|
+
summary: "undefined"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
required: true,
|
|
37
|
+
summary: "string"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
hover: {
|
|
41
|
+
control: {},
|
|
42
|
+
table: {
|
|
43
|
+
defaultValue: {
|
|
44
|
+
summary: "undefined"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
required: false,
|
|
49
|
+
summary: "function"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
links: {
|
|
53
|
+
control: {
|
|
54
|
+
type: "array"
|
|
55
|
+
},
|
|
56
|
+
defaultValue: "[\n\n]",
|
|
57
|
+
description: "= []",
|
|
58
|
+
table: {
|
|
59
|
+
defaultValue: {
|
|
60
|
+
summary: "[\n\n]"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
type: {
|
|
64
|
+
required: true,
|
|
65
|
+
summary: "array | string"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
noDataMessage: {
|
|
69
|
+
control: {
|
|
70
|
+
type: "boolean"
|
|
71
|
+
},
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
table: {
|
|
74
|
+
defaultValue: {
|
|
75
|
+
summary: false
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
type: {
|
|
79
|
+
required: false,
|
|
80
|
+
summary: "boolean"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
nodeGroupBy: {
|
|
84
|
+
control: {
|
|
85
|
+
type: "text"
|
|
86
|
+
},
|
|
87
|
+
table: {
|
|
88
|
+
defaultValue: {
|
|
89
|
+
summary: "undefined"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
type: {
|
|
93
|
+
required: false,
|
|
94
|
+
summary: "string | function | array"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
nodes: {
|
|
98
|
+
control: {
|
|
99
|
+
type: "array"
|
|
100
|
+
},
|
|
101
|
+
defaultValue: "[\n\n]",
|
|
102
|
+
description: "= []",
|
|
103
|
+
table: {
|
|
104
|
+
defaultValue: {
|
|
105
|
+
summary: "[\n\n]"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
type: {
|
|
109
|
+
required: true,
|
|
110
|
+
summary: "array | string"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
on: {
|
|
114
|
+
control: {
|
|
115
|
+
type: "text"
|
|
116
|
+
},
|
|
117
|
+
defaultValue: {
|
|
118
|
+
"click.shape": "(d) => {\n this._center = d.id;\n this._margin = {\n bottom: 0,\n left: 0,\n right: 0,\n top: 0\n };\n this._padding = {\n bottom: 0,\n left: 0,\n right: 0,\n top: 0\n };\n this._draw();\n}",
|
|
119
|
+
mouseenter: "() => {\n }",
|
|
120
|
+
"mouseleave.shape": "() => {\n this.hover(false);\n}",
|
|
121
|
+
"mousemove.shape": "(d, i, x, event) => {\n defaultMouseMove(d, i, x, event);\n if (this._focus && this._focus === d.id) {\n this.hover(false);\n this._on.mouseenter.bind(this)(d, i, x, event);\n this._focus = undefined;\n } else {\n const id = this._nodeGroupBy && this._nodeGroupBy[this._drawDepth](d, i) ? this._nodeGroupBy[this._drawDepth](d, i) : this._id(d, i), links = this._linkLookup[id], node = this._nodeLookup[id];\n const filterIds = [\n node.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 === node.id || h.target.id === node.id;\n else return filterIds.includes(this._ids(h, x)[this._drawDepth]);\n });\n }\n}"
|
|
122
|
+
},
|
|
123
|
+
table: {
|
|
124
|
+
defaultValue: {
|
|
125
|
+
summary: {
|
|
126
|
+
"click.shape": "(d) => {\n this._center = d.id;\n this._margin = {\n bottom: 0,\n left: 0,\n right: 0,\n top: 0\n };\n this._padding = {\n bottom: 0,\n left: 0,\n right: 0,\n top: 0\n };\n this._draw();\n}",
|
|
127
|
+
mouseenter: "() => {\n }",
|
|
128
|
+
"mouseleave.shape": "() => {\n this.hover(false);\n}",
|
|
129
|
+
"mousemove.shape": "(d, i, x, event) => {\n defaultMouseMove(d, i, x, event);\n if (this._focus && this._focus === d.id) {\n this.hover(false);\n this._on.mouseenter.bind(this)(d, i, x, event);\n this._focus = undefined;\n } else {\n const id = this._nodeGroupBy && this._nodeGroupBy[this._drawDepth](d, i) ? this._nodeGroupBy[this._drawDepth](d, i) : this._id(d, i), links = this._linkLookup[id], node = this._nodeLookup[id];\n const filterIds = [\n node.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 === node.id || h.target.id === node.id;\n else return filterIds.includes(this._ids(h, x)[this._drawDepth]);\n });\n }\n}"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
type: {
|
|
134
|
+
required: false,
|
|
135
|
+
summary: "string"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
shape: {
|
|
139
|
+
control: {
|
|
140
|
+
type: "text"
|
|
141
|
+
},
|
|
142
|
+
defaultValue: "Circle",
|
|
143
|
+
table: {
|
|
144
|
+
defaultValue: {
|
|
145
|
+
summary: "Circle"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
type: {
|
|
149
|
+
required: false,
|
|
150
|
+
summary: "function | string"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
shapeConfig: {
|
|
154
|
+
control: {
|
|
155
|
+
type: "object"
|
|
156
|
+
},
|
|
157
|
+
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, strokeWidth: 1}})",
|
|
158
|
+
table: {
|
|
159
|
+
defaultValue: {
|
|
160
|
+
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, strokeWidth: 1}})",
|
|
161
|
+
summary: "function"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
type: {
|
|
165
|
+
required: false,
|
|
166
|
+
summary: "object"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
size: {
|
|
170
|
+
control: {
|
|
171
|
+
type: "text"
|
|
172
|
+
},
|
|
173
|
+
table: {
|
|
174
|
+
defaultValue: {
|
|
175
|
+
summary: "undefined"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
type: {
|
|
179
|
+
required: false,
|
|
180
|
+
summary: "function | string"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
sizeMax: {
|
|
184
|
+
control: {
|
|
185
|
+
type: "number"
|
|
186
|
+
},
|
|
187
|
+
table: {
|
|
188
|
+
defaultValue: {
|
|
189
|
+
summary: "undefined"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
type: {
|
|
193
|
+
required: false,
|
|
194
|
+
summary: "number"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
sizeMin: {
|
|
198
|
+
control: {
|
|
199
|
+
type: "number"
|
|
200
|
+
},
|
|
201
|
+
defaultValue: 5,
|
|
202
|
+
table: {
|
|
203
|
+
defaultValue: {
|
|
204
|
+
summary: 5
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
type: {
|
|
208
|
+
required: false,
|
|
209
|
+
summary: "number"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
sizeScale: {
|
|
213
|
+
control: {
|
|
214
|
+
type: "text"
|
|
215
|
+
},
|
|
216
|
+
defaultValue: "sqrt",
|
|
217
|
+
table: {
|
|
218
|
+
defaultValue: {
|
|
219
|
+
summary: "sqrt"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
type: {
|
|
223
|
+
required: false,
|
|
224
|
+
summary: "string"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
);
|