@react-magma/charts 12.0.0-next.6 → 12.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 (45) hide show
  1. package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +308 -10
  2. package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +134 -5
  3. package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +212 -10
  4. package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +80 -4
  5. package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +232 -11
  6. package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +264 -12
  7. package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +51 -3
  8. package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +194 -7
  9. package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +33 -2
  10. package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +578 -13
  11. package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +118 -6
  12. package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +41 -3
  13. package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +87 -4
  14. package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +575 -18
  15. package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +53 -3
  16. package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +125 -6
  17. package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +99 -6
  18. package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +96 -5
  19. package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +171 -7
  20. package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +49 -2
  21. package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +36 -2
  22. package/dist/components/LineChart/LineChart.stories.d.ts +132 -21
  23. package/package.json +3 -3
  24. package/src/components/CarbonChart/CarbonChartArea.stories.tsx +674 -649
  25. package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +424 -414
  26. package/src/components/CarbonChart/CarbonChartBar.stories.tsx +352 -325
  27. package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +127 -116
  28. package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +872 -843
  29. package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +913 -879
  30. package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +238 -232
  31. package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +565 -547
  32. package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +59 -56
  33. package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1335 -1299
  34. package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +170 -153
  35. package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +50 -44
  36. package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +733 -724
  37. package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1656 -1605
  38. package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +81 -76
  39. package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +177 -162
  40. package/src/components/CarbonChart/CarbonChartPie.stories.tsx +154 -139
  41. package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +445 -433
  42. package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +427 -409
  43. package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +191 -188
  44. package/src/components/CarbonChart/CarbonChartStep.stories.tsx +145 -142
  45. package/src/components/LineChart/LineChart.stories.tsx +91 -104
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { Story, Meta } from '@storybook/react/types-6-0';
3
+ import { StoryFn, Meta } from '@storybook/react/types-6-0';
4
4
  import { Card } from 'react-magma-dom';
5
5
 
6
6
  import { CarbonChart, CarbonChartProps, CarbonChartType } from '.';
@@ -23,153 +23,156 @@ export default {
23
23
  },
24
24
  } as Meta;
25
25
 
26
- const Template: Story<CarbonChartProps> = args => (
26
+ const Template: StoryFn<CarbonChartProps> = args => (
27
27
  <Card isInverse={args.isInverse} style={{ padding: '12px' }}>
28
28
  <CarbonChart {...args} />
29
29
  </Card>
30
30
  );
31
31
 
32
- export const StepTimeSeries = Template.bind({});
33
- StepTimeSeries.args = {
34
- isInverse: false,
35
- type: CarbonChartType.line,
36
- dataSet: [
37
- {
38
- group: 'Dataset 1',
39
- date: '2018-12-31T23:00:00.000Z',
40
- value: 50000,
41
- surplus: 844630247.9315708,
42
- },
43
- {
44
- group: 'Dataset 1',
45
- date: '2019-01-04T23:00:00.000Z',
46
- value: 65000,
47
- surplus: 722253377.7025548,
48
- },
49
- {
50
- group: 'Dataset 1',
51
- date: '2019-01-07T23:00:00.000Z',
52
- value: null,
53
- surplus: 9586.628515900247,
54
- },
55
- {
56
- group: 'Dataset 1',
57
- date: '2019-01-12T23:00:00.000Z',
58
- value: 49213,
59
- surplus: 519710030.3060996,
60
- },
61
- {
62
- group: 'Dataset 1',
63
- date: '2019-01-16T23:00:00.000Z',
64
- value: 51213,
65
- surplus: 964336709.1293422,
66
- },
67
- {
68
- group: 'Dataset 2',
69
- date: '2019-01-01T23:00:00.000Z',
70
- value: 0,
71
- surplus: 24733.73210194359,
72
- },
73
- {
74
- group: 'Dataset 2',
75
- date: '2019-01-05T23:00:00.000Z',
76
- value: 57312,
77
- surplus: 2104847.5679499935,
78
- },
79
- {
80
- group: 'Dataset 2',
81
- date: '2019-01-07T23:00:00.000Z',
82
- value: 27432,
83
- surplus: 632664658.6542752,
84
- },
85
- {
86
- group: 'Dataset 2',
87
- date: '2019-01-14T23:00:00.000Z',
88
- value: 70323,
89
- surplus: 1484604165.9194114,
90
- },
91
- {
92
- group: 'Dataset 2',
93
- date: '2019-01-18T23:00:00.000Z',
94
- value: 21300,
95
- surplus: 228423489.25766274,
96
- },
97
- {
98
- group: 'Dataset 3',
99
- date: '2018-12-31T23:00:00.000Z',
100
- value: 40000,
101
- surplus: 634264360.9426379,
102
- },
103
- {
104
- group: 'Dataset 3',
105
- date: '2019-01-04T23:00:00.000Z',
106
- value: null,
107
- surplus: 781.4728603674881,
108
- },
109
- {
110
- group: 'Dataset 3',
111
- date: '2019-01-07T23:00:00.000Z',
112
- value: 18000,
113
- surplus: 210741530.6295638,
114
- },
115
- {
116
- group: 'Dataset 3',
117
- date: '2019-01-12T23:00:00.000Z',
118
- value: 39213,
119
- surplus: 135260712.71714658,
120
- },
121
- {
122
- group: 'Dataset 3',
123
- date: '2019-01-16T23:00:00.000Z',
124
- value: 61213,
125
- surplus: 313154331.2033775,
126
- },
127
- {
128
- group: 'Dataset 4',
129
- date: '2019-01-01T23:00:00.000Z',
130
- value: 20000,
131
- surplus: 450715657.7789645,
132
- },
133
- {
134
- group: 'Dataset 4',
135
- date: '2019-01-05T23:00:00.000Z',
136
- value: 37312,
137
- surplus: 60444212.38584305,
138
- },
139
- {
140
- group: 'Dataset 4',
141
- date: '2019-01-07T23:00:00.000Z',
142
- value: 51432,
143
- surplus: 1007946419.445114,
144
- },
145
- {
146
- group: 'Dataset 4',
147
- date: '2019-01-14T23:00:00.000Z',
148
- value: 25332,
149
- surplus: 281099594.1962531,
150
- },
151
- {
152
- group: 'Dataset 4',
153
- date: '2019-01-18T23:00:00.000Z',
154
- value: null,
155
- surplus: 1928.4268222770295,
156
- },
157
- ],
158
- options: {
159
- title: 'Step (time series)',
160
- axes: {
161
- bottom: {
162
- title: '2019 Annual Sales Figures',
163
- mapsTo: 'date',
164
- scaleType: 'time',
165
- },
166
- left: {
167
- mapsTo: 'value',
168
- title: 'Conversion rate',
169
- scaleType: 'linear',
32
+ export const StepTimeSeries = {
33
+ render: Template,
34
+
35
+ args: {
36
+ isInverse: false,
37
+ type: CarbonChartType.line,
38
+ dataSet: [
39
+ {
40
+ group: 'Dataset 1',
41
+ date: '2018-12-31T23:00:00.000Z',
42
+ value: 50000,
43
+ surplus: 844630247.9315708,
44
+ },
45
+ {
46
+ group: 'Dataset 1',
47
+ date: '2019-01-04T23:00:00.000Z',
48
+ value: 65000,
49
+ surplus: 722253377.7025548,
50
+ },
51
+ {
52
+ group: 'Dataset 1',
53
+ date: '2019-01-07T23:00:00.000Z',
54
+ value: null,
55
+ surplus: 9586.628515900247,
56
+ },
57
+ {
58
+ group: 'Dataset 1',
59
+ date: '2019-01-12T23:00:00.000Z',
60
+ value: 49213,
61
+ surplus: 519710030.3060996,
62
+ },
63
+ {
64
+ group: 'Dataset 1',
65
+ date: '2019-01-16T23:00:00.000Z',
66
+ value: 51213,
67
+ surplus: 964336709.1293422,
68
+ },
69
+ {
70
+ group: 'Dataset 2',
71
+ date: '2019-01-01T23:00:00.000Z',
72
+ value: 0,
73
+ surplus: 24733.73210194359,
74
+ },
75
+ {
76
+ group: 'Dataset 2',
77
+ date: '2019-01-05T23:00:00.000Z',
78
+ value: 57312,
79
+ surplus: 2104847.5679499935,
80
+ },
81
+ {
82
+ group: 'Dataset 2',
83
+ date: '2019-01-07T23:00:00.000Z',
84
+ value: 27432,
85
+ surplus: 632664658.6542752,
86
+ },
87
+ {
88
+ group: 'Dataset 2',
89
+ date: '2019-01-14T23:00:00.000Z',
90
+ value: 70323,
91
+ surplus: 1484604165.9194114,
92
+ },
93
+ {
94
+ group: 'Dataset 2',
95
+ date: '2019-01-18T23:00:00.000Z',
96
+ value: 21300,
97
+ surplus: 228423489.25766274,
98
+ },
99
+ {
100
+ group: 'Dataset 3',
101
+ date: '2018-12-31T23:00:00.000Z',
102
+ value: 40000,
103
+ surplus: 634264360.9426379,
104
+ },
105
+ {
106
+ group: 'Dataset 3',
107
+ date: '2019-01-04T23:00:00.000Z',
108
+ value: null,
109
+ surplus: 781.4728603674881,
110
+ },
111
+ {
112
+ group: 'Dataset 3',
113
+ date: '2019-01-07T23:00:00.000Z',
114
+ value: 18000,
115
+ surplus: 210741530.6295638,
116
+ },
117
+ {
118
+ group: 'Dataset 3',
119
+ date: '2019-01-12T23:00:00.000Z',
120
+ value: 39213,
121
+ surplus: 135260712.71714658,
122
+ },
123
+ {
124
+ group: 'Dataset 3',
125
+ date: '2019-01-16T23:00:00.000Z',
126
+ value: 61213,
127
+ surplus: 313154331.2033775,
128
+ },
129
+ {
130
+ group: 'Dataset 4',
131
+ date: '2019-01-01T23:00:00.000Z',
132
+ value: 20000,
133
+ surplus: 450715657.7789645,
134
+ },
135
+ {
136
+ group: 'Dataset 4',
137
+ date: '2019-01-05T23:00:00.000Z',
138
+ value: 37312,
139
+ surplus: 60444212.38584305,
140
+ },
141
+ {
142
+ group: 'Dataset 4',
143
+ date: '2019-01-07T23:00:00.000Z',
144
+ value: 51432,
145
+ surplus: 1007946419.445114,
146
+ },
147
+ {
148
+ group: 'Dataset 4',
149
+ date: '2019-01-14T23:00:00.000Z',
150
+ value: 25332,
151
+ surplus: 281099594.1962531,
152
+ },
153
+ {
154
+ group: 'Dataset 4',
155
+ date: '2019-01-18T23:00:00.000Z',
156
+ value: null,
157
+ surplus: 1928.4268222770295,
158
+ },
159
+ ],
160
+ options: {
161
+ title: 'Step (time series)',
162
+ axes: {
163
+ bottom: {
164
+ title: '2019 Annual Sales Figures',
165
+ mapsTo: 'date',
166
+ scaleType: 'time',
167
+ },
168
+ left: {
169
+ mapsTo: 'value',
170
+ title: 'Conversion rate',
171
+ scaleType: 'linear',
172
+ },
170
173
  },
174
+ curve: 'curveStepAfter',
175
+ height: '400px',
171
176
  },
172
- curve: 'curveStepAfter',
173
- height: '400px',
174
177
  },
175
178
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { Story, Meta } from '@storybook/react/types-6-0';
3
+ import { StoryFn, Meta } from '@storybook/react/types-6-0';
4
4
 
5
5
  import {
6
6
  historyOfTexas as historyOfTexasData,
@@ -53,8 +53,6 @@ const data = [
53
53
  },
54
54
  ];
55
55
 
56
- const Template: Story<ChartProps<any>> = args => <Chart {...args} />;
57
-
58
56
  export default {
59
57
  title: 'Chart',
60
58
  component: Chart,
@@ -65,22 +63,23 @@ const title = 'Annual sales figures for 2019';
65
63
  const description =
66
64
  'description - Lorem ipsum dolor sitamet, consectetur adipiscing elit.';
67
65
 
68
- export const Default = Template.bind({});
69
- Default.args = {
70
- data: data,
71
- description,
72
- title,
73
- type: 'line',
74
- componentProps: {
75
- xAxis: {
76
- label: '2019 Annual Sales Figures',
77
- tickFormat: ['Jan', 'Feb', 'March', 'April', 'May'],
78
- },
79
- yAxis: {
80
- domain: [10, 80],
81
- label: 'Conversion Rate',
82
- tickFormat: t => `$${t}k`,
83
- tickValues: [10, 20, 30, 40, 50, 60, 70, 80],
66
+ export const Default = {
67
+ args: {
68
+ data: data,
69
+ description,
70
+ title,
71
+ type: 'line',
72
+ componentProps: {
73
+ xAxis: {
74
+ label: '2019 Annual Sales Figures',
75
+ tickFormat: ['Jan', 'Feb', 'March', 'April', 'May'],
76
+ },
77
+ yAxis: {
78
+ domain: [10, 80],
79
+ label: 'Conversion Rate',
80
+ tickFormat: t => `$${t}k`,
81
+ tickValues: [10, 20, 30, 40, 50, 60, 70, 80],
82
+ },
84
83
  },
85
84
  },
86
85
  };
@@ -298,36 +297,33 @@ const explicitData = [
298
297
  },
299
298
  ];
300
299
 
301
- const ExplicitDataTemplate: Story<ChartProps<ExplicitDataInterface>> = args => (
302
- <Chart {...args} />
303
- );
304
-
305
- export const ExplicitData = ExplicitDataTemplate.bind({});
306
- ExplicitData.args = {
307
- ...Default.args,
308
- componentProps: {
309
- ...Default.args.componentProps,
310
- xAxis: {
311
- ...Default.args.componentProps.xAxis,
312
- tickFormat: [
313
- 'Jan',
314
- 'Feb',
315
- 'March',
316
- 'April',
317
- 'May',
318
- 'June',
319
- 'July',
320
- 'Aug',
321
- 'Sept',
322
- 'Oct',
323
- 'Nov',
324
- 'Dec',
325
- ],
300
+ export const ExplicitData = {
301
+ args: {
302
+ ...Default.args,
303
+ componentProps: {
304
+ ...Default.args.componentProps,
305
+ xAxis: {
306
+ ...Default.args.componentProps.xAxis,
307
+ tickFormat: [
308
+ 'Jan',
309
+ 'Feb',
310
+ 'March',
311
+ 'April',
312
+ 'May',
313
+ 'June',
314
+ 'July',
315
+ 'Aug',
316
+ 'Sept',
317
+ 'Oct',
318
+ 'Nov',
319
+ 'Dec',
320
+ ],
321
+ },
326
322
  },
323
+ data: explicitData,
324
+ x: 'month',
325
+ y: 'sales',
327
326
  },
328
- data: explicitData,
329
- x: 'month',
330
- y: 'sales',
331
327
  };
332
328
 
333
329
  interface HistoryOfTexasInterface {
@@ -336,49 +332,43 @@ interface HistoryOfTexasInterface {
336
332
  label: string;
337
333
  }
338
334
 
339
- const HistoryOfTexasTemplate: Story<
340
- ChartProps<HistoryOfTexasInterface>
341
- > = args => <Chart {...args} />;
342
-
343
- export const HistoryOfTexas = HistoryOfTexasTemplate.bind({});
344
- HistoryOfTexas.args = {
345
- ...Default.args,
346
- description: 'Number of enslaved people in Texas',
347
- title: 'History of Texas',
348
- componentProps: {
349
- xAxis: {
350
- label: 'Number of enslaved people',
351
- tickValues: [1830, 1835, 1840, 1845, 1850, 1855, 1860, 1865],
352
- },
353
- yAxis: {
354
- label: 'Year',
355
- tickFormat: t => t.toLocaleString(),
356
- tickValues: [
357
- 0, 20000, 40000, 60000, 80000, 100000, 120000, 140000, 160000, 180000,
358
- ],
335
+ export const HistoryOfTexas = {
336
+ args: {
337
+ ...Default.args,
338
+ description: 'Number of enslaved people in Texas',
339
+ title: 'History of Texas',
340
+ componentProps: {
341
+ xAxis: {
342
+ label: 'Number of enslaved people',
343
+ tickValues: [1830, 1835, 1840, 1845, 1850, 1855, 1860, 1865],
344
+ },
345
+ yAxis: {
346
+ label: 'Year',
347
+ tickFormat: t => t.toLocaleString(),
348
+ tickValues: [
349
+ 0, 20000, 40000, 60000, 80000, 100000, 120000, 140000, 160000, 180000,
350
+ ],
351
+ },
359
352
  },
353
+ data: historyOfTexasData,
354
+ x: 'year',
355
+ y: 'number',
360
356
  },
361
- data: historyOfTexasData,
362
- x: 'year',
363
- y: 'number',
364
357
  };
365
358
 
366
- const SpendingRevenueTemplate: Story<ChartProps<any>> = args => (
367
- <Chart {...args} />
368
- );
369
-
370
- export const SpendingRevenue = SpendingRevenueTemplate.bind({});
371
- SpendingRevenue.args = {
372
- data: spendingRevenueData,
373
- title: 'Spending Revenue',
374
- type: 'line',
375
- componentProps: {
376
- xAxis: {
377
- label: '',
378
- },
379
- yAxis: {
380
- label: 'Average %',
381
- tickValues: [0, 2, 4, 6, 8, 10, 12, 14],
359
+ export const SpendingRevenue = {
360
+ args: {
361
+ data: spendingRevenueData,
362
+ title: 'Spending Revenue',
363
+ type: 'line',
364
+ componentProps: {
365
+ xAxis: {
366
+ label: '',
367
+ },
368
+ yAxis: {
369
+ label: 'Average %',
370
+ tickValues: [0, 2, 4, 6, 8, 10, 12, 14],
371
+ },
382
372
  },
383
373
  },
384
374
  };
@@ -389,24 +379,21 @@ interface VotingParticipationInterface {
389
379
  label: string;
390
380
  }
391
381
 
392
- const VotingParticipationTemplate: Story<
393
- ChartProps<VotingParticipationInterface>
394
- > = args => <Chart {...args} />;
395
-
396
- export const VotingParticipation = VotingParticipationTemplate.bind({});
397
- VotingParticipation.args = {
398
- data: votingParticipationData,
399
- title: 'Turnout in elections since 2000: US and Texas',
400
- type: 'line',
401
- componentProps: {
402
- xAxis: {
403
- label: 'Year',
404
- },
405
- yAxis: {
406
- domain: [10, 80],
407
- label: 'Percent',
382
+ export const VotingParticipation = {
383
+ args: {
384
+ data: votingParticipationData,
385
+ title: 'Turnout in elections since 2000: US and Texas',
386
+ type: 'line',
387
+ componentProps: {
388
+ xAxis: {
389
+ label: 'Year',
390
+ },
391
+ yAxis: {
392
+ domain: [10, 80],
393
+ label: 'Percent',
394
+ },
408
395
  },
396
+ x: 'year',
397
+ y: 'percent',
409
398
  },
410
- x: 'year',
411
- y: 'percent',
412
399
  };