@@ -6,24 +6,61 @@ const props: ChartProperty[] = [
6
6
{
7
7
key : 'data' ,
8
8
group : 'Base' ,
9
- type : 'RadialBarSerie []' ,
9
+ type : 'object []' ,
10
10
required : true ,
11
11
help : 'Chart data.' ,
12
12
description : `
13
- For example, given this config:
13
+ Here is what the data for a single chart with 2 bars would look like:
14
+
15
+ \`\`\`
16
+ [
17
+ {
18
+ id: 'Fruits',
19
+ data: [{ x: 'Apples', y: 32 }]
20
+ },
21
+ {
22
+ id: 'Vegetables',
23
+ data: [{ x: 'Eggplants', y: 27 }]
24
+ }
25
+ ]
26
+ \`\`\`
27
+
28
+ You can add several metrics per group:
29
+
14
30
\`\`\`
15
31
[
16
- { language: 'javascript', john: 12, sarah: 32, bob: 27 },
17
- { language: 'golang', john: 25, sarah: 15, bob: 3 },
18
- { language: 'python', john: 5, sarah: 22, bob: 31 },
19
- { language: 'java', john: 19, sarah: 17, bob: 9 }
32
+ {
33
+ id: 'Fruits',
34
+ data: [
35
+ { x: 'Apples', y: 32 },
36
+ { x: 'Mangoes', y: 15 }
37
+ ]
38
+ },
39
+ {
40
+ id: 'Vegetables',
41
+ data: [
42
+ { x: 'Eggplants', y: 27 },
43
+ { x: 'Avocados', y: 34 }
44
+ ]
45
+ }
20
46
]
21
- keys: ['john', 'sarah', 'bob']
22
- indexBy: 'language'
23
47
\`\`\`
24
- We'll have a radar chart representing programing
25
- skills for each user by language
26
- (3 layers and 4 dimensions).
48
+
49
+ When a bar is computed, the \`id\` is going to be added
50
+ as the \`groupId\`, \`x\` as the \`category\` and \`y\`
51
+ as the value, for example the first bar for the number of Apples
52
+ in the Fruits group would be:
53
+
54
+ \`\`\`
55
+ {
56
+ groupId: 'Fruits',
57
+ category: 'Apples',
58
+ value: 32
59
+ }
60
+ \`\`\`
61
+
62
+ You might read those values when adding an \`onClick\` handler
63
+ for example, or when customizing the tooltip.
27
64
` ,
28
65
flavors : [ 'svg' ] ,
29
66
} ,
@@ -32,7 +69,7 @@ const props: ChartProperty[] = [
32
69
group : 'Base' ,
33
70
type : 'string | (value: number) => string' ,
34
71
required : false ,
35
- help : 'Optional formatter for values.' ,
72
+ help : 'Optional formatter for values (`y`) .' ,
36
73
description : `
37
74
The formatted value can then be used for labels & tooltips.
38
75
@@ -102,7 +139,6 @@ const props: ChartProperty[] = [
102
139
defaultValue : svgDefaultProps . startAngle ,
103
140
controlType : 'angle' ,
104
141
controlOptions : {
105
- unit : '°' ,
106
142
min : - 180 ,
107
143
max : 360 ,
108
144
step : 5 ,
@@ -118,7 +154,6 @@ const props: ChartProperty[] = [
118
154
defaultValue : svgDefaultProps . endAngle ,
119
155
controlType : 'angle' ,
120
156
controlOptions : {
121
- unit : '°' ,
122
157
min : - 360 ,
123
158
max : 360 ,
124
159
step : 5 ,
@@ -178,11 +213,75 @@ const props: ChartProperty[] = [
178
213
controlType : 'switch' ,
179
214
} ,
180
215
{
181
- key : 'sliceTooltip' ,
216
+ key : 'tooltip' ,
217
+ group : 'Interactivity' ,
218
+ type : 'RadialBarTooltipComponent' ,
219
+ required : false ,
220
+ help : 'Override default tooltip.' ,
221
+ flavors : [ 'svg' ] ,
222
+ } ,
223
+ {
224
+ key : 'onClick' ,
225
+ group : 'Interactivity' ,
226
+ type : '(bar: ComputedBar, event: MouseEvent) => void' ,
227
+ required : false ,
228
+ help : 'onClick handler.' ,
229
+ flavors : [ 'svg' ] ,
230
+ } ,
231
+ {
232
+ key : 'onMouseEnter' ,
233
+ group : 'Interactivity' ,
234
+ type : '(bar: ComputedBar, event: MouseEvent) => void' ,
235
+ required : false ,
236
+ help : 'onMouseEnter handler.' ,
237
+ flavors : [ 'svg' ] ,
238
+ } ,
239
+ {
240
+ key : 'onMouseMove' ,
241
+ group : 'Interactivity' ,
242
+ type : '(bar: ComputedBar, event: MouseEvent) => void' ,
243
+ required : false ,
244
+ help : 'onMouseMove handler.' ,
245
+ flavors : [ 'svg' ] ,
246
+ } ,
247
+ {
248
+ key : 'onMouseLeave' ,
182
249
group : 'Interactivity' ,
183
- type : 'FunctionComponent<RadarSliceTooltipProps>' ,
250
+ type : '(bar: ComputedBar, event: MouseEvent) => void' ,
251
+ required : false ,
252
+ help : 'onMouseLeave handler.' ,
253
+ flavors : [ 'svg' ] ,
254
+ } ,
255
+ {
256
+ key : 'role' ,
257
+ group : 'Accessibility' ,
258
+ type : 'string' ,
259
+ required : false ,
260
+ help : 'Main element role attribute.' ,
261
+ flavors : [ 'svg' ] ,
262
+ } ,
263
+ {
264
+ key : 'ariaLabel' ,
265
+ group : 'Accessibility' ,
266
+ type : 'string' ,
267
+ required : false ,
268
+ help : 'Main element [aria-label](https://www.w3.org/TR/wai-aria/#aria-label).' ,
269
+ flavors : [ 'svg' ] ,
270
+ } ,
271
+ {
272
+ key : 'ariaLabelledBy' ,
273
+ group : 'Accessibility' ,
274
+ type : 'string' ,
275
+ required : false ,
276
+ help : 'Main element [aria-labelledby](https://www.w3.org/TR/wai-aria/#aria-labelledby).' ,
277
+ flavors : [ 'svg' ] ,
278
+ } ,
279
+ {
280
+ key : 'ariaDescribedBy' ,
281
+ group : 'Accessibility' ,
282
+ type : 'string' ,
184
283
required : false ,
185
- help : 'Override default slice tooltip .' ,
284
+ help : 'Main element [aria-describedby](https://www.w3.org/TR/wai-aria/#aria-describedby) .' ,
186
285
flavors : [ 'svg' ] ,
187
286
} ,
188
287
...motionProperties ( [ 'svg' ] , svgDefaultProps , 'react-spring' ) ,
0 commit comments