@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,40 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Pack} from "../../../args/core/charts/Pack.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Pack",
|
|
12
|
+
component: Pack,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Uses the [d3 pack layout](https://github.com/d3/d3-hierarchy#pack) to creates Circle Packing chart based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Pack config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: [
|
|
31
|
+
{parent: "Group 1", id: "alpha", value: 29},
|
|
32
|
+
{parent: "Group 1", id: "beta", value: 10},
|
|
33
|
+
{parent: "Group 1", id: "gamma", value: 2},
|
|
34
|
+
{parent: "Group 2", id: "delta", value: 29},
|
|
35
|
+
{parent: "Group 2", id: "eta", value: 25}
|
|
36
|
+
],
|
|
37
|
+
groupBy: ["parent", "id"],
|
|
38
|
+
sum: funcify(d => d.value, "d => d.value")
|
|
39
|
+
};
|
|
40
|
+
BasicExample.parameters = {controls: {include: ["sum"]}};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Pie} from "../../../args/core/charts/Pie.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Pie",
|
|
12
|
+
component: Pie,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Uses the [d3 pie layout](https://github.com/d3/d3-shape#pies) to creates SVG arcs based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Pie config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: [
|
|
31
|
+
{Type: "Apple pie", Percentage: 30},
|
|
32
|
+
{Type: "Butter pie", Percentage: 20},
|
|
33
|
+
{Type: "Cherry pie", Percentage: 25},
|
|
34
|
+
{Type: "Lemon pie", Percentage: 15},
|
|
35
|
+
{Type: "Sugar pie", Percentage: 10}
|
|
36
|
+
],
|
|
37
|
+
groupBy: "Type",
|
|
38
|
+
value: "Percentage"
|
|
39
|
+
};
|
|
40
|
+
BasicExample.parameters = {controls: {include: ["value"]}};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Plot} from "../../../args/core/charts/Plot.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Plot",
|
|
12
|
+
component: Plot,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates an x/y plot based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Plot config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: [
|
|
31
|
+
{id: "alpha", x: 4, y: 7},
|
|
32
|
+
{id: "beta", x: 5, y: 2},
|
|
33
|
+
{id: "gamma", x: 6, y: 13},
|
|
34
|
+
{id: "delta", x: 2, y: 11},
|
|
35
|
+
{id: "epsilon", x: 5, y: 5},
|
|
36
|
+
{id: "zeta", x: 3, y: 4},
|
|
37
|
+
{id: "eta", x: 2.5, y: 6},
|
|
38
|
+
{id: "theta", x: 5.5, y: 9}
|
|
39
|
+
],
|
|
40
|
+
groupBy: "id",
|
|
41
|
+
x: "x",
|
|
42
|
+
y: "y"
|
|
43
|
+
};
|
|
44
|
+
BasicExample.parameters = {controls: {include: ["x", "y"]}};
|
|
45
|
+
|
|
46
|
+
export const BubbleChart = Template.bind({});
|
|
47
|
+
BubbleChart.args = {
|
|
48
|
+
data: [
|
|
49
|
+
{id: "alpha", x: 4, y: 7, value: 240},
|
|
50
|
+
{id: "beta", x: 5, y: 2, value: 120},
|
|
51
|
+
{id: "gamma", x: 6, y: 13, value: 180}
|
|
52
|
+
],
|
|
53
|
+
groupBy: "id",
|
|
54
|
+
size: "value",
|
|
55
|
+
sizeMax: 90,
|
|
56
|
+
sizeMin: 20,
|
|
57
|
+
x: "x",
|
|
58
|
+
y: "y"
|
|
59
|
+
};
|
|
60
|
+
BubbleChart.parameters = {controls: {include: ["size", "sizeMax", "sizeMin"]}};
|
|
61
|
+
|
|
62
|
+
export const ShapeBackgroundImages = Template.bind({});
|
|
63
|
+
ShapeBackgroundImages.args = {
|
|
64
|
+
data: "https://oec.world/api/gdp/eci?Year=2019&x=OEC.ECI&y=NY.GDP.MKTP.CD",
|
|
65
|
+
groupBy: "Country",
|
|
66
|
+
shapeConfig: {
|
|
67
|
+
Circle: {
|
|
68
|
+
backgroundImage: funcify(
|
|
69
|
+
d => `https://oec.world/images/icons/country/country_${d["Country ID"].slice(2,5)}_circle.png`,
|
|
70
|
+
"d => `https://oec.world/images/icons/country/country_${d['Country ID'].slice(2,5)}_circle.png`"
|
|
71
|
+
),
|
|
72
|
+
label: funcify(
|
|
73
|
+
() => "",
|
|
74
|
+
"() => ''"
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
size: "Trade Value",
|
|
79
|
+
sizeMax: 50,
|
|
80
|
+
x: "ECI",
|
|
81
|
+
y: "Measure"
|
|
82
|
+
};
|
|
83
|
+
ShapeBackgroundImages.parameters = {controls: {include: ["shapeConfig", "size", "sizeMax"]}};
|
|
84
|
+
|
|
85
|
+
export const TrendlineUsingAnnotations = Template.bind()
|
|
86
|
+
TrendlineUsingAnnotations.args = {
|
|
87
|
+
data: "https://datausa.io/api/data?measures=Adult%20Obesity,Average%20Commute%20Time&drilldowns=State&year=2022",
|
|
88
|
+
dataFormat: funcify(
|
|
89
|
+
resp => resp.data.filter(d => d["ID State"] !== "04000US72"),
|
|
90
|
+
'resp => resp.data.filter(d => d["ID State"] !== "04000US72")'
|
|
91
|
+
),
|
|
92
|
+
groupBy: "State",
|
|
93
|
+
annotations: [
|
|
94
|
+
{
|
|
95
|
+
data: [
|
|
96
|
+
{
|
|
97
|
+
"id": "Trend",
|
|
98
|
+
"x": 16,
|
|
99
|
+
"y": 0.4
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "Trend",
|
|
103
|
+
"x": 34,
|
|
104
|
+
"y": 0.25
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "Baseline",
|
|
108
|
+
"x": 16,
|
|
109
|
+
"y": 0.3
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "Baseline",
|
|
113
|
+
"x": 34,
|
|
114
|
+
"y": 0.3
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
shape: "Line",
|
|
118
|
+
stroke: funcify(
|
|
119
|
+
d => d["id"] === "Trend" ? "#6A994E" : "#c3c3c3",
|
|
120
|
+
"d => d['id'] === 'Trend' ? '#6A994E' : '#c3c3c3'"
|
|
121
|
+
),
|
|
122
|
+
strokeDasharray: "10",
|
|
123
|
+
strokeWidth: 2
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
x: "Average Commute Time",
|
|
127
|
+
y: "Adult Obesity"
|
|
128
|
+
};
|
|
129
|
+
TrendlineUsingAnnotations.parameters = {controls: {include: ["annotations"]}};
|
|
130
|
+
|
|
131
|
+
export const MultipleShapes = Template.bind({});
|
|
132
|
+
MultipleShapes.args = {
|
|
133
|
+
data: [
|
|
134
|
+
{"value": 100, "weight": .45, "name": "alpha"},
|
|
135
|
+
{"value": 70, "weight": .60, "name": "beta"},
|
|
136
|
+
{"value": 40, "weight": -.2, "name": "gamma"},
|
|
137
|
+
{"value": 15, "weight": .1, "name": "delta"},
|
|
138
|
+
{"value": 5, "weight": -.43, "name": "epsilon"},
|
|
139
|
+
{"value": 1, "weight": 0, "name": "zeta"}
|
|
140
|
+
],
|
|
141
|
+
groupBy: "name",
|
|
142
|
+
shape: funcify(
|
|
143
|
+
d => (d.name === "alpha" || d.name === "delta" || d.name === "epsilon") ? "Rect" : "Circle",
|
|
144
|
+
`d => (d.name === "alpha" || d.name === "delta" || d.name === "epsilon") ? "Rect" : "Circle"`
|
|
145
|
+
),
|
|
146
|
+
size: "value",
|
|
147
|
+
x: "value",
|
|
148
|
+
y: "weight"
|
|
149
|
+
};
|
|
150
|
+
MultipleShapes.parameters = {controls: {include: ["shape"]}};
|
|
151
|
+
|
|
152
|
+
export const SortingShapes = Template.bind({});
|
|
153
|
+
SortingShapes.args = {
|
|
154
|
+
data: [
|
|
155
|
+
{id: "alpha", time: 4, value: 240},
|
|
156
|
+
{id: "beta", time: 5, value: 120},
|
|
157
|
+
{id: "gamma", time: 6, value: 180},
|
|
158
|
+
{id: "delta", time: 4, value: 240},
|
|
159
|
+
{id: "delta", time: 5, value: 120},
|
|
160
|
+
{id: "delta", time: 6, value: 180}
|
|
161
|
+
],
|
|
162
|
+
groupBy: "id",
|
|
163
|
+
shape: funcify(
|
|
164
|
+
d => d.id === "delta" ? "Line" : "Circle",
|
|
165
|
+
`d => d.id === "delta" ? "Line" : "Circle"`
|
|
166
|
+
),
|
|
167
|
+
shapeConfig: {
|
|
168
|
+
Line: {
|
|
169
|
+
strokeLinecap: "round",
|
|
170
|
+
strokeWidth: 5
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
shapeSort: funcify(
|
|
174
|
+
(a, b) => ["Circle", "Line"].indexOf(b) - ["Circle", "Line"].indexOf(a),
|
|
175
|
+
"(a, b) => ['Circle', 'Line'].indexOf(b) - ['Circle', 'Line'].indexOf(a)"),
|
|
176
|
+
sizeMin: 20,
|
|
177
|
+
x: "time",
|
|
178
|
+
y: "value"
|
|
179
|
+
};
|
|
180
|
+
SortingShapes.parameters = {controls: {include: ["shapeSort"]}};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Priestley} from "../../../args/core/charts/Priestley.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Priestley",
|
|
12
|
+
component: Priestley,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates a priestley timeline based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Priestley config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: [
|
|
31
|
+
{element: "alpha", birth: 2004, death: 2007},
|
|
32
|
+
{element: "epsilon", birth: 2007, death: 2012},
|
|
33
|
+
{element: "beta", birth: 2005, death: 2010}
|
|
34
|
+
],
|
|
35
|
+
end: "death",
|
|
36
|
+
groupBy: "element",
|
|
37
|
+
start: "birth"
|
|
38
|
+
};
|
|
39
|
+
BasicExample.parameters = {controls: {include: ["end", "start"]}};
|
|
40
|
+
|
|
41
|
+
export const GroupingBarsIntoLanes = Template.bind({});
|
|
42
|
+
GroupingBarsIntoLanes.args = {
|
|
43
|
+
data: [
|
|
44
|
+
{parent: "Group 1", id: "alpha", start: 2004, end: 2007},
|
|
45
|
+
{parent: "Group 2", id: "epsilon", start: 2007, end: 2012},
|
|
46
|
+
{parent: "Group 1", id: "beta", start: 2005, end: 2010},
|
|
47
|
+
{parent: "Group 1", id: "gamma", start: 2008, end: 2013},
|
|
48
|
+
{parent: "Group 2", id: "delta", start: 2004, end: 2007}
|
|
49
|
+
],
|
|
50
|
+
end: "death",
|
|
51
|
+
groupBy: ["parent", "id"],
|
|
52
|
+
shapeConfig: {
|
|
53
|
+
fill: funcify(
|
|
54
|
+
d => d.parent === "Group 1" ? "firebrick" : "cornflowerblue",
|
|
55
|
+
`d => d.parent === "Group 1" ? "firebrick" : "cornflowerblue"`
|
|
56
|
+
)
|
|
57
|
+
},
|
|
58
|
+
start: "birth"
|
|
59
|
+
};
|
|
60
|
+
GroupingBarsIntoLanes.parameters = {controls: {include: ["groupBy", "shapeConfig"]}};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Radar} from "../../../args/core/charts/Radar.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Radar",
|
|
12
|
+
component: Radar,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates a radar visualization based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Radar config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: [
|
|
31
|
+
{element: "alpha", birth: 2004, death: 2007},
|
|
32
|
+
{element: "epsilon", birth: 2007, death: 2012},
|
|
33
|
+
{element: "beta", birth: 2005, death: 2010}
|
|
34
|
+
],
|
|
35
|
+
end: "death",
|
|
36
|
+
groupBy: "element",
|
|
37
|
+
start: "birth"
|
|
38
|
+
};
|
|
39
|
+
BasicExample.parameters = {controls: {include: ["end", "start"]}};
|
|
40
|
+
|
|
41
|
+
export const GroupingBarsIntoLanes = Template.bind({});
|
|
42
|
+
GroupingBarsIntoLanes.args = {
|
|
43
|
+
data: [
|
|
44
|
+
{parent: "Group 1", id: "alpha", start: 2004, end: 2007},
|
|
45
|
+
{parent: "Group 2", id: "epsilon", start: 2007, end: 2012},
|
|
46
|
+
{parent: "Group 1", id: "beta", start: 2005, end: 2010},
|
|
47
|
+
{parent: "Group 1", id: "gamma", start: 2008, end: 2013},
|
|
48
|
+
{parent: "Group 2", id: "delta", start: 2004, end: 2007}
|
|
49
|
+
],
|
|
50
|
+
end: "death",
|
|
51
|
+
groupBy: ["parent", "id"],
|
|
52
|
+
shapeConfig: {
|
|
53
|
+
fill: funcify(
|
|
54
|
+
d => d.parent === "Group 1" ? "firebrick" : "cornflowerblue",
|
|
55
|
+
`d => d.parent === "Group 1" ? "firebrick" : "cornflowerblue"`
|
|
56
|
+
)
|
|
57
|
+
},
|
|
58
|
+
start: "birth"
|
|
59
|
+
};
|
|
60
|
+
GroupingBarsIntoLanes.parameters = {controls: {include: ["groupBy", "shapeConfig"]}};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, RadialMatrix} from "../../../args/core/charts/RadialMatrix.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/RadialMatrix",
|
|
12
|
+
component: RadialMatrix,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates a radial layout of a rows/columns Matrix of any dataset. See [this example](https://d3plus.org/examples/d3plus-matrix/radial-matrix/) for help getting started using the Matrix class.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <RadialMatrix config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: "https://api.oec.world/tesseract/data.jsonrecords?cube=trade_i_baci_a_17&drilldowns=Year,Exporter+Continent,Importer+Continent&measures=Trade+Value&Year=2018",
|
|
31
|
+
groupBy: ["Exporter Continent", "Importer Continent"],
|
|
32
|
+
column: "Importer Continent",
|
|
33
|
+
row: "Exporter Continent",
|
|
34
|
+
colorScale: "Trade Value"
|
|
35
|
+
};
|
|
36
|
+
BasicExample.parameters = {controls: {include: ["column", "row"]}};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Rings} from "../../../args/core/charts/Rings.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Rings",
|
|
12
|
+
component: Rings,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates a ring visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/simple-rings/) for help getting started using the Rings class.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Rings config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
center: "alpha",
|
|
31
|
+
links: [
|
|
32
|
+
{source: "alpha", target: "beta"},
|
|
33
|
+
{source: "alpha", target: "gamma"},
|
|
34
|
+
{source: "beta", target: "delta"},
|
|
35
|
+
{source: "beta", target: "epsilon"},
|
|
36
|
+
{source: "zeta", target: "gamma"},
|
|
37
|
+
{source: "theta", target: "gamma"},
|
|
38
|
+
{source: "eta", target: "gamma"}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
BasicExample.parameters = {controls: {include: ["center", "links"]}};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Sankey} from "../../../args/core/charts/Sankey.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Sankey",
|
|
12
|
+
component: Sankey,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates a sankey visualization based on a defined set of nodes and links. [Click here](http://d3plus.org/examples/d3plus-network/sankey-diagram/) for help getting started using the Sankey class.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Sankey config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
center: "alpha",
|
|
31
|
+
links: [
|
|
32
|
+
{source: "alpha", target: "beta"},
|
|
33
|
+
{source: "alpha", target: "gamma"},
|
|
34
|
+
{source: "beta", target: "delta"},
|
|
35
|
+
{source: "beta", target: "epsilon"},
|
|
36
|
+
{source: "zeta", target: "gamma"},
|
|
37
|
+
{source: "theta", target: "gamma"},
|
|
38
|
+
{source: "eta", target: "gamma"}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
BasicExample.parameters = {controls: {include: ["center", "links"]}};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, StackedArea} from "../../../args/core/charts/StackedArea.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/StackedArea",
|
|
12
|
+
component: StackedArea,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Creates a stacked area plot based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <StackedArea config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|
|
28
|
+
export const BasicExample = Template.bind({});
|
|
29
|
+
BasicExample.args = {
|
|
30
|
+
data: [
|
|
31
|
+
{id: "alpha", x: 4, y: 7},
|
|
32
|
+
{id: "alpha", x: 5, y: 25},
|
|
33
|
+
{id: "alpha", x: 6, y: 13},
|
|
34
|
+
{id: "beta", x: 4, y: 17},
|
|
35
|
+
{id: "beta", x: 5, y: 8},
|
|
36
|
+
{id: "beta", x: 6, y: 13}
|
|
37
|
+
],
|
|
38
|
+
groupBy: "id",
|
|
39
|
+
x: "x",
|
|
40
|
+
y: "y"
|
|
41
|
+
};
|
|
42
|
+
BasicExample.parameters = {controls: {include: ["x", "y"]}};
|
|
43
|
+
|
|
44
|
+
export const HorizontalChart = Template.bind({});
|
|
45
|
+
HorizontalChart.args = {
|
|
46
|
+
data: [
|
|
47
|
+
{id: "alpha", x: 7, y: 4},
|
|
48
|
+
{id: "alpha", x: 25, y: 5},
|
|
49
|
+
{id: "alpha", x: 13, y: 6},
|
|
50
|
+
{id: "beta", x: 17, y: 4},
|
|
51
|
+
{id: "beta", x: 8, y: 5},
|
|
52
|
+
{id: "beta", x: 13, y: 6}
|
|
53
|
+
],
|
|
54
|
+
discrete: "y",
|
|
55
|
+
groupBy: "id",
|
|
56
|
+
x: "x",
|
|
57
|
+
y: "y"
|
|
58
|
+
};
|
|
59
|
+
HorizontalChart.parameters = {controls: {include: ["discrete"]}};
|
|
60
|
+
|
|
61
|
+
export const SharePercentages = Template.bind({});
|
|
62
|
+
SharePercentages.args = {
|
|
63
|
+
data: [
|
|
64
|
+
{id: "alpha", x: 4, y: 7},
|
|
65
|
+
{id: "alpha", x: 5, y: 25},
|
|
66
|
+
{id: "alpha", x: 6, y: 13},
|
|
67
|
+
{id: "beta", x: 4, y: 17},
|
|
68
|
+
{id: "beta", x: 5, y: 8},
|
|
69
|
+
{id: "beta", x: 6, y: 13},
|
|
70
|
+
{id: "gamma", x: 4, y: 10},
|
|
71
|
+
{id: "gamma", x: 5, y: 18},
|
|
72
|
+
{id: "gamma", x: 6, y: 5}
|
|
73
|
+
],
|
|
74
|
+
groupBy: "id",
|
|
75
|
+
stackOffset: "expand",
|
|
76
|
+
x: "x",
|
|
77
|
+
y: "y",
|
|
78
|
+
yConfig: {
|
|
79
|
+
tickFormat: funcify(
|
|
80
|
+
d => `${formatAbbreviate(d * 100)}%`,
|
|
81
|
+
"d => `${formatAbbreviate(d * 100)}%`")
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
SharePercentages.parameters = {controls: {include: ["stackOffset", "yConfig"]}};
|
|
85
|
+
|
|
86
|
+
export const SortingAreas = Template.bind({});
|
|
87
|
+
SortingAreas.args = {
|
|
88
|
+
data: [
|
|
89
|
+
{id: "alpha", x: 4, y: 7},
|
|
90
|
+
{id: "alpha", x: 5, y: 25},
|
|
91
|
+
{id: "alpha", x: 6, y: 13},
|
|
92
|
+
{id: "beta", x: 4, y: 17},
|
|
93
|
+
{id: "beta", x: 5, y: 8},
|
|
94
|
+
{id: "beta", x: 6, y: 13},
|
|
95
|
+
{id: "gamma", x: 4, y: 10},
|
|
96
|
+
{id: "gamma", x: 5, y: 18},
|
|
97
|
+
{id: "gamma", x: 6, y: 5},
|
|
98
|
+
{id: "delta", x: 4, y: 8},
|
|
99
|
+
{id: "delta", x: 5, y: 12},
|
|
100
|
+
{id: "delta", x: 6, y: 7}
|
|
101
|
+
],
|
|
102
|
+
groupBy: "id",
|
|
103
|
+
stackOrder: ["alpha", "gamma", "delta", "beta"],
|
|
104
|
+
x: "x",
|
|
105
|
+
y: "y"
|
|
106
|
+
};
|
|
107
|
+
SortingAreas.parameters = {controls: {include: ["stackOrder"]}};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// WARNING: do not edit the top part of this file directly, it is generated
|
|
2
|
+
// from the source code. Scroll down to the next WARNING and places stories below it.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {argTypes, Tree} from "../../../args/core/charts/Tree.args";
|
|
7
|
+
import configify from "../../../helpers/configify";
|
|
8
|
+
import funcify from "../../../helpers/funcify";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Core/Charts/Tree",
|
|
12
|
+
component: Tree,
|
|
13
|
+
argTypes,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "Uses d3's [tree layout](https://github.com/d3/d3-hierarchy#tree) to create a tidy tree chart based on an array of data.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => <Tree config={configify(args, argTypes)} />;
|
|
24
|
+
|
|
25
|
+
// WARNING: do not edit above this line of code directly, it is generated
|
|
26
|
+
// from the source code. Stories below this line can be modified.
|
|
27
|
+
|