@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.
Files changed (225) hide show
  1. package/.storybook/main.js +51 -0
  2. package/.storybook/manager-head.html +46 -0
  3. package/.storybook/manager.js +10 -0
  4. package/.storybook/preview-head.html +69 -0
  5. package/.storybook/preview.jsx +134 -0
  6. package/.storybook/theme.js +16 -0
  7. package/README.md +1 -0
  8. package/args/color/colorAdd.args.jsx +71 -0
  9. package/args/color/colorAssign.args.jsx +40 -0
  10. package/args/color/colorContrast.args.jsx +40 -0
  11. package/args/color/colorDefaults.args.jsx +8 -0
  12. package/args/color/colorLegible.args.jsx +24 -0
  13. package/args/color/colorLighter.args.jsx +40 -0
  14. package/args/color/colorSubtract.args.jsx +71 -0
  15. package/args/core/charts/AreaPlot.args.jsx +72 -0
  16. package/args/core/charts/BarChart.args.jsx +88 -0
  17. package/args/core/charts/BoxWhisker.args.jsx +73 -0
  18. package/args/core/charts/BumpChart.args.jsx +133 -0
  19. package/args/core/charts/Donut.args.jsx +58 -0
  20. package/args/core/charts/Geomap.args.jsx +363 -0
  21. package/args/core/charts/LinePlot.args.jsx +57 -0
  22. package/args/core/charts/Matrix.args.jsx +194 -0
  23. package/args/core/charts/Network.args.jsx +310 -0
  24. package/args/core/charts/Pack.args.jsx +171 -0
  25. package/args/core/charts/Pie.args.jsx +148 -0
  26. package/args/core/charts/Plot.args.jsx +685 -0
  27. package/args/core/charts/Priestley.args.jsx +118 -0
  28. package/args/core/charts/Radar.args.jsx +120 -0
  29. package/args/core/charts/RadialMatrix.args.jsx +197 -0
  30. package/args/core/charts/Rings.args.jsx +228 -0
  31. package/args/core/charts/Sankey.args.jsx +248 -0
  32. package/args/core/charts/StackedArea.args.jsx +26 -0
  33. package/args/core/charts/Tree.args.jsx +88 -0
  34. package/args/core/charts/Treemap.args.jsx +181 -0
  35. package/args/core/charts/Viz.args.jsx +1383 -0
  36. package/args/core/components/Axis.args.jsx +600 -0
  37. package/args/core/components/AxisBottom.args.jsx +42 -0
  38. package/args/core/components/AxisLeft.args.jsx +42 -0
  39. package/args/core/components/AxisRight.args.jsx +42 -0
  40. package/args/core/components/AxisTop.args.jsx +42 -0
  41. package/args/core/components/ColorScale.args.jsx +456 -0
  42. package/args/core/components/Legend.args.jsx +289 -0
  43. package/args/core/components/TextBox.args.jsx +554 -0
  44. package/args/core/components/Timeline.args.jsx +401 -0
  45. package/args/core/components/Tooltip.args.jsx +453 -0
  46. package/args/core/shapes/Area.args.jsx +190 -0
  47. package/args/core/shapes/Bar.args.jsx +176 -0
  48. package/args/core/shapes/Box.args.jsx +248 -0
  49. package/args/core/shapes/Circle.args.jsx +84 -0
  50. package/args/core/shapes/Image.args.jsx +177 -0
  51. package/args/core/shapes/Line.args.jsx +127 -0
  52. package/args/core/shapes/Path.args.jsx +84 -0
  53. package/args/core/shapes/Rect.args.jsx +85 -0
  54. package/args/core/shapes/Shape.args.jsx +633 -0
  55. package/args/core/shapes/Whisker.args.jsx +204 -0
  56. package/args/core/utils/BaseClass.args.jsx +65 -0
  57. package/args/core/utils/RESET.args.jsx +8 -0
  58. package/args/core/utils/accessor.args.jsx +39 -0
  59. package/args/core/utils/configPrep.args.jsx +56 -0
  60. package/args/core/utils/constant.args.jsx +24 -0
  61. package/args/core/utils/uuid.args.jsx +8 -0
  62. package/args/data/dataConcat.args.jsx +40 -0
  63. package/args/data/dataFold.args.jsx +56 -0
  64. package/args/data/dataLoad.args.jsx +65 -0
  65. package/args/data/isData.args.jsx +24 -0
  66. package/args/data/merge.args.jsx +39 -0
  67. package/args/data/unique.args.jsx +37 -0
  68. package/args/dom/assign.args.jsx +23 -0
  69. package/args/dom/attrize.args.jsx +39 -0
  70. package/args/dom/date.args.jsx +23 -0
  71. package/args/dom/elem.args.jsx +135 -0
  72. package/args/dom/fontExists.args.jsx +24 -0
  73. package/args/dom/htmlDecode.args.jsx +23 -0
  74. package/args/dom/isObject.args.jsx +23 -0
  75. package/args/dom/parseSides.args.jsx +24 -0
  76. package/args/dom/prefix.args.jsx +8 -0
  77. package/args/dom/rtl.args.jsx +8 -0
  78. package/args/dom/stylize.args.jsx +39 -0
  79. package/args/dom/textWidth.args.jsx +39 -0
  80. package/args/export/saveElement.args.jsx +99 -0
  81. package/args/format/format.args.jsx +24 -0
  82. package/args/format/formatAbbreviate.args.jsx +39 -0
  83. package/args/format/formatDate.args.jsx +53 -0
  84. package/args/format/formatDefaultLocale.args.jsx +24 -0
  85. package/args/locales/dictionaries/formatLocale.args.jsx +8 -0
  86. package/args/math/closest.args.jsx +39 -0
  87. package/args/math/largestRect.args.jsx +56 -0
  88. package/args/math/lineIntersection.args.jsx +69 -0
  89. package/args/math/path2polygon.args.jsx +40 -0
  90. package/args/math/pointDistance.args.jsx +39 -0
  91. package/args/math/pointDistanceSquared.args.jsx +39 -0
  92. package/args/math/pointRotate.args.jsx +55 -0
  93. package/args/math/polygonInside.args.jsx +39 -0
  94. package/args/math/polygonRayCast.args.jsx +55 -0
  95. package/args/math/polygonRotate.args.jsx +55 -0
  96. package/args/math/segmentBoxContains.args.jsx +54 -0
  97. package/args/math/segmentsIntersect.args.jsx +69 -0
  98. package/args/math/shapeEdgePoint.args.jsx +39 -0
  99. package/args/react/D3plusContext.args.jsx +8 -0
  100. package/args/react/Renderer.args.jsx +53 -0
  101. package/args/text/fontFamily.args.jsx +8 -0
  102. package/args/text/fontFamilyStringify.args.jsx +23 -0
  103. package/args/text/stringify.args.jsx +23 -0
  104. package/args/text/strip.args.jsx +38 -0
  105. package/args/text/textSplit.args.jsx +23 -0
  106. package/args/text/textWrap.args.jsx +8 -0
  107. package/args/text/titleCase.args.jsx +24 -0
  108. package/args/text/trim.args.jsx +23 -0
  109. package/args/text/trimLeft.args.jsx +23 -0
  110. package/args/text/trimRight.args.jsx +23 -0
  111. package/docs/Accessibility.mdx +70 -0
  112. package/docs/HomeChart.jsx +38 -0
  113. package/docs/Introduction.mdx +130 -0
  114. package/docs/Logo-Frames.js +352 -0
  115. package/docs/Logo.jsx +30 -0
  116. package/helpers/configify.js +18 -0
  117. package/helpers/funcify.js +14 -0
  118. package/helpers/stringify.js +30 -0
  119. package/package.json +44 -0
  120. package/packages/color/colorAdd.stories.jsx +23 -0
  121. package/packages/color/colorAssign.stories.jsx +23 -0
  122. package/packages/color/colorContrast.stories.jsx +23 -0
  123. package/packages/color/colorDefaults.stories.jsx +23 -0
  124. package/packages/color/colorLegible.stories.jsx +23 -0
  125. package/packages/color/colorLighter.stories.jsx +23 -0
  126. package/packages/color/colorSubtract.stories.jsx +23 -0
  127. package/packages/core/charts/AreaPlot.stories.jsx +74 -0
  128. package/packages/core/charts/BarChart.stories.jsx +307 -0
  129. package/packages/core/charts/BoxWhisker.stories.jsx +204 -0
  130. package/packages/core/charts/BumpChart.stories.jsx +52 -0
  131. package/packages/core/charts/Donut.stories.jsx +41 -0
  132. package/packages/core/charts/Geomap.stories.jsx +186 -0
  133. package/packages/core/charts/LinePlot.stories.jsx +564 -0
  134. package/packages/core/charts/Matrix.stories.jsx +36 -0
  135. package/packages/core/charts/Network.stories.jsx +99 -0
  136. package/packages/core/charts/Pack.stories.jsx +40 -0
  137. package/packages/core/charts/Pie.stories.jsx +40 -0
  138. package/packages/core/charts/Plot.stories.jsx +180 -0
  139. package/packages/core/charts/Priestley.stories.jsx +60 -0
  140. package/packages/core/charts/Radar.stories.jsx +60 -0
  141. package/packages/core/charts/RadialMatrix.stories.jsx +36 -0
  142. package/packages/core/charts/Rings.stories.jsx +41 -0
  143. package/packages/core/charts/Sankey.stories.jsx +41 -0
  144. package/packages/core/charts/StackedArea.stories.jsx +107 -0
  145. package/packages/core/charts/Tree.stories.jsx +27 -0
  146. package/packages/core/charts/Treemap.stories.jsx +81 -0
  147. package/packages/core/charts/Viz.stories.jsx +27 -0
  148. package/packages/core/components/Axis.stories.jsx +27 -0
  149. package/packages/core/components/AxisBottom.stories.jsx +27 -0
  150. package/packages/core/components/AxisLeft.stories.jsx +27 -0
  151. package/packages/core/components/AxisRight.stories.jsx +27 -0
  152. package/packages/core/components/AxisTop.stories.jsx +27 -0
  153. package/packages/core/components/ColorScale.stories.jsx +44 -0
  154. package/packages/core/components/Legend.stories.jsx +49 -0
  155. package/packages/core/components/TextBox.stories.jsx +222 -0
  156. package/packages/core/components/Timeline.stories.jsx +37 -0
  157. package/packages/core/components/Tooltip.stories.jsx +40 -0
  158. package/packages/core/shapes/Area.stories.jsx +27 -0
  159. package/packages/core/shapes/Bar.stories.jsx +27 -0
  160. package/packages/core/shapes/Box.stories.jsx +27 -0
  161. package/packages/core/shapes/Circle.stories.jsx +27 -0
  162. package/packages/core/shapes/Image.stories.jsx +27 -0
  163. package/packages/core/shapes/Line.stories.jsx +27 -0
  164. package/packages/core/shapes/Path.stories.jsx +27 -0
  165. package/packages/core/shapes/Rect.stories.jsx +27 -0
  166. package/packages/core/shapes/Shape.stories.jsx +27 -0
  167. package/packages/core/shapes/Whisker.stories.jsx +27 -0
  168. package/packages/core/utils/BaseClass.stories.jsx +27 -0
  169. package/packages/core/utils/RESET.stories.jsx +23 -0
  170. package/packages/core/utils/accessor.stories.jsx +23 -0
  171. package/packages/core/utils/configPrep.stories.jsx +23 -0
  172. package/packages/core/utils/constant.stories.jsx +23 -0
  173. package/packages/core/utils/uuid.stories.jsx +23 -0
  174. package/packages/data/dataConcat.stories.jsx +23 -0
  175. package/packages/data/dataFold.stories.jsx +23 -0
  176. package/packages/data/dataLoad.stories.jsx +23 -0
  177. package/packages/data/isData.stories.jsx +23 -0
  178. package/packages/data/merge.stories.jsx +23 -0
  179. package/packages/data/unique.stories.jsx +23 -0
  180. package/packages/dom/assign.stories.jsx +23 -0
  181. package/packages/dom/attrize.stories.jsx +23 -0
  182. package/packages/dom/date.stories.jsx +23 -0
  183. package/packages/dom/elem.stories.jsx +23 -0
  184. package/packages/dom/fontExists.stories.jsx +23 -0
  185. package/packages/dom/htmlDecode.stories.jsx +23 -0
  186. package/packages/dom/isObject.stories.jsx +23 -0
  187. package/packages/dom/parseSides.stories.jsx +23 -0
  188. package/packages/dom/prefix.stories.jsx +23 -0
  189. package/packages/dom/rtl.stories.jsx +23 -0
  190. package/packages/dom/stylize.stories.jsx +23 -0
  191. package/packages/dom/textWidth.stories.jsx +23 -0
  192. package/packages/export/saveElement.stories.jsx +23 -0
  193. package/packages/format/format.stories.jsx +23 -0
  194. package/packages/format/formatAbbreviate.stories.jsx +23 -0
  195. package/packages/format/formatDate.stories.jsx +23 -0
  196. package/packages/format/formatDefaultLocale.stories.jsx +23 -0
  197. package/packages/locales/dictionaries/formatLocale.stories.jsx +23 -0
  198. package/packages/math/closest.stories.jsx +23 -0
  199. package/packages/math/largestRect.stories.jsx +23 -0
  200. package/packages/math/lineIntersection.stories.jsx +23 -0
  201. package/packages/math/path2polygon.stories.jsx +23 -0
  202. package/packages/math/pointDistance.stories.jsx +23 -0
  203. package/packages/math/pointDistanceSquared.stories.jsx +23 -0
  204. package/packages/math/pointRotate.stories.jsx +23 -0
  205. package/packages/math/polygonInside.stories.jsx +23 -0
  206. package/packages/math/polygonRayCast.stories.jsx +23 -0
  207. package/packages/math/polygonRotate.stories.jsx +23 -0
  208. package/packages/math/segmentBoxContains.stories.jsx +23 -0
  209. package/packages/math/segmentsIntersect.stories.jsx +23 -0
  210. package/packages/math/shapeEdgePoint.stories.jsx +23 -0
  211. package/packages/react/D3plusContext.stories.jsx +23 -0
  212. package/packages/react/Renderer.stories.jsx +23 -0
  213. package/packages/text/fontFamily.stories.jsx +23 -0
  214. package/packages/text/fontFamilyStringify.stories.jsx +23 -0
  215. package/packages/text/stringify.stories.jsx +23 -0
  216. package/packages/text/strip.stories.jsx +23 -0
  217. package/packages/text/textSplit.stories.jsx +23 -0
  218. package/packages/text/textWrap.stories.jsx +23 -0
  219. package/packages/text/titleCase.stories.jsx +23 -0
  220. package/packages/text/trim.stories.jsx +23 -0
  221. package/packages/text/trimLeft.stories.jsx +23 -0
  222. package/packages/text/trimRight.stories.jsx +23 -0
  223. package/static/data/city_coords.json +224 -0
  224. package/static/images/favicon.ico +0 -0
  225. package/static/images/touchicon.png +0 -0
@@ -0,0 +1,564 @@
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, LinePlot} from "../../../args/core/charts/LinePlot.args";
7
+ import configify from "../../../helpers/configify";
8
+ import funcify from "../../../helpers/funcify";
9
+
10
+ export default {
11
+ title: "Core/Charts/LinePlot",
12
+ component: LinePlot,
13
+ argTypes,
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: "Creates a line plot based on an array of data.",
18
+ },
19
+ },
20
+ }
21
+ };
22
+
23
+ const Template = (args) => <LinePlot 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 LineLabels = Template.bind({});
45
+ LineLabels.args = {
46
+ data: [
47
+ { id: "alpha", x: 4, y: 9 },
48
+ { id: "alpha", x: 5, y: 17 },
49
+ { id: "alpha", x: 6, y: 13 },
50
+ { id: "beta", x: 4, y: 17 },
51
+ { id: "beta", x: 5, y: 8 },
52
+ { id: "beta", x: 6, y: 16 },
53
+ { id: "gamma", x: 4, y: 14 },
54
+ { id: "gamma", x: 5, y: 9 },
55
+ { id: "gamma", x: 6, y: 11 }
56
+ ],
57
+ groupBy: "id",
58
+ lineLabels: true,
59
+ x: "x",
60
+ y: "y"
61
+ };
62
+ LineLabels.parameters = {controls: {include: ["lineLabels"]}};
63
+
64
+ export const CustomLineLabels = Template.bind({});
65
+ CustomLineLabels.args = {
66
+ data: [
67
+ { id: "alpha", x: 4, y: 9 },
68
+ { id: "alpha", x: 5, y: 17 },
69
+ { id: "alpha", x: 6, y: 13 },
70
+ { id: "beta", x: 4, y: 17 },
71
+ { id: "beta", x: 5, y: 8 },
72
+ { id: "beta", x: 6, y: 16 },
73
+ { id: "gamma", x: 4, y: 14 },
74
+ { id: "gamma", x: 5, y: 9 },
75
+ { id: "gamma", x: 6, y: 11 }
76
+ ],
77
+ groupBy: "id",
78
+ lineLabels: true,
79
+ shapeConfig: {
80
+ Line: {
81
+ label: funcify(
82
+ function(d) {
83
+ const dataArray = this._filteredData.filter(f => f.id === d.id);
84
+ const maxX = Math.max(...dataArray.map(f => f.x));
85
+ const maxData = dataArray.find(f => f.x === maxX);
86
+
87
+ return `${maxData.y}`;
88
+ },
89
+ `function(d) {
90
+ const dataArray = this._filteredData.filter(f => f.id === d.id);
91
+ const maxX = Math.max(...dataArray.map(f => f.x));
92
+ const maxData = dataArray.find(f => f.x === maxX);
93
+ return \`\${maxData.y}\`;
94
+ }`
95
+ )
96
+ }
97
+ },
98
+ x: "x",
99
+ y: "y"
100
+ };
101
+ CustomLineLabels.parameters = {controls: {include: ["shapeConfig"]}};
102
+
103
+ export const SecondaryYAxis = Template.bind({});
104
+ SecondaryYAxis.args = {
105
+ data: [
106
+ {
107
+ "Country ID": "nausa",
108
+ "Country": "United States",
109
+ "Year": 2011,
110
+ "Trade Value": 1403273708182,
111
+ "Trade Value Growth": 0.17509765715100706
112
+ },
113
+ {
114
+ "Country ID": "nausa",
115
+ "Country": "United States",
116
+ "Year": 2012,
117
+ "Trade Value": 1453520657725,
118
+ "Trade Value Growth": 0.03580694860170724
119
+ },
120
+ {
121
+ "Country ID": "nausa",
122
+ "Country": "United States",
123
+ "Year": 2013,
124
+ "Trade Value": 1478035757057,
125
+ "Trade Value Growth": 0.016866013703836988
126
+ },
127
+ {
128
+ "Country ID": "nausa",
129
+ "Country": "United States",
130
+ "Year": 2014,
131
+ "Trade Value": 1521969928619,
132
+ "Trade Value Growth": 0.029724701416885744
133
+ },
134
+ {
135
+ "Country ID": "nausa",
136
+ "Country": "United States",
137
+ "Year": 2015,
138
+ "Trade Value": 1409516953687,
139
+ "Trade Value Growth": -0.07388646307488954
140
+ },
141
+ {
142
+ "Country ID": "nausa",
143
+ "Country": "United States",
144
+ "Year": 2016,
145
+ "Trade Value": 1353648792022,
146
+ "Trade Value Growth": -0.0396363885647921
147
+ },
148
+ {
149
+ "Country ID": "nausa",
150
+ "Country": "United States",
151
+ "Year": 2017,
152
+ "Trade Value": 1456201053251,
153
+ "Trade Value Growth": 0.07575987348669187
154
+ },
155
+ {
156
+ "Country ID": "nausa",
157
+ "Country": "United States",
158
+ "Year": 2018,
159
+ "Trade Value": 1548849519602,
160
+ "Trade Value Growth": 0.06362340292513889
161
+ },
162
+ {
163
+ "Country ID": "nausa",
164
+ "Country": "United States",
165
+ "Year": 2019,
166
+ "Trade Value": 1511931053052,
167
+ "Trade Value Growth": -0.023836057720756986
168
+ }
169
+ ],
170
+ groupBy: "Country",
171
+ time: "Year",
172
+ x: "Year",
173
+ y: "Trade Value",
174
+ y2: "Trade Value Growth",
175
+ y2Config: {
176
+ tickFormat: funcify(
177
+ d => `${parseInt(d * 100)}%`,
178
+ "d => `${parseInt(d * 100)}%`"
179
+ )
180
+ }
181
+ };
182
+ SecondaryYAxis.parameters = {controls: {include: ["y2", "y2Config"]}};
183
+
184
+ export const LineVertexMarkers = Template.bind({});
185
+ LineVertexMarkers.args = {
186
+ data: [
187
+ { id: "alpha", x: 4, y: 9 },
188
+ { id: "alpha", x: 5, y: 17 },
189
+ { id: "alpha", x: 6, y: 13 },
190
+ { id: "beta", x: 4, y: 17 },
191
+ { id: "beta", x: 5, y: 8 },
192
+ { id: "beta", x: 6, y: 16 },
193
+ { id: "gamma", x: 4, y: 14 },
194
+ { id: "gamma", x: 5, y: 9 },
195
+ { id: "gamma", x: 6, y: 11 }
196
+ ],
197
+ groupBy: "id",
198
+ lineMarkers: true,
199
+ lineMarkerConfig: {
200
+ r: 6
201
+ },
202
+ x: "x",
203
+ y: "y"
204
+ };
205
+ LineVertexMarkers.parameters = {controls: {include: ["lineMarkers", "lineMarkersConfig"]}};
206
+
207
+ export const ChangingVertexMarkerStyle = Template.bind({});
208
+ ChangingVertexMarkerStyle.args = {
209
+ data: [
210
+ { id: "alpha", x: 4, y: 9 },
211
+ { id: "alpha", x: 5, y: 17 },
212
+ { id: "alpha", x: 6, y: 13 },
213
+ { id: "beta", x: 4, y: 17 },
214
+ { id: "beta", x: 5, y: 8 },
215
+ { id: "beta", x: 6, y: 16 },
216
+ { id: "gamma", x: 4, y: 14 },
217
+ { id: "gamma", x: 5, y: 9 },
218
+ { id: "gamma", x: 6, y: 11 }
219
+ ],
220
+ groupBy: "id",
221
+ lineMarkers: true,
222
+ lineMarkerConfig: {
223
+ opacity: funcify(d => d.x === 6 ? 1 : 0.25, "d => d.x === 6 ? 1 : 0.25"),
224
+ r: funcify(d => d.x === 6 ? 6 : 4, "d => d.x === 6 ? 6 : 3")
225
+ },
226
+ x: "x",
227
+ y: "y"
228
+ };
229
+ ChangingVertexMarkerStyle.parameters = {controls: {include: ["lineMarkerConfig"]}};
230
+
231
+ export const ChangingSplining = Template.bind({});
232
+ ChangingSplining.args = {
233
+ data: [
234
+ { fruit: "apple", price: 5, year: 2014 },
235
+ { fruit: "banana", price: 4, year: 2014 },
236
+ { fruit: "apple", price: 7, year: 2015 },
237
+ { fruit: "banana", price: 6, year: 2015 },
238
+ { fruit: "apple", price: 10, year: 2016 },
239
+ { fruit: "banana", price: 8, year: 2016 },
240
+ { fruit: "apple", price: 6, year: 2017 },
241
+ { fruit: "banana", price: 10, year: 2017 },
242
+ { fruit: "apple", price: 8, year: 2018 },
243
+ { fruit: "banana", price: 15, year: 2018 }
244
+ ],
245
+ groupBy: "fruit",
246
+ shapeConfig: {
247
+ Line: {
248
+ curve: "catmullRom"
249
+ }
250
+ },
251
+ x: "year",
252
+ y: "price"
253
+ };
254
+ ChangingSplining.parameters = {controls: {include: ["shapeConfig"]}};
255
+
256
+ export const ChangingStrokeWidth = Template.bind({});
257
+ ChangingStrokeWidth.args = {
258
+ data: [
259
+ { id: "alpha", x: 4, y: 7 },
260
+ { id: "alpha", x: 5, y: 25 },
261
+ { id: "alpha", x: 6, y: 13 },
262
+ { id: "beta", x: 4, y: 17 },
263
+ { id: "beta", x: 5, y: 8 },
264
+ { id: "beta", x: 6, y: 13 }
265
+ ],
266
+ groupBy: "id",
267
+ shapeConfig: {
268
+ Line: {
269
+ strokeWidth: 5
270
+ }
271
+ },
272
+ x: "x",
273
+ y: "y"
274
+ };
275
+ ChangingStrokeWidth.parameters = {controls: {include: ["shapeConfig"]}};
276
+
277
+ export const ConfidenceIntervals = Template.bind({});
278
+ ConfidenceIntervals.args = {
279
+ data: [
280
+ { fruit: "apple", year: 1, amount: 50, moe: 2 },
281
+ { fruit: "apple", year: 2, amount: 56, moe: 1 },
282
+ { fruit: "apple", year: 3, amount: 58, moe: 1 },
283
+ { fruit: "banana", year: 1, amount: 88, moe: 3 },
284
+ { fruit: "banana", year: 2, amount: 90, moe: 4 },
285
+ { fruit: "banana", year: 3, amount: 76, moe: 3 }
286
+ ],
287
+ groupBy: "fruit",
288
+ confidence: [
289
+ funcify(
290
+ d => d.amount - d.moe,
291
+ "d => d.amount - d.moe"
292
+ ),
293
+ funcify(
294
+ d => d.amount + d.moe,
295
+ "d => d.amount + d.moe"
296
+ )
297
+ ],
298
+ confidenceConfig: {
299
+ fillOpacity: 0.3
300
+ },
301
+ x: "year",
302
+ y: "amount"
303
+ };
304
+ ConfidenceIntervals.parameters = {controls: {include: ["confidence", "confidenceConfig"]}};
305
+
306
+ export const DashedLines = Template.bind({});
307
+ DashedLines.args = {
308
+ data: [
309
+ { fruit: "apple", price: 5, year: 2014 },
310
+ { fruit: "banana", price: 4, year: 2014 },
311
+ { fruit: "cherry", price: 7, year: 2014 },
312
+ { fruit: "apple", price: 7, year: 2015 },
313
+ { fruit: "banana", price: 6, year: 2015 },
314
+ { fruit: "cherry", price: 9, year: 2015 },
315
+ { fruit: "apple", price: 10, year: 2016 },
316
+ { fruit: "banana", price: 8, year: 2016 },
317
+ { fruit: "cherry", price: 5, year: 2016 },
318
+ { fruit: "apple", price: 6, year: 2017 },
319
+ { fruit: "banana", price: 10, year: 2017 },
320
+ { fruit: "cherry", price: 10, year: 2017 },
321
+ { fruit: "apple", price: 8, year: 2018 },
322
+ { fruit: "banana", price: 15, year: 2018 },
323
+ { fruit: "cherry", price: 12, year: 2018 }
324
+ ],
325
+ groupBy: "fruit",
326
+ shapeConfig: {
327
+ Line: {
328
+ strokeDasharray: funcify(
329
+ d => {
330
+ if (d.fruit === "apple") return "10";
331
+ if (d.fruit === "banana") return "10 7 3";
332
+ if (d.fruit === "cherry") return "10 7 5 2";
333
+ return "0";
334
+ },
335
+ `d => {
336
+ if (d.fruit === "apple") return "10";
337
+ if (d.fruit === "banana") return "10 7 3";
338
+ if (d.fruit === "cherry") return "10 7 5 2";
339
+ return "0";
340
+ }`)
341
+ }
342
+ },
343
+ x: "year",
344
+ y: "price"
345
+ };
346
+ DashedLines.parameters = {controls: {include: ["shapeConfig"]}};
347
+
348
+ export const CustomLineColors = Template.bind({});
349
+ CustomLineColors.args = {
350
+ data: [
351
+ { fruit: "apple", price: 5, year: 2014 },
352
+ { fruit: "banana", price: 4, year: 2014 },
353
+ { fruit: "cherry", price: 7, year: 2014 },
354
+ { fruit: "apple", price: 7, year: 2015 },
355
+ { fruit: "banana", price: 6, year: 2015 },
356
+ { fruit: "cherry", price: 9, year: 2015 },
357
+ { fruit: "apple", price: 10, year: 2016 },
358
+ { fruit: "banana", price: 8, year: 2016 },
359
+ { fruit: "cherry", price: 5, year: 2016 },
360
+ { fruit: "apple", price: 6, year: 2017 },
361
+ { fruit: "banana", price: 10, year: 2017 },
362
+ { fruit: "cherry", price: 10, year: 2017 },
363
+ { fruit: "apple", price: 8, year: 2018 },
364
+ { fruit: "banana", price: 15, year: 2018 },
365
+ { fruit: "cherry", price: 12, year: 2018 }
366
+ ],
367
+ groupBy: "fruit",
368
+ shapeConfig: {
369
+ Line: {
370
+ stroke: funcify(
371
+ d => {
372
+ if (d.fruit === "apple") return "green";
373
+ if (d.fruit === "banana") return "goldenrod";
374
+ if (d.fruit === "cherry") return "red";
375
+ return "grey";
376
+ },
377
+ `d => {
378
+ if (d.fruit === "apple") return "green";
379
+ if (d.fruit === "banana") return "goldenrod";
380
+ if (d.fruit === "cherry") return "red";
381
+ return "grey";
382
+ }`
383
+ )
384
+ }
385
+ },
386
+ x: "year",
387
+ y: "price"
388
+ };
389
+ CustomLineColors.parameters = {controls: {include: ["shapeConfig"]}};
390
+
391
+ export const SortingLines = Template.bind({});
392
+ SortingLines.args = {
393
+ data: [
394
+ { fruit: "apple", price: 5, year: 2014 },
395
+ { fruit: "banana", price: 4, year: 2014 },
396
+ { fruit: "apple", price: 7, year: 2015 },
397
+ { fruit: "banana", price: 6, year: 2015 },
398
+ { fruit: "apple", price: 10, year: 2016 },
399
+ { fruit: "banana", price: 8, year: 2016 },
400
+ { fruit: "apple", price: 6, year: 2017 },
401
+ { fruit: "banana", price: 10, year: 2017 },
402
+ { fruit: "apple", price: 8, year: 2018 },
403
+ { fruit: "banana", price: 15, year: 2018 }
404
+ ],
405
+ groupBy: "fruit",
406
+ shapeConfig: {
407
+ Line: {
408
+ strokeLinecap: "round",
409
+ strokeWidth: 10
410
+ },
411
+ sort: funcify(
412
+ (a, b) => a.fruit === "apple" ? 1 : -1,
413
+ `(a, b) => a.fruit === "apple" ? 1 : -1`
414
+ )
415
+ },
416
+ x: "year",
417
+ y: "price"
418
+ };
419
+ SortingLines.parameters = {controls: {include: ["shapeConfig"]}};
420
+
421
+ export const DottedLinePredictions = Template.bind({});
422
+ DottedLinePredictions.args = {
423
+ data: [
424
+ {
425
+ "Year": 2016,
426
+ "Flow ID": 1,
427
+ "Flow": "Imports",
428
+ "Trade Value": 363829206796,
429
+ "Type": "Observed"
430
+ },
431
+ {
432
+ "Year": 2016,
433
+ "Flow ID": 2,
434
+ "Flow": "Exports",
435
+ "Trade Value": 364493560621,
436
+ "Type": "Observed"
437
+ },
438
+ {
439
+ "Year": 2017,
440
+ "Flow ID": 1,
441
+ "Flow": "Imports",
442
+ "Trade Value": 376297646785,
443
+ "Type": "Observed"
444
+ },
445
+ {
446
+ "Year": 2017,
447
+ "Flow ID": 2,
448
+ "Flow": "Exports",
449
+ "Trade Value": 401741532115,
450
+ "Type": "Observed"
451
+ },
452
+ {
453
+ "Year": 2018,
454
+ "Flow ID": 1,
455
+ "Flow": "Imports",
456
+ "Trade Value": 414829536859,
457
+ "Type": "Observed"
458
+ },
459
+ {
460
+ "Year": 2018,
461
+ "Flow ID": 2,
462
+ "Flow": "Exports",
463
+ "Trade Value": 441736801029,
464
+ "Type": "Observed"
465
+ },
466
+ {
467
+ "Year": 2019,
468
+ "Flow ID": 1,
469
+ "Flow": "Imports",
470
+ "Trade Value": 425699639802,
471
+ "Type": "Observed"
472
+ },
473
+ {
474
+ "Year": 2019,
475
+ "Flow ID": 2,
476
+ "Flow": "Exports",
477
+ "Trade Value": 432693158563,
478
+ "Type": "Observed"
479
+ },
480
+ {
481
+ "Year": 2020,
482
+ "Flow ID": 1,
483
+ "Flow": "Imports",
484
+ "Trade Value": 366314124058,
485
+ "Type": "Observed"
486
+ },
487
+ {
488
+ "Year": 2020,
489
+ "Flow ID": 2,
490
+ "Flow": "Exports",
491
+ "Trade Value": 406070750072,
492
+ "Type": "Observed"
493
+ },
494
+ {
495
+ "Year": 2020,
496
+ "Flow ID": 1,
497
+ "Flow": "Imports",
498
+ "Trade Value": 366314124058,
499
+ "Type": "Predicted"
500
+ },
501
+ {
502
+ "Year": 2020,
503
+ "Flow ID": 2,
504
+ "Flow": "Exports",
505
+ "Trade Value": 406070750072,
506
+ "Type": "Predicted"
507
+ },
508
+ {
509
+ "Year": 2021,
510
+ "Flow ID": 1,
511
+ "Flow": "Imports",
512
+ "Trade Value": 346314124058,
513
+ "Type": "Predicted"
514
+ },
515
+ {
516
+ "Year": 2021,
517
+ "Flow ID": 2,
518
+ "Flow": "Exports",
519
+ "Trade Value": 386070750072,
520
+ "Type": "Predicted"
521
+ },
522
+ {
523
+ "Year": 2022,
524
+ "Flow ID": 1,
525
+ "Flow": "Imports",
526
+ "Trade Value": 336314124058,
527
+ "Type": "Predicted"
528
+ },
529
+ {
530
+ "Year": 2022,
531
+ "Flow ID": 2,
532
+ "Flow": "Exports",
533
+ "Trade Value": 396070750072,
534
+ "Type": "Predicted"
535
+ }
536
+ ],
537
+ groupBy: ["Type", "Flow"],
538
+ shapeConfig: {
539
+ Line: {
540
+ strokeDasharray: funcify(
541
+ d => d.Type === "Predicted" ? "10" : "0",
542
+ `d => d.Type === "Predicted" ? "10" : "0"`
543
+ )
544
+ }
545
+ },
546
+ time: "Year",
547
+ x: "Year",
548
+ y: "Trade Value"
549
+ };
550
+ DottedLinePredictions.parameters = {controls: {include: ["shapeConfig"]}};
551
+
552
+ export const QuarterlyData = Template.bind({});
553
+ QuarterlyData.args = {
554
+ data: "https://api.datasaudi.sa/tesseract/data.jsonrecords?cube=gastat_gdp&drilldowns=Economic+Activity+Section,Quarter&measures=GDP&locale=en&Economic%20Activity%20Section=3",
555
+ groupBy: "Economic Activity Section",
556
+ time: "Quarter",
557
+ title: "Saudi Manufacturing GDP Over Time",
558
+ x: "Quarter",
559
+ y: "GDP",
560
+ yConfig: {
561
+ title: "Billions of SAR"
562
+ }
563
+ };
564
+ QuarterlyData.parameters = {controls: {include: ["time"]}};
@@ -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, Matrix} from "../../../args/core/charts/Matrix.args";
7
+ import configify from "../../../helpers/configify";
8
+ import funcify from "../../../helpers/funcify";
9
+
10
+ export default {
11
+ title: "Core/Charts/Matrix",
12
+ component: Matrix,
13
+ argTypes,
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: "Creates a simple rows/columns Matrix view of any dataset. See [this example](https://d3plus.org/examples/d3plus-matrix/getting-started/) for help getting started using the Matrix class.",
18
+ },
19
+ },
20
+ }
21
+ };
22
+
23
+ const Template = (args) => <Matrix 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,99 @@
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, Network} from "../../../args/core/charts/Network.args";
7
+ import configify from "../../../helpers/configify";
8
+ import funcify from "../../../helpers/funcify";
9
+
10
+ export default {
11
+ title: "Core/Charts/Network",
12
+ component: Network,
13
+ argTypes,
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: "Creates a network visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/getting-started/) for help getting started using the Network class.",
18
+ },
19
+ },
20
+ }
21
+ };
22
+
23
+ const Template = (args) => <Network 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
+ groupBy: "id",
31
+ nodes: [
32
+ {id: "alpha", x: 1, y: 1},
33
+ {id: "beta", x: 2, y: 1},
34
+ {id: "gamma", x: 1, y: 2},
35
+ {id: "epsilon", x: 3, y: 2},
36
+ {id: "zeta", x: 2.5, y: 1.5},
37
+ {id: "theta", x: 2, y: 2}
38
+ ],
39
+ links: [
40
+ {source: 0, target: 1},
41
+ {source: 0, target: 2},
42
+ {source: 3, target: 4},
43
+ {source: 3, target: 5},
44
+ {source: 5, target: 0}
45
+ ]
46
+ };
47
+ BasicExample.parameters = {controls: {include: ["nodes", "links"]}};
48
+
49
+ export const ForceDirectedLayout = Template.bind({});
50
+ ForceDirectedLayout.args = {
51
+ nodes: [
52
+ {id: "alpha"},
53
+ {id: "beta"},
54
+ {id: "gamma"},
55
+ {id: "epsilon"},
56
+ {id: "zeta"},
57
+ {id: "theta"}
58
+ ],
59
+ links: [
60
+ {source: 0, target: 1, weight: 10},
61
+ {source: 0, target: 2, weight: 10},
62
+ {source: 3, target: 4, weight: 10},
63
+ {source: 3, target: 5, weight: 5},
64
+ {source: 5, target: 0, weight: 20},
65
+ {source: 2, target: 1, weight: 12},
66
+ {source: 4, target: 5, weight: 12}
67
+ ],
68
+ linkSize: funcify(
69
+ d => d.weight,
70
+ "d => d.weight"
71
+ )
72
+ };
73
+ ForceDirectedLayout.parameters = {controls: {include: ["nodes", "links"]}};
74
+
75
+ export const DataDrivenLinkSize = Template.bind({});
76
+ DataDrivenLinkSize.args = {
77
+ nodes: [
78
+ {id: "alpha"},
79
+ {id: "beta"},
80
+ {id: "gamma"},
81
+ {id: "epsilon"},
82
+ {id: "zeta"},
83
+ {id: "theta"}
84
+ ],
85
+ links: [
86
+ {source: 0, target: 1, weight: 10},
87
+ {source: 0, target: 2, weight: 10},
88
+ {source: 3, target: 4, weight: 10},
89
+ {source: 3, target: 5, weight: 5},
90
+ {source: 5, target: 0, weight: 20},
91
+ {source: 2, target: 1, weight: 12},
92
+ {source: 4, target: 5, weight: 12}
93
+ ],
94
+ linkSize: funcify(
95
+ d => d.weight,
96
+ "d => d.weight"
97
+ )
98
+ };
99
+ DataDrivenLinkSize.parameters = {controls: {include: ["linkSize"]}};