@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.
- package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +308 -10
- package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +134 -5
- package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +212 -10
- package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +80 -4
- package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +232 -11
- package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +264 -12
- package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +51 -3
- package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +194 -7
- package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +33 -2
- package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +578 -13
- package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +118 -6
- package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +41 -3
- package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +87 -4
- package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +575 -18
- package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +53 -3
- package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +125 -6
- package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +99 -6
- package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +96 -5
- package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +171 -7
- package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +49 -2
- package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +36 -2
- package/dist/components/LineChart/LineChart.stories.d.ts +132 -21
- package/package.json +3 -3
- package/src/components/CarbonChart/CarbonChartArea.stories.tsx +674 -649
- package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +424 -414
- package/src/components/CarbonChart/CarbonChartBar.stories.tsx +352 -325
- package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +127 -116
- package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +872 -843
- package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +913 -879
- package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +238 -232
- package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +565 -547
- package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +59 -56
- package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1335 -1299
- package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +170 -153
- package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +50 -44
- package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +733 -724
- package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1656 -1605
- package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +81 -76
- package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +177 -162
- package/src/components/CarbonChart/CarbonChartPie.stories.tsx +154 -139
- package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +445 -433
- package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +427 -409
- package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +191 -188
- package/src/components/CarbonChart/CarbonChartStep.stories.tsx +145 -142
- package/src/components/LineChart/LineChart.stories.tsx +91 -104
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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:
|
|
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 =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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 {
|
|
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 =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
};
|