@react-magma/charts 10.0.0 → 10.0.1-next.0

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 (43) hide show
  1. package/dist/charts +13 -13
  2. package/dist/charts.js +1 -1
  3. package/dist/charts.js.map +1 -1
  4. package/dist/charts.map +1 -1
  5. package/dist/charts.modern.module.js +1 -1
  6. package/dist/charts.modern.module.js.map +1 -1
  7. package/dist/charts.umd.js +1 -1
  8. package/dist/charts.umd.js.map +1 -1
  9. package/dist/components/CarbonChart/CarbonChart.d.ts +10 -1
  10. package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +3 -0
  11. package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +1 -0
  12. package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +1 -0
  13. package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +1 -0
  14. package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +4 -0
  15. package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +4 -0
  16. package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +4 -0
  17. package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +4 -0
  18. package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +4 -0
  19. package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +4 -0
  20. package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +11 -0
  21. package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +4 -0
  22. package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +4 -0
  23. package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +4 -0
  24. package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +4 -0
  25. package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +4 -0
  26. package/package.json +3 -3
  27. package/src/components/CarbonChart/CarbonChart.tsx +28 -1
  28. package/src/components/CarbonChart/CarbonChartArea.stories.tsx +272 -0
  29. package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +152 -0
  30. package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +124 -0
  31. package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +125 -0
  32. package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +274 -0
  33. package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +606 -0
  34. package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +89 -0
  35. package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1418 -0
  36. package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +80 -0
  37. package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +767 -0
  38. package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1050 -0
  39. package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +216 -0
  40. package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +479 -0
  41. package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +467 -0
  42. package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +222 -0
  43. package/src/components/CarbonChart/CarbonChartStep.stories.tsx +173 -0
@@ -0,0 +1,216 @@
1
+ import React from 'react';
2
+ import { Story, Meta } from '@storybook/react/types-6-0';
3
+ import { CarbonChart, CarbonChartProps, CarbonChartType } from '.';
4
+ import { Card } from 'react-magma-dom';
5
+
6
+ export default {
7
+ component: CarbonChart,
8
+ title: 'CarbonChart/Meter',
9
+ argTypes: {
10
+ isInverse: {
11
+ control: {
12
+ type: 'boolean',
13
+ },
14
+ },
15
+ type: {
16
+ control: {
17
+ type: 'select',
18
+ options: CarbonChartType,
19
+ },
20
+ },
21
+ },
22
+ } as Meta;
23
+
24
+ const Template: Story<CarbonChartProps> = args => (
25
+ <Card isInverse={args.isInverse} style={{ padding: '12px' }}>
26
+ <CarbonChart {...args} />
27
+ </Card>
28
+ );
29
+
30
+ export const MeterChartWithStatuses = Template.bind({});
31
+ MeterChartWithStatuses.args = {
32
+ isInverse: false,
33
+ type: CarbonChartType.meter,
34
+ dataSet: [
35
+ {
36
+ group: 'Dataset 1',
37
+ value: 56,
38
+ },
39
+ ],
40
+ options: {
41
+ title: 'Meter Chart - with statuses',
42
+ meter: {
43
+ peak: 80,
44
+ status: {
45
+ ranges: [
46
+ {
47
+ range: [0, 50],
48
+ status: 'success',
49
+ },
50
+ {
51
+ range: [50, 60],
52
+ status: 'warning',
53
+ },
54
+ {
55
+ range: [60, 100],
56
+ status: 'danger',
57
+ },
58
+ ],
59
+ },
60
+ },
61
+ height: '100px',
62
+ },
63
+ };
64
+
65
+ // Uncomment when adding new charts. Issues: #1054, #1055, #1056
66
+
67
+ // export const MeterChartNoStatus = Template.bind({});
68
+ // MeterChartNoStatus.args = {
69
+ // isInverse: false,
70
+ // type: CarbonChartType.meter,
71
+ // dataSet: [
72
+ // {
73
+ // group: 'Dataset 1',
74
+ // value: 56,
75
+ // },
76
+ // ],
77
+ // options: {
78
+ // title: 'Meter Chart - no status',
79
+ // meter: {
80
+ // peak: 70,
81
+ // },
82
+ // height: '100px',
83
+ // },
84
+ // };
85
+
86
+ // export const ProportionalMeterChart = Template.bind({});
87
+ // ProportionalMeterChart.args = {
88
+ // isInverse: false,
89
+ // type: CarbonChartType.meter,
90
+ // dataSet: [
91
+ // {
92
+ // group: 'emails',
93
+ // value: 202,
94
+ // },
95
+ // {
96
+ // group: 'photos',
97
+ // value: 654,
98
+ // },
99
+ // {
100
+ // group: 'text messages',
101
+ // value: 723,
102
+ // },
103
+ // {
104
+ // group: 'other',
105
+ // value: 120,
106
+ // },
107
+ // ],
108
+ // options: {
109
+ // title: 'Proportional Meter Chart',
110
+ // height: '130px',
111
+ // meter: {
112
+ // proportional: {
113
+ // total: 2000,
114
+ // unit: 'GB',
115
+ // },
116
+ // },
117
+ // color: {
118
+ // pairing: {
119
+ // option: 2,
120
+ // },
121
+ // },
122
+ // },
123
+ // };
124
+
125
+ // export const ProportionalMeterChartPeakAndStatuses = Template.bind({});
126
+ // ProportionalMeterChartPeakAndStatuses.args = {
127
+ // isInverse: false,
128
+ // type: CarbonChartType.meter,
129
+ // dataSet: [
130
+ // {
131
+ // group: 'emails',
132
+ // value: 202,
133
+ // },
134
+ // {
135
+ // group: 'photos',
136
+ // value: 654,
137
+ // },
138
+ // {
139
+ // group: 'text messages',
140
+ // value: 723,
141
+ // },
142
+ // {
143
+ // group: 'other',
144
+ // value: 120,
145
+ // },
146
+ // ],
147
+ // options: {
148
+ // title: 'Proportional Meter Chart - peak and statuses',
149
+ // height: '130px',
150
+ // meter: {
151
+ // peak: 1800,
152
+ // proportional: {
153
+ // total: 2000,
154
+ // unit: 'GB',
155
+ // },
156
+ // status: {
157
+ // ranges: [
158
+ // {
159
+ // range: [0, 800],
160
+ // status: 'success',
161
+ // },
162
+ // {
163
+ // range: [800, 1800],
164
+ // status: 'warning',
165
+ // },
166
+ // {
167
+ // range: [1800, 2000],
168
+ // status: 'danger',
169
+ // },
170
+ // ],
171
+ // },
172
+ // },
173
+ // color: {
174
+ // pairing: {
175
+ // option: 2,
176
+ // },
177
+ // },
178
+ // },
179
+ // };
180
+
181
+ // export const ProportionalMeterChartTruncated = Template.bind({});
182
+ // ProportionalMeterChartTruncated.args = {
183
+ // isInverse: false,
184
+ // type: CarbonChartType.meter,
185
+ // dataSet: [
186
+ // {
187
+ // group: 'emails',
188
+ // value: 202,
189
+ // },
190
+ // {
191
+ // group: 'photos',
192
+ // value: 654,
193
+ // },
194
+ // {
195
+ // group: 'text messages',
196
+ // value: 723,
197
+ // },
198
+ // {
199
+ // group: 'other',
200
+ // value: 120,
201
+ // },
202
+ // ],
203
+ // options: {
204
+ // title: 'Proportional Meter Chart (truncated)',
205
+ // height: '130px',
206
+ // meter: {
207
+ // proportional: {
208
+ // total: 2000,
209
+ // unit: 'MB',
210
+ // totalFormatter: e => `custom total string for: ${e}`,
211
+ // breakdownFormatter: e =>
212
+ // `You are using ${e.datasetsTotal} GB of the space this label is really long will need to be truncated with a tooltip Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`,
213
+ // },
214
+ // },
215
+ // },
216
+ // };
@@ -0,0 +1,479 @@
1
+ import React from 'react';
2
+ import { Story, Meta } from '@storybook/react/types-6-0';
3
+ import { CarbonChart, CarbonChartProps, CarbonChartType } from '.';
4
+ import { Card } from 'react-magma-dom';
5
+
6
+ export default {
7
+ component: CarbonChart,
8
+ title: 'CarbonChart/Radar',
9
+ argTypes: {
10
+ isInverse: {
11
+ control: {
12
+ type: 'boolean',
13
+ },
14
+ },
15
+ type: {
16
+ control: {
17
+ type: 'select',
18
+ options: CarbonChartType,
19
+ },
20
+ },
21
+ },
22
+ } as Meta;
23
+
24
+ const Template: Story<CarbonChartProps> = args => (
25
+ <Card isInverse={args.isInverse} style={{ padding: '12px' }}>
26
+ <CarbonChart {...args} />
27
+ </Card>
28
+ );
29
+
30
+ export const Radar = Template.bind({});
31
+ Radar.args = {
32
+ isInverse: false,
33
+ type: CarbonChartType.radar,
34
+ dataSet: [
35
+ {
36
+ product: 'Product 1',
37
+ feature: 'Price',
38
+ score: 60,
39
+ },
40
+ {
41
+ product: 'Product 1',
42
+ feature: 'Usability',
43
+ score: 92,
44
+ },
45
+ {
46
+ product: 'Product 1',
47
+ feature: 'Availability',
48
+ score: 5,
49
+ },
50
+ {
51
+ product: 'Product 1',
52
+ feature: 'Performance',
53
+ score: 85,
54
+ },
55
+ {
56
+ product: 'Product 1',
57
+ feature: 'Quality',
58
+ score: 60,
59
+ },
60
+ {
61
+ product: 'Product 2',
62
+ feature: 'Price',
63
+ score: 70,
64
+ },
65
+ {
66
+ product: 'Product 2',
67
+ feature: 'Usability',
68
+ score: 63,
69
+ },
70
+ {
71
+ product: 'Product 2',
72
+ feature: 'Availability',
73
+ score: 78,
74
+ },
75
+ {
76
+ product: 'Product 2',
77
+ feature: 'Performance',
78
+ score: 50,
79
+ },
80
+ {
81
+ product: 'Product 2',
82
+ feature: 'Quality',
83
+ score: 30,
84
+ },
85
+ ],
86
+ options: {
87
+ title: 'Radar',
88
+ radar: {
89
+ axes: {
90
+ angle: 'feature',
91
+ value: 'score',
92
+ },
93
+ },
94
+ data: {
95
+ groupMapsTo: 'product',
96
+ },
97
+ height: '400px',
98
+ },
99
+ };
100
+
101
+ // Uncomment when adding new charts. Issues: #1054, #1055, #1056
102
+
103
+ // export const RadarCentered = Template.bind({});
104
+ // RadarCentered.args = {
105
+ // isInverse: false,
106
+ // type: CarbonChartType.radar,
107
+ // dataSet: [
108
+ // {
109
+ // product: 'Product 1',
110
+ // feature: 'Price',
111
+ // score: 60,
112
+ // },
113
+ // {
114
+ // product: 'Product 1',
115
+ // feature: 'Usability',
116
+ // score: 92,
117
+ // },
118
+ // {
119
+ // product: 'Product 1',
120
+ // feature: 'Availability',
121
+ // score: 5,
122
+ // },
123
+ // {
124
+ // product: 'Product 1',
125
+ // feature: 'Performance',
126
+ // score: 85,
127
+ // },
128
+ // {
129
+ // product: 'Product 1',
130
+ // feature: 'Quality',
131
+ // score: 60,
132
+ // },
133
+ // {
134
+ // product: 'Product 2',
135
+ // feature: 'Price',
136
+ // score: 70,
137
+ // },
138
+ // {
139
+ // product: 'Product 2',
140
+ // feature: 'Usability',
141
+ // score: 63,
142
+ // },
143
+ // {
144
+ // product: 'Product 2',
145
+ // feature: 'Availability',
146
+ // score: 78,
147
+ // },
148
+ // {
149
+ // product: 'Product 2',
150
+ // feature: 'Performance',
151
+ // score: 50,
152
+ // },
153
+ // {
154
+ // product: 'Product 2',
155
+ // feature: 'Quality',
156
+ // score: 30,
157
+ // },
158
+ // ],
159
+ // options: {
160
+ // title: 'Radar (centered)',
161
+ // radar: {
162
+ // axes: {
163
+ // angle: 'feature',
164
+ // value: 'score',
165
+ // },
166
+ // alignment: 'center',
167
+ // },
168
+ // data: {
169
+ // groupMapsTo: 'product',
170
+ // },
171
+ // legend: {
172
+ // alignment: 'center',
173
+ // },
174
+ // height: '400px',
175
+ // },
176
+ // };
177
+
178
+ // export const RadarMissingDatapoints = Template.bind({});
179
+ // RadarMissingDatapoints.args = {
180
+ // isInverse: false,
181
+ // type: CarbonChartType.radar,
182
+ // dataSet: [
183
+ // {
184
+ // group: 'Sugar',
185
+ // key: 'London',
186
+ // value: 25,
187
+ // },
188
+ // {
189
+ // group: 'Oil',
190
+ // key: 'London',
191
+ // value: 6,
192
+ // },
193
+ // {
194
+ // group: 'Water',
195
+ // key: 'London',
196
+ // value: 12,
197
+ // },
198
+ // {
199
+ // group: 'Sugar',
200
+ // key: 'Milan',
201
+ // value: 13,
202
+ // },
203
+ // {
204
+ // group: 'Oil',
205
+ // key: 'Milan',
206
+ // value: 6,
207
+ // },
208
+ // {
209
+ // group: 'Water',
210
+ // key: 'Milan',
211
+ // value: 28,
212
+ // },
213
+ // {
214
+ // group: 'Sugar',
215
+ // key: 'Paris',
216
+ // value: 19,
217
+ // },
218
+ // {
219
+ // group: 'Oil',
220
+ // key: 'Paris',
221
+ // value: 16,
222
+ // },
223
+ // {
224
+ // group: 'Water',
225
+ // key: 'Paris',
226
+ // value: 10,
227
+ // },
228
+ // {
229
+ // group: 'Sugar',
230
+ // key: 'New York',
231
+ // value: 11,
232
+ // },
233
+ // {
234
+ // group: 'Oil',
235
+ // key: 'New York',
236
+ // value: 18,
237
+ // },
238
+ // {
239
+ // group: 'Water',
240
+ // key: 'New York',
241
+ // value: 8,
242
+ // },
243
+ // {
244
+ // group: 'Sugar',
245
+ // key: 'Sydney',
246
+ // value: 12,
247
+ // },
248
+ // {
249
+ // group: 'Oil',
250
+ // key: 'Sydney',
251
+ // value: 16,
252
+ // },
253
+ // ],
254
+ // options: {
255
+ // title: 'Radar - Missing datapoints',
256
+ // height: '400px',
257
+ // },
258
+ // };
259
+
260
+ // export const RadarDense = Template.bind({});
261
+ // RadarDense.args = {
262
+ // isInverse: false,
263
+ // type: CarbonChartType.radar,
264
+ // dataSet: [
265
+ // {
266
+ // month: 'January',
267
+ // activity: 'Eating',
268
+ // hoursAvg: 2,
269
+ // },
270
+ // {
271
+ // month: 'January',
272
+ // activity: 'Drinking',
273
+ // hoursAvg: 6,
274
+ // },
275
+ // {
276
+ // month: 'January',
277
+ // activity: 'Sleeping',
278
+ // hoursAvg: 6,
279
+ // },
280
+ // {
281
+ // month: 'January',
282
+ // activity: 'Working',
283
+ // hoursAvg: 8,
284
+ // },
285
+ // {
286
+ // month: 'January',
287
+ // activity: 'Walking',
288
+ // hoursAvg: 1,
289
+ // },
290
+ // {
291
+ // month: 'January',
292
+ // activity: 'Running',
293
+ // hoursAvg: 0.5,
294
+ // },
295
+ // {
296
+ // month: 'January',
297
+ // activity: 'Cycling',
298
+ // hoursAvg: 1,
299
+ // },
300
+ // {
301
+ // month: 'January',
302
+ // activity: 'Swimming',
303
+ // hoursAvg: 0,
304
+ // },
305
+ // {
306
+ // month: 'February',
307
+ // activity: 'Eating',
308
+ // hoursAvg: 1.5,
309
+ // },
310
+ // {
311
+ // month: 'February',
312
+ // activity: 'Drinking',
313
+ // hoursAvg: 9,
314
+ // },
315
+ // {
316
+ // month: 'February',
317
+ // activity: 'Sleeping',
318
+ // hoursAvg: 7,
319
+ // },
320
+ // {
321
+ // month: 'February',
322
+ // activity: 'Working',
323
+ // hoursAvg: 9,
324
+ // },
325
+ // {
326
+ // month: 'February',
327
+ // activity: 'Walking',
328
+ // hoursAvg: 2,
329
+ // },
330
+ // {
331
+ // month: 'February',
332
+ // activity: 'Running',
333
+ // hoursAvg: 2,
334
+ // },
335
+ // {
336
+ // month: 'February',
337
+ // activity: 'Cycling',
338
+ // hoursAvg: 0,
339
+ // },
340
+ // {
341
+ // month: 'February',
342
+ // activity: 'Swimming',
343
+ // hoursAvg: 1.5,
344
+ // },
345
+ // {
346
+ // month: 'March',
347
+ // activity: 'Eating',
348
+ // hoursAvg: 3,
349
+ // },
350
+ // {
351
+ // month: 'March',
352
+ // activity: 'Drinking',
353
+ // hoursAvg: 5,
354
+ // },
355
+ // {
356
+ // month: 'March',
357
+ // activity: 'Sleeping',
358
+ // hoursAvg: 5,
359
+ // },
360
+ // {
361
+ // month: 'March',
362
+ // activity: 'Working',
363
+ // hoursAvg: 6,
364
+ // },
365
+ // {
366
+ // month: 'March',
367
+ // activity: 'Walking',
368
+ // hoursAvg: 3,
369
+ // },
370
+ // {
371
+ // month: 'March',
372
+ // activity: 'Running',
373
+ // hoursAvg: 9,
374
+ // },
375
+ // {
376
+ // month: 'March',
377
+ // activity: 'Cycling',
378
+ // hoursAvg: 1,
379
+ // },
380
+ // {
381
+ // month: 'March',
382
+ // activity: 'Swimming',
383
+ // hoursAvg: 7,
384
+ // },
385
+ // {
386
+ // month: 'April',
387
+ // activity: 'Eating',
388
+ // hoursAvg: 5,
389
+ // },
390
+ // {
391
+ // month: 'April',
392
+ // activity: 'Drinking',
393
+ // hoursAvg: 1,
394
+ // },
395
+ // {
396
+ // month: 'April',
397
+ // activity: 'Sleeping',
398
+ // hoursAvg: 4,
399
+ // },
400
+ // {
401
+ // month: 'April',
402
+ // activity: 'Working',
403
+ // hoursAvg: 2,
404
+ // },
405
+ // {
406
+ // month: 'April',
407
+ // activity: 'Walking',
408
+ // hoursAvg: 5,
409
+ // },
410
+ // {
411
+ // month: 'April',
412
+ // activity: 'Running',
413
+ // hoursAvg: 4,
414
+ // },
415
+ // {
416
+ // month: 'April',
417
+ // activity: 'Cycling',
418
+ // hoursAvg: 6,
419
+ // },
420
+ // {
421
+ // month: 'April',
422
+ // activity: 'Swimming',
423
+ // hoursAvg: 3,
424
+ // },
425
+ // {
426
+ // month: 'May',
427
+ // activity: 'Eating',
428
+ // hoursAvg: 7,
429
+ // },
430
+ // {
431
+ // month: 'May',
432
+ // activity: 'Drinking',
433
+ // hoursAvg: 0,
434
+ // },
435
+ // {
436
+ // month: 'May',
437
+ // activity: 'Sleeping',
438
+ // hoursAvg: 5,
439
+ // },
440
+ // {
441
+ // month: 'May',
442
+ // activity: 'Working',
443
+ // hoursAvg: 4,
444
+ // },
445
+ // {
446
+ // month: 'May',
447
+ // activity: 'Walking',
448
+ // hoursAvg: 8,
449
+ // },
450
+ // {
451
+ // month: 'May',
452
+ // activity: 'Running',
453
+ // hoursAvg: 2,
454
+ // },
455
+ // {
456
+ // month: 'May',
457
+ // activity: 'Cycling',
458
+ // hoursAvg: 3,
459
+ // },
460
+ // {
461
+ // month: 'May',
462
+ // activity: 'Swimming',
463
+ // hoursAvg: 1,
464
+ // },
465
+ // ],
466
+ // options: {
467
+ // title: 'Radar - Dense',
468
+ // radar: {
469
+ // axes: {
470
+ // angle: 'activity',
471
+ // value: 'hoursAvg',
472
+ // },
473
+ // },
474
+ // data: {
475
+ // groupMapsTo: 'month',
476
+ // },
477
+ // height: '400px',
478
+ // },
479
+ // };