@d3plus/docs 3.0.4 → 3.0.6

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 (72) hide show
  1. package/.storybook/preview-head.html +5 -0
  2. package/args/core/charts/AreaPlot.args.jsx +4 -1
  3. package/args/core/charts/BarChart.args.jsx +5 -1
  4. package/args/core/charts/BoxWhisker.args.jsx +4 -1
  5. package/args/core/charts/BumpChart.args.jsx +8 -1
  6. package/args/core/charts/Donut.args.jsx +4 -2
  7. package/args/core/charts/Geomap.args.jsx +29 -13
  8. package/args/core/charts/LinePlot.args.jsx +3 -1
  9. package/args/core/charts/Matrix.args.jsx +13 -2
  10. package/args/core/charts/Network.args.jsx +29 -16
  11. package/args/core/charts/Pack.args.jsx +11 -2
  12. package/args/core/charts/Pie.args.jsx +8 -1
  13. package/args/core/charts/Plot.args.jsx +56 -23
  14. package/args/core/charts/Priestley.args.jsx +6 -0
  15. package/args/core/charts/Radar.args.jsx +7 -1
  16. package/args/core/charts/RadialMatrix.args.jsx +15 -4
  17. package/args/core/charts/Rings.args.jsx +21 -10
  18. package/args/core/charts/Sankey.args.jsx +17 -5
  19. package/args/core/charts/Tree.args.jsx +46 -6
  20. package/args/core/charts/Treemap.args.jsx +15 -5
  21. package/args/core/charts/Viz.args.jsx +102 -24
  22. package/args/core/components/Axis.args.jsx +49 -12
  23. package/args/core/components/AxisBottom.args.jsx +1 -1
  24. package/args/core/components/AxisLeft.args.jsx +1 -1
  25. package/args/core/components/AxisRight.args.jsx +1 -1
  26. package/args/core/components/AxisTop.args.jsx +1 -1
  27. package/args/core/components/ColorScale.args.jsx +37 -10
  28. package/args/core/components/Legend.args.jsx +21 -5
  29. package/args/core/components/TextBox.args.jsx +40 -7
  30. package/args/core/components/Timeline.args.jsx +29 -5
  31. package/args/core/components/Tooltip.args.jsx +40 -12
  32. package/args/core/shapes/Area.args.jsx +11 -1
  33. package/args/core/shapes/Bar.args.jsx +10 -1
  34. package/args/core/shapes/Box.args.jsx +19 -5
  35. package/args/core/shapes/Circle.args.jsx +4 -1
  36. package/args/core/shapes/Image.args.jsx +13 -1
  37. package/args/core/shapes/Line.args.jsx +7 -1
  38. package/args/core/shapes/Path.args.jsx +4 -1
  39. package/args/core/shapes/Rect.args.jsx +4 -1
  40. package/args/core/shapes/Shape.args.jsx +49 -13
  41. package/args/core/shapes/Whisker.args.jsx +13 -2
  42. package/args/core/utils/BaseClass.args.jsx +4 -0
  43. package/args/core/utils/accessor.args.jsx +1 -3
  44. package/args/core/utils/constant.args.jsx +1 -1
  45. package/args/data/dataConcat.args.jsx +1 -1
  46. package/args/data/dataLoad.args.jsx +1 -1
  47. package/args/data/isData.args.jsx +1 -3
  48. package/args/data/merge.args.jsx +1 -1
  49. package/args/data/unique.args.jsx +1 -1
  50. package/args/dom/attrize.args.jsx +1 -3
  51. package/args/dom/elem.args.jsx +1 -3
  52. package/args/dom/fontExists.args.jsx +1 -1
  53. package/args/dom/isObject.args.jsx +1 -3
  54. package/args/dom/parseSides.args.jsx +1 -1
  55. package/args/dom/stylize.args.jsx +1 -3
  56. package/args/dom/textWidth.args.jsx +1 -1
  57. package/args/export/saveElement.args.jsx +1 -3
  58. package/args/format/formatDate.args.jsx +2 -4
  59. package/args/math/closest.args.jsx +1 -1
  60. package/args/math/largestRect.args.jsx +1 -1
  61. package/args/math/lineIntersection.args.jsx +4 -4
  62. package/args/math/pointDistance.args.jsx +2 -2
  63. package/args/math/pointDistanceSquared.args.jsx +2 -2
  64. package/args/math/pointRotate.args.jsx +2 -2
  65. package/args/math/polygonInside.args.jsx +2 -2
  66. package/args/math/polygonRayCast.args.jsx +2 -2
  67. package/args/math/polygonRotate.args.jsx +2 -2
  68. package/args/math/segmentBoxContains.args.jsx +3 -3
  69. package/args/math/segmentsIntersect.args.jsx +4 -4
  70. package/helpers/configify.js +2 -10
  71. package/package.json +6 -6
  72. package/packages/core/charts/Tree.stories.jsx +40 -0
@@ -24,6 +24,7 @@ export const argTypes = assign(
24
24
  {
25
25
  hover: {
26
26
  control: {},
27
+ description: "If *value* is specified, sets the hover method to the specified function and returns the current class instance.",
27
28
  table: {
28
29
  defaultValue: {
29
30
  summary: "undefined"
@@ -35,10 +36,9 @@ export const argTypes = assign(
35
36
  }
36
37
  },
37
38
  linkSize: {
38
- control: {
39
- type: "name"
40
- },
39
+ control: {},
41
40
  defaultValue: 1,
41
+ description: "Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.",
42
42
  table: {
43
43
  defaultValue: {
44
44
  summary: 1
@@ -54,6 +54,7 @@ export const argTypes = assign(
54
54
  type: "number"
55
55
  },
56
56
  defaultValue: 1,
57
+ description: "Defines the minimum pixel stroke width used in link sizing.",
57
58
  table: {
58
59
  defaultValue: {
59
60
  summary: 1
@@ -69,6 +70,7 @@ export const argTypes = assign(
69
70
  type: "text"
70
71
  },
71
72
  defaultValue: "sqrt",
73
+ description: "Sets the specific type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of links in the network.",
72
74
  table: {
73
75
  defaultValue: {
74
76
  summary: "sqrt"
@@ -81,13 +83,13 @@ export const argTypes = assign(
81
83
  },
82
84
  links: {
83
85
  control: {
84
- type: "array"
86
+ type: "object"
85
87
  },
86
- defaultValue: "[\n\n]",
87
- description: "= []",
88
+ defaultValue: "[ ]",
89
+ description: "A predefined *Array* of edges that connect each object passed to the [node](#Network.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways:\n1. The index of the node in the nodes array (as in [this](http://d3plus.org/examples/d3plus-network/getting-started/) example).\n2. The actual node *Object* itself.\n3. A *String* value matching the `id` of the node.\n\nThe value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded. An optional formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final links *Array*.",
88
90
  table: {
89
91
  defaultValue: {
90
- summary: "[\n\n]"
92
+ summary: "[ ]"
91
93
  }
92
94
  },
93
95
  type: {
@@ -100,6 +102,7 @@ export const argTypes = assign(
100
102
  type: "boolean"
101
103
  },
102
104
  defaultValue: false,
105
+ description: "Toggles the visibility of the status message that is displayed when no data is supplied to the visualization.",
103
106
  table: {
104
107
  defaultValue: {
105
108
  summary: false
@@ -112,12 +115,13 @@ export const argTypes = assign(
112
115
  },
113
116
  nodeGroupBy: {
114
117
  control: {
115
- type: "text"
118
+ type: "object"
116
119
  },
117
- defaultValue: "[\nd => d[\"id\"]\n]",
120
+ defaultValue: "[ d => d[\"id\"] ]",
121
+ description: "If *value* is specified, sets the node group accessor(s) to the specified string, function, or array of values and returns the current class instance. This method overrides the default .groupBy() function from being used with the data passed to .nodes(). If *value* is not specified, returns the current node group accessor.",
118
122
  table: {
119
123
  defaultValue: {
120
- detail: "[\nd => d[\"id\"]\n]",
124
+ detail: "[ d => d[\"id\"] ]",
121
125
  summary: "function"
122
126
  }
123
127
  },
@@ -128,13 +132,13 @@ export const argTypes = assign(
128
132
  },
129
133
  nodes: {
130
134
  control: {
131
- type: "array"
135
+ type: "object"
132
136
  },
133
- defaultValue: "[\n\n]",
134
- description: "= []",
137
+ defaultValue: "[ ]",
138
+ description: "The list of nodes to be used for drawing the network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded.\n\nAdditionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final node *Array*.",
135
139
  table: {
136
140
  defaultValue: {
137
- summary: "[\n\n]"
141
+ summary: "[ ]"
138
142
  }
139
143
  },
140
144
  type: {
@@ -153,6 +157,7 @@ export const argTypes = assign(
153
157
  "mouseleave.shape": "() => {\n this.hover(false);\n}",
154
158
  "mousemove.shape": "(d, i, x, event) => {\n defaultMouseMove(d, i, x, event);\n const id = getNodeId.bind(this)(d, i), links = this._linkLookup[id] || [], node = this._nodeLookup[id];\n const filterIds = [\n id\n ];\n const xDomain = [\n node.x - node.r,\n node.x + node.r\n ], yDomain = [\n node.y - node.r,\n node.y + node.r\n ];\n links.forEach((l)=>{\n filterIds.push(l.id);\n if (l.x - l.r < xDomain[0]) xDomain[0] = l.x - l.r;\n if (l.x + l.r > xDomain[1]) xDomain[1] = l.x + l.r;\n if (l.y - l.r < yDomain[0]) yDomain[0] = l.y - l.r;\n if (l.y + l.r > yDomain[1]) yDomain[1] = l.y + l.r;\n });\n this.hover((h, x)=>{\n if (h.source && h.target) return h.source.id === id || h.target.id === id;\n else return filterIds.includes(`${this._ids(h, x)[this._drawDepth]}`);\n });\n}"
155
159
  },
160
+ description: "Adds or removes a *listener* to each object for the specified event *typenames*. If a *listener* is not specified, returns the currently assigned listener for the specified event *typename*. Mirrors the core [d3-selection](https://github.com/d3/d3-selection#selection_on) behavior.",
156
161
  table: {
157
162
  defaultValue: {
158
163
  summary: {
@@ -174,6 +179,7 @@ export const argTypes = assign(
174
179
  type: "text"
175
180
  },
176
181
  defaultValue: "Circle",
182
+ description: "Changes the primary shape used to represent each data point in a visualization. Not all visualizations support changing shapes, this method can be provided the String name of a D3plus shape class (for example, \"Rect\" or \"Circle\"), or an accessor Function that returns the String class name to be used for each individual data point.",
177
183
  table: {
178
184
  defaultValue: {
179
185
  summary: "Circle"
@@ -181,7 +187,7 @@ export const argTypes = assign(
181
187
  },
182
188
  type: {
183
189
  required: false,
184
- summary: "function | string"
190
+ summary: "string | function"
185
191
  }
186
192
  },
187
193
  shapeConfig: {
@@ -189,6 +195,7 @@ export const argTypes = assign(
189
195
  type: "object"
190
196
  },
191
197
  defaultValue: "assign(this._shapeConfig, {ariaLabel: (d, i) => {\n const validSize = this._size ? `, ${this._size(d, i)}` : \"\";\n return `${this._drawLabel(d, i)}${validSize}.`;\n}, labelConfig: {duration: 0, fontMin: 1, fontResize: true, labelPadding: 0, textAnchor: middle, verticalAlign: middle}, Path: {fill: none, label: false, stroke: #eee}})",
198
+ description: "If *value* is specified, sets the config method for each shape and returns the current class instance.",
192
199
  table: {
193
200
  defaultValue: {
194
201
  detail: "assign(this._shapeConfig, {ariaLabel: (d, i) => {\n const validSize = this._size ? `, ${this._size(d, i)}` : \"\";\n return `${this._drawLabel(d, i)}${validSize}.`;\n}, labelConfig: {duration: 0, fontMin: 1, fontResize: true, labelPadding: 0, textAnchor: middle, verticalAlign: middle}, Path: {fill: none, label: false, stroke: #eee}})",
@@ -204,6 +211,7 @@ export const argTypes = assign(
204
211
  control: {
205
212
  type: "text"
206
213
  },
214
+ description: "If *value* is specified, sets the size accessor to the specified function or data key and returns the current class instance. If *value* is not specified, returns the current size accessor.",
207
215
  table: {
208
216
  defaultValue: {
209
217
  summary: "undefined"
@@ -218,6 +226,7 @@ export const argTypes = assign(
218
226
  control: {
219
227
  type: "number"
220
228
  },
229
+ description: "Defines the maximum pixel radius used in size scaling. By default, the maximum size is determined by half the distance of the two closest nodes.",
221
230
  table: {
222
231
  defaultValue: {
223
232
  summary: "undefined"
@@ -233,6 +242,7 @@ export const argTypes = assign(
233
242
  type: "number"
234
243
  },
235
244
  defaultValue: 5,
245
+ description: "Defines the minimum pixel radius used in size scaling.",
236
246
  table: {
237
247
  defaultValue: {
238
248
  summary: 5
@@ -248,6 +258,7 @@ export const argTypes = assign(
248
258
  type: "text"
249
259
  },
250
260
  defaultValue: "sqrt",
261
+ description: "Sets the specific type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of nodes in the network.",
251
262
  table: {
252
263
  defaultValue: {
253
264
  summary: "sqrt"
@@ -263,6 +274,7 @@ export const argTypes = assign(
263
274
  type: "text"
264
275
  },
265
276
  defaultValue: "d => d[\"x\"]",
277
+ description: "If *value* is specified, sets the x accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If *value* is not specified, returns the current x accessor. By default, the x and y positions are determined dynamically based on default force layout properties.",
266
278
  table: {
267
279
  defaultValue: {
268
280
  detail: "d => d[\"x\"]",
@@ -279,6 +291,7 @@ export const argTypes = assign(
279
291
  type: "text"
280
292
  },
281
293
  defaultValue: "d => d[\"y\"]",
294
+ description: "If *value* is specified, sets the y accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If *value* is not specified, returns the current y accessor. By default, the x and y positions are determined dynamically based on default force layout properties.",
282
295
  table: {
283
296
  defaultValue: {
284
297
  detail: "d => d[\"y\"]",
@@ -295,7 +308,7 @@ export const argTypes = assign(
295
308
  type: "boolean"
296
309
  },
297
310
  defaultValue: true,
298
- description: "= false",
311
+ description: "Toggles the ability to zoom/pan the visualization. Certain parameters for zooming are required to be hooked up on a visualization by visualization basis.",
299
312
  table: {
300
313
  defaultValue: {
301
314
  summary: true
@@ -25,6 +25,7 @@ export const argTypes = assign(
25
25
  {
26
26
  hover: {
27
27
  control: {},
28
+ description: "If *value* is specified, sets the hover method to the specified function and returns the current class instance.",
28
29
  table: {
29
30
  defaultValue: {
30
31
  summary: "undefined"
@@ -40,6 +41,7 @@ export const argTypes = assign(
40
41
  type: "number"
41
42
  },
42
43
  defaultValue: 1,
44
+ description: "If *value* is specified, sets the opacity accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current pack opacity accessor.",
43
45
  table: {
44
46
  defaultValue: {
45
47
  summary: 1
@@ -55,6 +57,7 @@ export const argTypes = assign(
55
57
  type: "boolean"
56
58
  },
57
59
  defaultValue: "(config, arr) => {\n if (arr.length === this._filteredData.length) return false;\n return defaultLegend.bind(this)(config, arr);\n}",
60
+ description: "If *value* is specified, toggles the legend based on the specified boolean and returns the current class instance.",
58
61
  table: {
59
62
  defaultValue: {
60
63
  detail: "(config, arr) => {\n if (arr.length === this._filteredData.length) return false;\n return defaultLegend.bind(this)(config, arr);\n}",
@@ -75,6 +78,7 @@ export const argTypes = assign(
75
78
  "mousemove.legend": "(d, i, x, event) => {\n defaultMouseMoveLegend(d, i, x, event);\n const ids = this._ids(d, i);\n const hoverData = recursionCircles(d);\n this.hover((h)=>{\n const hover = Object.keys(h).filter((key)=>key !== \"value\").every((key)=>d[key] && d[key].includes(h[key]));\n if (hover) hoverData.push(h);\n else if (ids.includes(h.key)) hoverData.push(...recursionCircles(h, [\n h\n ]));\n return hoverData.includes(h);\n });\n}",
76
79
  "mousemove.shape": "(d, i, x, event) => {\n if (d.__d3plusTooltip__) defaultMouseMoveShape(d, i, x, event);\n const hoverData = recursionCircles(d, [\n d\n ]);\n this.hover((h)=>hoverData.includes(h));\n}"
77
80
  },
81
+ description: "Adds or removes a *listener* to each object for the specified event *typenames*. If a *listener* is not specified, returns the currently assigned listener for the specified event *typename*. Mirrors the core [d3-selection](https://github.com/d3/d3-selection#selection_on) behavior.",
78
82
  table: {
79
83
  defaultValue: {
80
84
  summary: {
@@ -94,6 +98,7 @@ export const argTypes = assign(
94
98
  type: "number"
95
99
  },
96
100
  defaultValue: 0.25,
101
+ description: "If *value* is specified, sets the padding accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current pack opacity accessor.",
97
102
  table: {
98
103
  defaultValue: {
99
104
  summary: 0.25
@@ -109,6 +114,7 @@ export const argTypes = assign(
109
114
  type: "text"
110
115
  },
111
116
  defaultValue: "Circle",
117
+ description: "Changes the primary shape used to represent each data point in a visualization. Not all visualizations support changing shapes, this method can be provided the String name of a D3plus shape class (for example, \"Rect\" or \"Circle\"), or an accessor Function that returns the String class name to be used for each individual data point.",
112
118
  table: {
113
119
  defaultValue: {
114
120
  summary: "Circle"
@@ -116,7 +122,7 @@ export const argTypes = assign(
116
122
  },
117
123
  type: {
118
124
  required: false,
119
- summary: "function | string"
125
+ summary: "string | function"
120
126
  }
121
127
  },
122
128
  shapeConfig: {
@@ -124,6 +130,7 @@ export const argTypes = assign(
124
130
  type: "object"
125
131
  },
126
132
  defaultValue: "assign(this._shapeConfig, {Circle: {label: (d) => d.parent && !d.children ? d.id : false, labelConfig: {fontResize: true}, opacity: (d) => d.__d3plusOpacity__}})",
133
+ description: "If *value* is specified, sets the config method for each shape and returns the current class instance.",
127
134
  table: {
128
135
  defaultValue: {
129
136
  detail: "assign(this._shapeConfig, {Circle: {label: (d) => d.parent && !d.children ? d.id : false, labelConfig: {fontResize: true}, opacity: (d) => d.__d3plusOpacity__}})",
@@ -137,9 +144,10 @@ export const argTypes = assign(
137
144
  },
138
145
  sort: {
139
146
  control: {
140
- type: "array"
147
+ type: "object"
141
148
  },
142
149
  defaultValue: "(a, b) => b.value - a.value",
150
+ description: "If *comparator* is specified, sets the sort order for the pack using the specified comparator function. If *comparator* is not specified, returns the current group sort order, which defaults to descending order by the associated input data's numeric value attribute.",
143
151
  table: {
144
152
  defaultValue: {
145
153
  detail: "(a, b) => b.value - a.value",
@@ -156,6 +164,7 @@ export const argTypes = assign(
156
164
  type: "number"
157
165
  },
158
166
  defaultValue: "d => d[\"value\"]",
167
+ description: "If *value* is specified, sets the sum accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current sum accessor.",
159
168
  table: {
160
169
  defaultValue: {
161
170
  detail: "d => d[\"value\"]",
@@ -28,6 +28,7 @@ export const argTypes = assign(
28
28
  type: "number"
29
29
  },
30
30
  defaultValue: 0,
31
+ description: "The pixel value, or function that returns a pixel value, that is used as the inner radius of the Pie (creating a Donut).",
31
32
  table: {
32
33
  defaultValue: {
33
34
  summary: 0
@@ -43,6 +44,7 @@ export const argTypes = assign(
43
44
  type: "boolean"
44
45
  },
45
46
  defaultValue: "(config, arr) => {\n if (arr.length === this._filteredData.length) return false;\n return defaultLegend.bind(this)(config, arr);\n}",
47
+ description: "If *value* is specified, toggles the legend based on the specified boolean and returns the current class instance.",
46
48
  table: {
47
49
  defaultValue: {
48
50
  detail: "(config, arr) => {\n if (arr.length === this._filteredData.length) return false;\n return defaultLegend.bind(this)(config, arr);\n}",
@@ -57,6 +59,7 @@ export const argTypes = assign(
57
59
  legendSort: {
58
60
  control: {},
59
61
  defaultValue: "(a, b) => this._value(b) - this._value(a)",
62
+ description: "A JavaScript [sort comparator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) used to sort the legend.",
60
63
  table: {
61
64
  defaultValue: {
62
65
  detail: "(a, b) => this._value(b) - this._value(a)",
@@ -72,6 +75,7 @@ export const argTypes = assign(
72
75
  control: {
73
76
  type: "number"
74
77
  },
78
+ description: "The padding between each arc, set as a radian value between \\`0\\` and \\`1\\`.\n\nIf set, this will override any previously set padPixel value.",
75
79
  table: {
76
80
  defaultValue: {
77
81
  summary: "undefined"
@@ -87,6 +91,7 @@ export const argTypes = assign(
87
91
  type: "number"
88
92
  },
89
93
  defaultValue: 0,
94
+ description: "The padding between each arc, set as a pixel number value.\n\nBy default the value is \\`0\\`, which shows no padding between each arc.\n\nIf \\`padAngle\\` is defined, the \\`padPixel\\` value will not be considered.",
90
95
  table: {
91
96
  defaultValue: {
92
97
  summary: 0
@@ -102,6 +107,7 @@ export const argTypes = assign(
102
107
  type: "object"
103
108
  },
104
109
  defaultValue: "assign(this._shapeConfig, {ariaLabel: (d, i) => this._pieData ? `${++this._pieData.i.index}. ${this._drawLabel(d, i)}, ${this._value(d, i)}.` : , Path: {labelConfig: {fontResize: true}}})",
110
+ description: "If *value* is specified, sets the config method for each shape and returns the current class instance.",
105
111
  table: {
106
112
  defaultValue: {
107
113
  detail: "assign(this._shapeConfig, {ariaLabel: (d, i) => this._pieData ? `${++this._pieData.i.index}. ${this._drawLabel(d, i)}, ${this._value(d, i)}.` : , Path: {labelConfig: {fontResize: true}}})",
@@ -116,6 +122,7 @@ export const argTypes = assign(
116
122
  sort: {
117
123
  control: {},
118
124
  defaultValue: "(a, b) => this._value(b) - this._value(a)",
125
+ description: "A comparator function that sorts the Pie slices.",
119
126
  table: {
120
127
  defaultValue: {
121
128
  detail: "(a, b) => this._value(b) - this._value(a)",
@@ -132,7 +139,7 @@ export const argTypes = assign(
132
139
  type: "text"
133
140
  },
134
141
  defaultValue: "d => d[\"value\"]",
135
- description: "= d => d.value",
142
+ description: "The accessor key for each data point used to calculate the size of each Pie section.",
136
143
  table: {
137
144
  defaultValue: {
138
145
  detail: "d => d[\"value\"]",