@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,88 @@
|
|
|
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 {BarChart as D3plusBarChart} from "@d3plus/react";
|
|
9
|
+
export const BarChart = ({ config }) => <D3plusBarChart 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 BarChart
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(plotArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(shape|zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = plotArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* BarChart-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
baseline: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "number"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: 0,
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
summary: 0
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
required: true,
|
|
38
|
+
summary: "number"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
discrete: {
|
|
42
|
+
control: {
|
|
43
|
+
type: "text"
|
|
44
|
+
},
|
|
45
|
+
defaultValue: "x",
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: {
|
|
48
|
+
summary: "x"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
summary: "string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
legend: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "boolean"
|
|
59
|
+
},
|
|
60
|
+
defaultValue: "(config, arr) => {\n const legendIds = arr.map(this._groupBy[this._legendDepth].bind(this)).sort().join();\n const barIds = this._filteredData.map(this._groupBy[this._legendDepth].bind(this)).sort().join();\n if (legendIds === barIds) return false;\n return defaultLegend.bind(this)(config, arr);\n}",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
detail: "(config, arr) => {\n const legendIds = arr.map(this._groupBy[this._legendDepth].bind(this)).sort().join();\n const barIds = this._filteredData.map(this._groupBy[this._legendDepth].bind(this)).sort().join();\n if (legendIds === barIds) return false;\n return defaultLegend.bind(this)(config, arr);\n}",
|
|
64
|
+
summary: "function"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
required: false,
|
|
69
|
+
summary: "boolean | function"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
shape: {
|
|
73
|
+
control: {
|
|
74
|
+
type: "text"
|
|
75
|
+
},
|
|
76
|
+
defaultValue: "Bar",
|
|
77
|
+
table: {
|
|
78
|
+
defaultValue: {
|
|
79
|
+
summary: "Bar"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
type: {
|
|
83
|
+
required: false,
|
|
84
|
+
summary: "function | string"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
@@ -0,0 +1,73 @@
|
|
|
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 {BoxWhisker as D3plusBoxWhisker} from "@d3plus/react";
|
|
9
|
+
export const BoxWhisker = ({ config }) => <D3plusBoxWhisker 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 BoxWhisker
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(plotArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(shape|zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = plotArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* BoxWhisker-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: "Box",
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: {
|
|
48
|
+
summary: "Box"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
summary: "function | string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
tooltipConfig: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "object"
|
|
59
|
+
},
|
|
60
|
+
defaultValue: "assign(this._tooltipConfig, {title: (d, i) => {\n if (!d) return \"\";\n while(d.__d3plus__ && d.data){\n d = d.data;\n i = d.i;\n }\n if (this._label) return this._label(d, i);\n const l = this._ids(d, i).slice(0, this._drawDepth);\n return l[l.length - 1];\n}})",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
detail: "assign(this._tooltipConfig, {title: (d, i) => {\n if (!d) return \"\";\n while(d.__d3plus__ && d.data){\n d = d.data;\n i = d.i;\n }\n if (this._label) return this._label(d, i);\n const l = this._ids(d, i).slice(0, this._drawDepth);\n return l[l.length - 1];\n}})",
|
|
64
|
+
summary: "function"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
required: false,
|
|
69
|
+
summary: "object"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
@@ -0,0 +1,133 @@
|
|
|
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 {BumpChart as D3plusBumpChart} from "@d3plus/react";
|
|
9
|
+
export const BumpChart = ({ config }) => <D3plusBumpChart 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 BumpChart
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(plotArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(shape|zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = plotArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* BumpChart-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
|
+
y2: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "text"
|
|
59
|
+
},
|
|
60
|
+
defaultValue: "(d) => this._y(d)",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
detail: "(d) => this._y(d)",
|
|
64
|
+
summary: "function"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
required: true,
|
|
69
|
+
summary: "function | string"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
y2Config: {
|
|
73
|
+
control: {
|
|
74
|
+
type: "object"
|
|
75
|
+
},
|
|
76
|
+
defaultValue: "{tickFormat: (val) => {\n const data = this._formattedData;\n const xMax = data[data.length - 1].x instanceof Date ? data[data.length - 1].x.getTime() : data[data.length - 1].x;\n const endData = data.filter((d)=>(d.x instanceof Date ? d.x.getTime() : d.x) === xMax);\n const d = endData.find((d)=>d.y === val);\n return d ? this._drawLabel(d, d.i) : \"\";\n}}",
|
|
77
|
+
table: {
|
|
78
|
+
defaultValue: {
|
|
79
|
+
detail: "{tickFormat: (val) => {\n const data = this._formattedData;\n const xMax = data[data.length - 1].x instanceof Date ? data[data.length - 1].x.getTime() : data[data.length - 1].x;\n const endData = data.filter((d)=>(d.x instanceof Date ? d.x.getTime() : d.x) === xMax);\n const d = endData.find((d)=>d.y === val);\n return d ? this._drawLabel(d, d.i) : \"\";\n}}",
|
|
80
|
+
summary: "function"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
type: {
|
|
84
|
+
required: true,
|
|
85
|
+
summary: "object"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
y2Sort: {
|
|
89
|
+
control: {},
|
|
90
|
+
defaultValue: "(a, b) => this._y(b) - this._y(a)",
|
|
91
|
+
table: {
|
|
92
|
+
defaultValue: {
|
|
93
|
+
detail: "(a, b) => this._y(b) - this._y(a)",
|
|
94
|
+
summary: "function"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
type: {
|
|
98
|
+
required: true,
|
|
99
|
+
summary: "function"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
yConfig: {
|
|
103
|
+
control: {
|
|
104
|
+
type: "object"
|
|
105
|
+
},
|
|
106
|
+
defaultValue: "{tickFormat: (val) => {\n const data = this._formattedData;\n const xMin = data[0].x instanceof Date ? data[0].x.getTime() : data[0].x;\n const startData = data.filter((d)=>(d.x instanceof Date ? d.x.getTime() : d.x) === xMin);\n const d = startData.find((d)=>d.y === val);\n return d ? this._drawLabel(d, d.i) : \"\";\n}}",
|
|
107
|
+
table: {
|
|
108
|
+
defaultValue: {
|
|
109
|
+
detail: "{tickFormat: (val) => {\n const data = this._formattedData;\n const xMin = data[0].x instanceof Date ? data[0].x.getTime() : data[0].x;\n const startData = data.filter((d)=>(d.x instanceof Date ? d.x.getTime() : d.x) === xMin);\n const d = startData.find((d)=>d.y === val);\n return d ? this._drawLabel(d, d.i) : \"\";\n}}",
|
|
110
|
+
summary: "function"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
type: {
|
|
114
|
+
required: true,
|
|
115
|
+
summary: "object"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
ySort: {
|
|
119
|
+
control: {},
|
|
120
|
+
defaultValue: "(a, b) => this._y(b) - this._y(a)",
|
|
121
|
+
table: {
|
|
122
|
+
defaultValue: {
|
|
123
|
+
detail: "(a, b) => this._y(b) - this._y(a)",
|
|
124
|
+
summary: "function"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
type: {
|
|
128
|
+
required: true,
|
|
129
|
+
summary: "function"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
);
|
|
@@ -0,0 +1,58 @@
|
|
|
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 pieArgTypes} from "./Pie.args.jsx";
|
|
6
|
+
import {assign} from "@d3plus/dom";
|
|
7
|
+
|
|
8
|
+
import {Donut as D3plusDonut} from "@d3plus/react";
|
|
9
|
+
export const Donut = ({ config }) => <D3plusDonut config={config} />;
|
|
10
|
+
|
|
11
|
+
export const argTypes = assign(
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filters out unused argTypes from the Pie primitive and
|
|
15
|
+
* overrides any defaults that have been changed in Donut
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(pieArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(shape|zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = pieArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Donut-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
innerRadius: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "number"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: "() => min([\nthis._width - this._margin.left - this._margin.right,\nthis._height - this._margin.top - this._margin.bottom\n]) / 4",
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
detail: "() => min([\nthis._width - this._margin.left - this._margin.right,\nthis._height - this._margin.top - this._margin.bottom\n]) / 4",
|
|
34
|
+
summary: "function"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
type: {
|
|
38
|
+
required: false,
|
|
39
|
+
summary: "function | number"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
padPixel: {
|
|
43
|
+
control: {
|
|
44
|
+
type: "number"
|
|
45
|
+
},
|
|
46
|
+
defaultValue: 2,
|
|
47
|
+
table: {
|
|
48
|
+
defaultValue: {
|
|
49
|
+
summary: 2
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
type: {
|
|
53
|
+
required: false,
|
|
54
|
+
summary: "number"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
@@ -0,0 +1,363 @@
|
|
|
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 {Geomap as D3plusGeomap} from "@d3plus/react";
|
|
9
|
+
export const Geomap = ({ config }) => <D3plusGeomap 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 Geomap
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(vizArgTypes)
|
|
18
|
+
.reduce((obj, k) => (obj[k] = vizArgTypes[k], obj), {}),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Geomap-specific methods
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
fitFilter: {
|
|
26
|
+
control: {
|
|
27
|
+
type: "number"
|
|
28
|
+
},
|
|
29
|
+
table: {
|
|
30
|
+
defaultValue: {
|
|
31
|
+
summary: "undefined"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
required: false,
|
|
36
|
+
summary: "number | string | array | function"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
fitKey: {
|
|
40
|
+
control: {
|
|
41
|
+
type: "text"
|
|
42
|
+
},
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: {
|
|
45
|
+
summary: "undefined"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
required: true,
|
|
50
|
+
summary: "string"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
fitObject: {
|
|
54
|
+
control: {
|
|
55
|
+
type: "object"
|
|
56
|
+
},
|
|
57
|
+
defaultValue: false,
|
|
58
|
+
description: "= `undefined`",
|
|
59
|
+
table: {
|
|
60
|
+
defaultValue: {
|
|
61
|
+
summary: false
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
type: {
|
|
65
|
+
required: true,
|
|
66
|
+
summary: "object | string"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
noDataMessage: {
|
|
70
|
+
control: {
|
|
71
|
+
type: "boolean"
|
|
72
|
+
},
|
|
73
|
+
defaultValue: false,
|
|
74
|
+
table: {
|
|
75
|
+
defaultValue: {
|
|
76
|
+
summary: false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
type: {
|
|
80
|
+
required: false,
|
|
81
|
+
summary: "boolean"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
ocean: {
|
|
85
|
+
control: {
|
|
86
|
+
type: "text"
|
|
87
|
+
},
|
|
88
|
+
defaultValue: "#d4dadc",
|
|
89
|
+
table: {
|
|
90
|
+
defaultValue: {
|
|
91
|
+
summary: "#d4dadc"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
type: {
|
|
95
|
+
required: false,
|
|
96
|
+
summary: "string"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
point: {
|
|
100
|
+
control: {
|
|
101
|
+
type: "array"
|
|
102
|
+
},
|
|
103
|
+
defaultValue: "d => d[\"point\"]",
|
|
104
|
+
table: {
|
|
105
|
+
defaultValue: {
|
|
106
|
+
detail: "d => d[\"point\"]",
|
|
107
|
+
summary: "function"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
type: {
|
|
111
|
+
required: false,
|
|
112
|
+
summary: "function | array"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
pointSize: {
|
|
116
|
+
control: {
|
|
117
|
+
type: "number"
|
|
118
|
+
},
|
|
119
|
+
defaultValue: 1,
|
|
120
|
+
table: {
|
|
121
|
+
defaultValue: {
|
|
122
|
+
summary: 1
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
type: {
|
|
126
|
+
required: false,
|
|
127
|
+
summary: "function | number"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
pointSizeMax: {
|
|
131
|
+
control: {
|
|
132
|
+
type: "number"
|
|
133
|
+
},
|
|
134
|
+
defaultValue: 10,
|
|
135
|
+
table: {
|
|
136
|
+
defaultValue: {
|
|
137
|
+
summary: 10
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
type: {
|
|
141
|
+
required: false,
|
|
142
|
+
summary: "number"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
pointSizeMin: {
|
|
146
|
+
control: {
|
|
147
|
+
type: "number"
|
|
148
|
+
},
|
|
149
|
+
defaultValue: 5,
|
|
150
|
+
table: {
|
|
151
|
+
defaultValue: {
|
|
152
|
+
summary: 5
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
type: {
|
|
156
|
+
required: false,
|
|
157
|
+
summary: "number"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
projection: {
|
|
161
|
+
control: {
|
|
162
|
+
type: "text"
|
|
163
|
+
},
|
|
164
|
+
defaultValue: "d3Geo.geoMercator()",
|
|
165
|
+
description: "= \"geoMercator\"",
|
|
166
|
+
table: {
|
|
167
|
+
defaultValue: {
|
|
168
|
+
summary: "d3Geo.geoMercator()"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
type: {
|
|
172
|
+
required: true,
|
|
173
|
+
summary: "function | string"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
projectionPadding: {
|
|
177
|
+
control: {
|
|
178
|
+
type: "number"
|
|
179
|
+
},
|
|
180
|
+
defaultValue: "parseSides(20)",
|
|
181
|
+
table: {
|
|
182
|
+
defaultValue: {
|
|
183
|
+
summary: "parseSides(20)"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
type: {
|
|
187
|
+
required: false,
|
|
188
|
+
summary: "number | string"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
projectionRotate: {
|
|
192
|
+
control: {
|
|
193
|
+
type: "array"
|
|
194
|
+
},
|
|
195
|
+
defaultValue: "[0, 0]",
|
|
196
|
+
table: {
|
|
197
|
+
defaultValue: {
|
|
198
|
+
summary: "[0, 0]"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
type: {
|
|
202
|
+
required: false,
|
|
203
|
+
summary: "array"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
shape: {
|
|
207
|
+
control: {
|
|
208
|
+
type: "text"
|
|
209
|
+
},
|
|
210
|
+
defaultValue: "Circle",
|
|
211
|
+
table: {
|
|
212
|
+
defaultValue: {
|
|
213
|
+
summary: "Circle"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
type: {
|
|
217
|
+
required: false,
|
|
218
|
+
summary: "function | string"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
shapeConfig: {
|
|
222
|
+
control: {
|
|
223
|
+
type: "object"
|
|
224
|
+
},
|
|
225
|
+
defaultValue: "assign(this._shapeConfig, {ariaLabel: (d, i) => `${this._drawLabel(d, i)}, ${this._pointSize(d, i)}`, hoverOpacity: 1, Path: {ariaLabel: (d, i) => {\n const validColorScale = this._colorScale ? `, ${this._colorScale(d, i)}` : \"\";\n return `${this._drawLabel(d, i)}${validColorScale}.`;\n}, fill: (d, i) => {\n if (this._colorScale && !this._coordData.features.includes(d)) {\n const c = this._colorScale(d);\n if (c !== undefined && c !== null) {\n if (this._colorScaleClass._colorScale) {\n return this._colorScaleClass._colorScale(c);\n } else {\n let color = this._colorScaleClass.color();\n if (color instanceof Array) color = color[color.length - 1];\n return color;\n }\n }\n }\n return this._topojsonFill(d, i);\n}, on: {mouseenter: (d, i, x, event) => !this._coordData.features.includes(d) ? this._on.mouseenter.bind(this)(d, i, x, event) : null, mousemove.shape: (d, i, x, event) => !this._coordData.features.includes(d) ? this._on.mousemove.shape.bind(this)(d, i, x, event) : null, mouseleave: (d, i, x, event) => !this._coordData.features.includes(d) ? this._on.mouseleave.bind(this)(d, i, x, event) : null}, stroke: (d, i) => {\n const c = typeof this._shapeConfig.Path.fill === \"function\" ? this._shapeConfig.Path.fill(d, i) : this._shapeConfig.Path.fill;\n return color(c).darker();\n}, strokeWidth: 1}})",
|
|
226
|
+
table: {
|
|
227
|
+
defaultValue: {
|
|
228
|
+
detail: "assign(this._shapeConfig, {ariaLabel: (d, i) => `${this._drawLabel(d, i)}, ${this._pointSize(d, i)}`, hoverOpacity: 1, Path: {ariaLabel: (d, i) => {\n const validColorScale = this._colorScale ? `, ${this._colorScale(d, i)}` : \"\";\n return `${this._drawLabel(d, i)}${validColorScale}.`;\n}, fill: (d, i) => {\n if (this._colorScale && !this._coordData.features.includes(d)) {\n const c = this._colorScale(d);\n if (c !== undefined && c !== null) {\n if (this._colorScaleClass._colorScale) {\n return this._colorScaleClass._colorScale(c);\n } else {\n let color = this._colorScaleClass.color();\n if (color instanceof Array) color = color[color.length - 1];\n return color;\n }\n }\n }\n return this._topojsonFill(d, i);\n}, on: {mouseenter: (d, i, x, event) => !this._coordData.features.includes(d) ? this._on.mouseenter.bind(this)(d, i, x, event) : null, mousemove.shape: (d, i, x, event) => !this._coordData.features.includes(d) ? this._on.mousemove.shape.bind(this)(d, i, x, event) : null, mouseleave: (d, i, x, event) => !this._coordData.features.includes(d) ? this._on.mouseleave.bind(this)(d, i, x, event) : null}, stroke: (d, i) => {\n const c = typeof this._shapeConfig.Path.fill === \"function\" ? this._shapeConfig.Path.fill(d, i) : this._shapeConfig.Path.fill;\n return color(c).darker();\n}, strokeWidth: 1}})",
|
|
229
|
+
summary: "function"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
type: {
|
|
233
|
+
required: false,
|
|
234
|
+
summary: "object"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
tileUrl: {
|
|
238
|
+
control: {
|
|
239
|
+
type: "text"
|
|
240
|
+
},
|
|
241
|
+
defaultValue: "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png",
|
|
242
|
+
table: {
|
|
243
|
+
defaultValue: {
|
|
244
|
+
summary: "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
type: {
|
|
248
|
+
required: false,
|
|
249
|
+
summary: "string"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
tiles: {
|
|
253
|
+
control: {
|
|
254
|
+
type: "boolean"
|
|
255
|
+
},
|
|
256
|
+
defaultValue: true,
|
|
257
|
+
table: {
|
|
258
|
+
defaultValue: {
|
|
259
|
+
summary: true
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
type: {
|
|
263
|
+
required: false,
|
|
264
|
+
summary: "boolean"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
topojson: {
|
|
268
|
+
control: {
|
|
269
|
+
type: "object"
|
|
270
|
+
},
|
|
271
|
+
defaultValue: false,
|
|
272
|
+
description: "= []",
|
|
273
|
+
table: {
|
|
274
|
+
defaultValue: {
|
|
275
|
+
summary: false
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
type: {
|
|
279
|
+
required: true,
|
|
280
|
+
summary: "object | string"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
topojsonFill: {
|
|
284
|
+
control: {
|
|
285
|
+
type: "text"
|
|
286
|
+
},
|
|
287
|
+
defaultValue: "#f5f5f3",
|
|
288
|
+
description: "= string",
|
|
289
|
+
table: {
|
|
290
|
+
defaultValue: {
|
|
291
|
+
summary: "#f5f5f3"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
type: {
|
|
295
|
+
required: true,
|
|
296
|
+
summary: "string | function"
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
topojsonFilter: {
|
|
300
|
+
control: {
|
|
301
|
+
type: "number"
|
|
302
|
+
},
|
|
303
|
+
defaultValue: "(d) => ![\n010\n].includes(d.id)",
|
|
304
|
+
table: {
|
|
305
|
+
defaultValue: {
|
|
306
|
+
detail: "(d) => ![\n010\n].includes(d.id)",
|
|
307
|
+
summary: "function"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
type: {
|
|
311
|
+
required: false,
|
|
312
|
+
summary: "number | string | array | function"
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
topojsonId: {
|
|
316
|
+
control: {
|
|
317
|
+
type: "text"
|
|
318
|
+
},
|
|
319
|
+
defaultValue: "d => d[\"id\"]",
|
|
320
|
+
description: "= \"id\"",
|
|
321
|
+
table: {
|
|
322
|
+
defaultValue: {
|
|
323
|
+
detail: "d => d[\"id\"]",
|
|
324
|
+
summary: "function"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
type: {
|
|
328
|
+
required: true,
|
|
329
|
+
summary: "string | function"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
topojsonKey: {
|
|
333
|
+
control: {
|
|
334
|
+
type: "text"
|
|
335
|
+
},
|
|
336
|
+
table: {
|
|
337
|
+
defaultValue: {
|
|
338
|
+
summary: "undefined"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
type: {
|
|
342
|
+
required: true,
|
|
343
|
+
summary: "string"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
zoom: {
|
|
347
|
+
control: {
|
|
348
|
+
type: "boolean"
|
|
349
|
+
},
|
|
350
|
+
defaultValue: true,
|
|
351
|
+
description: "= false",
|
|
352
|
+
table: {
|
|
353
|
+
defaultValue: {
|
|
354
|
+
summary: true
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
type: {
|
|
358
|
+
required: true,
|
|
359
|
+
summary: "boolean"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
);
|