@react-magma/charts 10.0.0 → 10.0.1-next.1
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/charts +13 -13
- package/dist/charts.js +1 -1
- package/dist/charts.js.map +1 -1
- package/dist/charts.map +1 -1
- package/dist/charts.modern.module.js +1 -1
- package/dist/charts.modern.module.js.map +1 -1
- package/dist/charts.umd.js +1 -1
- package/dist/charts.umd.js.map +1 -1
- package/dist/components/CarbonChart/CarbonChart.d.ts +10 -1
- package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +3 -0
- package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +1 -0
- package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +1 -0
- package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +1 -0
- package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +11 -0
- package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +4 -0
- package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +4 -0
- package/package.json +3 -3
- package/src/components/CarbonChart/CarbonChart.tsx +28 -1
- package/src/components/CarbonChart/CarbonChartArea.stories.tsx +272 -0
- package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +152 -0
- package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +124 -0
- package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +125 -0
- package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +274 -0
- package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +606 -0
- package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +89 -0
- package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1418 -0
- package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +80 -0
- package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +767 -0
- package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1050 -0
- package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +216 -0
- package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +479 -0
- package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +467 -0
- package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +222 -0
- package/src/components/CarbonChart/CarbonChartStep.stories.tsx +173 -0
|
@@ -0,0 +1,606 @@
|
|
|
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/Bubble',
|
|
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 BubbleLinear = Template.bind({});
|
|
31
|
+
BubbleLinear.args = {
|
|
32
|
+
isInverse: false,
|
|
33
|
+
type: CarbonChartType.bubble,
|
|
34
|
+
dataSet: [
|
|
35
|
+
{
|
|
36
|
+
group: 'Dataset 1',
|
|
37
|
+
sales: 10000,
|
|
38
|
+
profit: 32100,
|
|
39
|
+
surplus: 50000,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
group: 'Dataset 1',
|
|
43
|
+
sales: 12000,
|
|
44
|
+
profit: 23500,
|
|
45
|
+
surplus: 34000,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
group: 'Dataset 1',
|
|
49
|
+
sales: 14000,
|
|
50
|
+
profit: 53100,
|
|
51
|
+
surplus: 63000,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
group: 'Dataset 1',
|
|
55
|
+
sales: 15000,
|
|
56
|
+
profit: 42300,
|
|
57
|
+
surplus: 43000,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
group: 'Dataset 1',
|
|
61
|
+
sales: 16000,
|
|
62
|
+
profit: 12300,
|
|
63
|
+
surplus: 55000,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
group: 'Dataset 2',
|
|
67
|
+
sales: 11000,
|
|
68
|
+
profit: 12400,
|
|
69
|
+
surplus: 25000,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
group: 'Dataset 2',
|
|
73
|
+
sales: 13000,
|
|
74
|
+
profit: 34500,
|
|
75
|
+
surplus: 35000,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
group: 'Dataset 2',
|
|
79
|
+
sales: 13500,
|
|
80
|
+
profit: 23100,
|
|
81
|
+
surplus: 55000,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
group: 'Dataset 2',
|
|
85
|
+
sales: 15500,
|
|
86
|
+
profit: 63200,
|
|
87
|
+
surplus: 35000,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
group: 'Dataset 2',
|
|
91
|
+
sales: 15750,
|
|
92
|
+
profit: 24300,
|
|
93
|
+
surplus: 64000,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
options: {
|
|
97
|
+
title: 'Bubble (linear)',
|
|
98
|
+
axes: {
|
|
99
|
+
bottom: {
|
|
100
|
+
title: 'No. of employees',
|
|
101
|
+
mapsTo: 'sales',
|
|
102
|
+
includeZero: false,
|
|
103
|
+
},
|
|
104
|
+
left: {
|
|
105
|
+
title: 'Annual sales',
|
|
106
|
+
mapsTo: 'profit',
|
|
107
|
+
includeZero: false,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
bubble: {
|
|
111
|
+
radiusMapsTo: 'surplus',
|
|
112
|
+
radiusLabel: 'Surplus',
|
|
113
|
+
},
|
|
114
|
+
legend: {
|
|
115
|
+
additionalItems: [
|
|
116
|
+
{
|
|
117
|
+
type: 'radius',
|
|
118
|
+
name: 'Surplus',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
height: '400px',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Uncomment when adding new charts. Issues: #1054, #1055, #1056
|
|
127
|
+
|
|
128
|
+
// export const BubbleTimeSeries = Template.bind({});
|
|
129
|
+
// BubbleTimeSeries.args = {
|
|
130
|
+
// isInverse: false,
|
|
131
|
+
// type: CarbonChartType.bubble,
|
|
132
|
+
// dataSet: [
|
|
133
|
+
// {
|
|
134
|
+
// group: 'Dataset 1',
|
|
135
|
+
// date: '2023-01-01',
|
|
136
|
+
// value: 50000,
|
|
137
|
+
// surplus: 1108792759.4591982,
|
|
138
|
+
// },
|
|
139
|
+
// {
|
|
140
|
+
// group: 'Dataset 1',
|
|
141
|
+
// date: '2023-01-05',
|
|
142
|
+
// value: 65000,
|
|
143
|
+
// surplus: 590247271.3872744,
|
|
144
|
+
// },
|
|
145
|
+
// {
|
|
146
|
+
// group: 'Dataset 1',
|
|
147
|
+
// date: '2023-01-08',
|
|
148
|
+
// value: null,
|
|
149
|
+
// surplus: 9219.520929038921,
|
|
150
|
+
// },
|
|
151
|
+
// {
|
|
152
|
+
// group: 'Dataset 1',
|
|
153
|
+
// date: '2023-01-13',
|
|
154
|
+
// value: 49213,
|
|
155
|
+
// surplus: 1144546546.5725653,
|
|
156
|
+
// },
|
|
157
|
+
// {
|
|
158
|
+
// group: 'Dataset 1',
|
|
159
|
+
// date: '2023-01-17',
|
|
160
|
+
// value: 51213,
|
|
161
|
+
// surplus: 1206431312.2321992,
|
|
162
|
+
// },
|
|
163
|
+
// {
|
|
164
|
+
// group: 'Dataset 2',
|
|
165
|
+
// date: '2023-01-02',
|
|
166
|
+
// value: 0,
|
|
167
|
+
// surplus: 9107.915339546651,
|
|
168
|
+
// },
|
|
169
|
+
// {
|
|
170
|
+
// group: 'Dataset 2',
|
|
171
|
+
// date: '2023-01-06',
|
|
172
|
+
// value: 57312,
|
|
173
|
+
// surplus: 1297879289.3455367,
|
|
174
|
+
// },
|
|
175
|
+
// {
|
|
176
|
+
// group: 'Dataset 2',
|
|
177
|
+
// date: '2023-01-08',
|
|
178
|
+
// value: 27432,
|
|
179
|
+
// surplus: 254653461.2692332,
|
|
180
|
+
// },
|
|
181
|
+
// {
|
|
182
|
+
// group: 'Dataset 2',
|
|
183
|
+
// date: '2023-01-15',
|
|
184
|
+
// value: 70323,
|
|
185
|
+
// surplus: 791440614.5922209,
|
|
186
|
+
// },
|
|
187
|
+
// {
|
|
188
|
+
// group: 'Dataset 2',
|
|
189
|
+
// date: '2023-01-19',
|
|
190
|
+
// value: 21300,
|
|
191
|
+
// surplus: 87235499.55803385,
|
|
192
|
+
// },
|
|
193
|
+
// {
|
|
194
|
+
// group: 'Dataset 3',
|
|
195
|
+
// date: '2023-01-01',
|
|
196
|
+
// value: 40000,
|
|
197
|
+
// surplus: 99661858.42808129,
|
|
198
|
+
// },
|
|
199
|
+
// {
|
|
200
|
+
// group: 'Dataset 3',
|
|
201
|
+
// date: '2023-01-05',
|
|
202
|
+
// value: null,
|
|
203
|
+
// surplus: 4582.283257286785,
|
|
204
|
+
// },
|
|
205
|
+
// {
|
|
206
|
+
// group: 'Dataset 3',
|
|
207
|
+
// date: '2023-01-08',
|
|
208
|
+
// value: 18000,
|
|
209
|
+
// surplus: 388038660.7993739,
|
|
210
|
+
// },
|
|
211
|
+
// {
|
|
212
|
+
// group: 'Dataset 3',
|
|
213
|
+
// date: '2023-01-13',
|
|
214
|
+
// value: 39213,
|
|
215
|
+
// surplus: 281485241.99383223,
|
|
216
|
+
// },
|
|
217
|
+
// {
|
|
218
|
+
// group: 'Dataset 3',
|
|
219
|
+
// date: '2023-01-17',
|
|
220
|
+
// value: 61213,
|
|
221
|
+
// surplus: 77655008.12585072,
|
|
222
|
+
// },
|
|
223
|
+
// {
|
|
224
|
+
// group: 'Dataset 4',
|
|
225
|
+
// date: '2023-01-02',
|
|
226
|
+
// value: 20000,
|
|
227
|
+
// surplus: 138468385.58061224,
|
|
228
|
+
// },
|
|
229
|
+
// {
|
|
230
|
+
// group: 'Dataset 4',
|
|
231
|
+
// date: '2023-01-06',
|
|
232
|
+
// value: 37312,
|
|
233
|
+
// surplus: 703848952.2932228,
|
|
234
|
+
// },
|
|
235
|
+
// {
|
|
236
|
+
// group: 'Dataset 4',
|
|
237
|
+
// date: '2023-01-08',
|
|
238
|
+
// value: 51432,
|
|
239
|
+
// surplus: 721135448.0965896,
|
|
240
|
+
// },
|
|
241
|
+
// {
|
|
242
|
+
// group: 'Dataset 4',
|
|
243
|
+
// date: '2023-01-15',
|
|
244
|
+
// value: 25332,
|
|
245
|
+
// surplus: 524200058.75680393,
|
|
246
|
+
// },
|
|
247
|
+
// {
|
|
248
|
+
// group: 'Dataset 4',
|
|
249
|
+
// date: '2023-01-19',
|
|
250
|
+
// value: null,
|
|
251
|
+
// surplus: 4347.704175756872,
|
|
252
|
+
// },
|
|
253
|
+
// ],
|
|
254
|
+
// options: {
|
|
255
|
+
// title: 'Bubble (time series)',
|
|
256
|
+
// axes: {
|
|
257
|
+
// bottom: {
|
|
258
|
+
// title: '2023 Annual Sales Figures',
|
|
259
|
+
// scaleType: 'time',
|
|
260
|
+
// mapsTo: 'date',
|
|
261
|
+
// },
|
|
262
|
+
// left: {
|
|
263
|
+
// mapsTo: 'value',
|
|
264
|
+
// },
|
|
265
|
+
// },
|
|
266
|
+
// bubble: {
|
|
267
|
+
// radiusMapsTo: 'surplus',
|
|
268
|
+
// },
|
|
269
|
+
// height: '400px',
|
|
270
|
+
// },
|
|
271
|
+
// };
|
|
272
|
+
|
|
273
|
+
// export const BubbleDiscrete = Template.bind({});
|
|
274
|
+
// BubbleDiscrete.args = {
|
|
275
|
+
// isInverse: false,
|
|
276
|
+
// type: CarbonChartType.bubble,
|
|
277
|
+
// dataSet: [
|
|
278
|
+
// {
|
|
279
|
+
// group: 'Dataset 1',
|
|
280
|
+
// key: 'Qty',
|
|
281
|
+
// value: 8000,
|
|
282
|
+
// surplus: 50000,
|
|
283
|
+
// },
|
|
284
|
+
// {
|
|
285
|
+
// group: 'Dataset 1',
|
|
286
|
+
// key: 'More',
|
|
287
|
+
// value: 23500,
|
|
288
|
+
// surplus: 15000,
|
|
289
|
+
// },
|
|
290
|
+
// {
|
|
291
|
+
// group: 'Dataset 1',
|
|
292
|
+
// key: 'Sold',
|
|
293
|
+
// value: 53100,
|
|
294
|
+
// surplus: 32000,
|
|
295
|
+
// },
|
|
296
|
+
// {
|
|
297
|
+
// group: 'Dataset 1',
|
|
298
|
+
// key: 'Restocking',
|
|
299
|
+
// value: 42300,
|
|
300
|
+
// surplus: 53000,
|
|
301
|
+
// },
|
|
302
|
+
// {
|
|
303
|
+
// group: 'Dataset 1',
|
|
304
|
+
// key: 'Misc',
|
|
305
|
+
// value: 12300,
|
|
306
|
+
// surplus: 34000,
|
|
307
|
+
// },
|
|
308
|
+
// {
|
|
309
|
+
// group: 'Dataset 2',
|
|
310
|
+
// key: 'Qty',
|
|
311
|
+
// value: 34200,
|
|
312
|
+
// surplus: 23000,
|
|
313
|
+
// },
|
|
314
|
+
// {
|
|
315
|
+
// group: 'Dataset 2',
|
|
316
|
+
// key: 'More',
|
|
317
|
+
// value: 53200,
|
|
318
|
+
// surplus: 31000,
|
|
319
|
+
// },
|
|
320
|
+
// {
|
|
321
|
+
// group: 'Dataset 2',
|
|
322
|
+
// key: 'Sold',
|
|
323
|
+
// value: 42300,
|
|
324
|
+
// surplus: 13000,
|
|
325
|
+
// },
|
|
326
|
+
// {
|
|
327
|
+
// group: 'Dataset 2',
|
|
328
|
+
// key: 'Restocking',
|
|
329
|
+
// value: 13400,
|
|
330
|
+
// surplus: 55000,
|
|
331
|
+
// },
|
|
332
|
+
// {
|
|
333
|
+
// group: 'Dataset 2',
|
|
334
|
+
// key: 'Misc',
|
|
335
|
+
// value: 0,
|
|
336
|
+
// surplus: 12000,
|
|
337
|
+
// },
|
|
338
|
+
// {
|
|
339
|
+
// group: 'Dataset 3',
|
|
340
|
+
// key: 'Qty',
|
|
341
|
+
// value: 41200,
|
|
342
|
+
// surplus: 32000,
|
|
343
|
+
// },
|
|
344
|
+
// {
|
|
345
|
+
// group: 'Dataset 3',
|
|
346
|
+
// key: 'More',
|
|
347
|
+
// value: 18400,
|
|
348
|
+
// surplus: 12000,
|
|
349
|
+
// },
|
|
350
|
+
// {
|
|
351
|
+
// group: 'Dataset 3',
|
|
352
|
+
// key: 'Sold',
|
|
353
|
+
// value: 34210,
|
|
354
|
+
// surplus: 18000,
|
|
355
|
+
// },
|
|
356
|
+
// {
|
|
357
|
+
// group: 'Dataset 3',
|
|
358
|
+
// key: 'Restocking',
|
|
359
|
+
// value: 1400,
|
|
360
|
+
// surplus: 21000,
|
|
361
|
+
// },
|
|
362
|
+
// {
|
|
363
|
+
// group: 'Dataset 3',
|
|
364
|
+
// key: 'Misc',
|
|
365
|
+
// value: 42100,
|
|
366
|
+
// surplus: 22000,
|
|
367
|
+
// },
|
|
368
|
+
// {
|
|
369
|
+
// group: 'Dataset 4',
|
|
370
|
+
// key: 'Qty',
|
|
371
|
+
// value: 22000,
|
|
372
|
+
// surplus: 32000,
|
|
373
|
+
// },
|
|
374
|
+
// {
|
|
375
|
+
// group: 'Dataset 4',
|
|
376
|
+
// key: 'More',
|
|
377
|
+
// value: 4000,
|
|
378
|
+
// surplus: 32000,
|
|
379
|
+
// },
|
|
380
|
+
// {
|
|
381
|
+
// group: 'Dataset 4',
|
|
382
|
+
// key: 'Sold',
|
|
383
|
+
// value: 9000,
|
|
384
|
+
// surplus: 43000,
|
|
385
|
+
// },
|
|
386
|
+
// {
|
|
387
|
+
// group: 'Dataset 4',
|
|
388
|
+
// key: 'Restocking',
|
|
389
|
+
// value: 24000,
|
|
390
|
+
// surplus: 43000,
|
|
391
|
+
// },
|
|
392
|
+
// {
|
|
393
|
+
// group: 'Dataset 4',
|
|
394
|
+
// key: 'Misc',
|
|
395
|
+
// value: 7000,
|
|
396
|
+
// surplus: 21000,
|
|
397
|
+
// },
|
|
398
|
+
// ],
|
|
399
|
+
// options: {
|
|
400
|
+
// title: 'Bubble (discrete)',
|
|
401
|
+
// axes: {
|
|
402
|
+
// bottom: {
|
|
403
|
+
// title: '2023 Annual Sales Figures',
|
|
404
|
+
// scaleType: 'labels',
|
|
405
|
+
// mapsTo: 'key',
|
|
406
|
+
// },
|
|
407
|
+
// left: {
|
|
408
|
+
// mapsTo: 'value',
|
|
409
|
+
// },
|
|
410
|
+
// },
|
|
411
|
+
// bubble: {
|
|
412
|
+
// radiusMapsTo: 'surplus',
|
|
413
|
+
// },
|
|
414
|
+
// height: '400px',
|
|
415
|
+
// },
|
|
416
|
+
// };
|
|
417
|
+
|
|
418
|
+
// export const BubbleDualDiscreteAxes = Template.bind({});
|
|
419
|
+
// BubbleDualDiscreteAxes.args = {
|
|
420
|
+
// isInverse: false,
|
|
421
|
+
// type: CarbonChartType.bubble,
|
|
422
|
+
// dataSet: [
|
|
423
|
+
// {
|
|
424
|
+
// group: '2014',
|
|
425
|
+
// product: 'Cloud',
|
|
426
|
+
// value: 162,
|
|
427
|
+
// problem: 'Skills',
|
|
428
|
+
// },
|
|
429
|
+
// {
|
|
430
|
+
// group: '2014',
|
|
431
|
+
// product: 'Mainframe',
|
|
432
|
+
// value: 340,
|
|
433
|
+
// problem: 'Skills',
|
|
434
|
+
// },
|
|
435
|
+
// {
|
|
436
|
+
// group: '2014',
|
|
437
|
+
// product: 'Cloud',
|
|
438
|
+
// value: 202,
|
|
439
|
+
// problem: 'Software',
|
|
440
|
+
// },
|
|
441
|
+
// {
|
|
442
|
+
// group: '2014',
|
|
443
|
+
// product: 'Mainframe',
|
|
444
|
+
// value: 64,
|
|
445
|
+
// problem: 'Software',
|
|
446
|
+
// },
|
|
447
|
+
// {
|
|
448
|
+
// group: '2014',
|
|
449
|
+
// product: 'Cloud',
|
|
450
|
+
// value: 102,
|
|
451
|
+
// problem: 'Staffing',
|
|
452
|
+
// },
|
|
453
|
+
// {
|
|
454
|
+
// group: '2014',
|
|
455
|
+
// product: 'Mainframe',
|
|
456
|
+
// value: 88,
|
|
457
|
+
// problem: 'Staffing',
|
|
458
|
+
// },
|
|
459
|
+
// {
|
|
460
|
+
// group: '2016',
|
|
461
|
+
// product: 'Cloud',
|
|
462
|
+
// value: 136,
|
|
463
|
+
// problem: 'Skills',
|
|
464
|
+
// },
|
|
465
|
+
// {
|
|
466
|
+
// group: '2016',
|
|
467
|
+
// product: 'Mainframe',
|
|
468
|
+
// value: 74,
|
|
469
|
+
// problem: 'Skills',
|
|
470
|
+
// },
|
|
471
|
+
// {
|
|
472
|
+
// group: '2016',
|
|
473
|
+
// product: 'Cloud',
|
|
474
|
+
// value: 45,
|
|
475
|
+
// problem: 'Software',
|
|
476
|
+
// },
|
|
477
|
+
// {
|
|
478
|
+
// group: '2016',
|
|
479
|
+
// product: 'Mainframe',
|
|
480
|
+
// value: 24,
|
|
481
|
+
// problem: 'Software',
|
|
482
|
+
// },
|
|
483
|
+
// {
|
|
484
|
+
// group: '2016',
|
|
485
|
+
// product: 'Cloud',
|
|
486
|
+
// value: 36,
|
|
487
|
+
// problem: 'Staffing',
|
|
488
|
+
// },
|
|
489
|
+
// {
|
|
490
|
+
// group: '2016',
|
|
491
|
+
// product: 'Mainframe',
|
|
492
|
+
// value: 44,
|
|
493
|
+
// problem: 'Staffing',
|
|
494
|
+
// },
|
|
495
|
+
// {
|
|
496
|
+
// group: '2018',
|
|
497
|
+
// product: 'Cloud',
|
|
498
|
+
// value: 78,
|
|
499
|
+
// problem: 'Skills',
|
|
500
|
+
// },
|
|
501
|
+
// {
|
|
502
|
+
// group: '2018',
|
|
503
|
+
// product: 'Mainframe',
|
|
504
|
+
// value: 94,
|
|
505
|
+
// problem: 'Skills',
|
|
506
|
+
// },
|
|
507
|
+
// {
|
|
508
|
+
// group: '2018',
|
|
509
|
+
// product: 'Cloud',
|
|
510
|
+
// value: 56,
|
|
511
|
+
// problem: 'Software',
|
|
512
|
+
// },
|
|
513
|
+
// {
|
|
514
|
+
// group: '2018',
|
|
515
|
+
// product: 'Mainframe',
|
|
516
|
+
// value: 104,
|
|
517
|
+
// problem: 'Software',
|
|
518
|
+
// },
|
|
519
|
+
// {
|
|
520
|
+
// group: '2018',
|
|
521
|
+
// product: 'Cloud',
|
|
522
|
+
// value: 146,
|
|
523
|
+
// problem: 'Staffing',
|
|
524
|
+
// },
|
|
525
|
+
// {
|
|
526
|
+
// group: '2018',
|
|
527
|
+
// product: 'Mainframe',
|
|
528
|
+
// value: 274,
|
|
529
|
+
// problem: 'Staffing',
|
|
530
|
+
// },
|
|
531
|
+
// ],
|
|
532
|
+
// options: {
|
|
533
|
+
// title: 'Bubble (dual discrete axes)',
|
|
534
|
+
// axes: {
|
|
535
|
+
// bottom: {
|
|
536
|
+
// title: 'Problems',
|
|
537
|
+
// scaleType: 'labels',
|
|
538
|
+
// mapsTo: 'problem',
|
|
539
|
+
// },
|
|
540
|
+
// left: {
|
|
541
|
+
// scaleType: 'labels',
|
|
542
|
+
// mapsTo: 'product',
|
|
543
|
+
// title: 'Products',
|
|
544
|
+
// },
|
|
545
|
+
// },
|
|
546
|
+
// bubble: {
|
|
547
|
+
// radiusMapsTo: 'value',
|
|
548
|
+
// },
|
|
549
|
+
// height: '400px',
|
|
550
|
+
// },
|
|
551
|
+
// };
|
|
552
|
+
|
|
553
|
+
// export const BubbleEmptyState = Template.bind({});
|
|
554
|
+
// BubbleEmptyState.args = {
|
|
555
|
+
// isInverse: false,
|
|
556
|
+
// type: CarbonChartType.bubble,
|
|
557
|
+
// dataSet: [],
|
|
558
|
+
// options: {
|
|
559
|
+
// title: 'Bubble (empty state)',
|
|
560
|
+
// axes: {
|
|
561
|
+
// bottom: {
|
|
562
|
+
// title: 'No. of employees',
|
|
563
|
+
// mapsTo: 'sales',
|
|
564
|
+
// includeZero: false,
|
|
565
|
+
// },
|
|
566
|
+
// left: {
|
|
567
|
+
// title: 'Annual sales',
|
|
568
|
+
// mapsTo: 'profit',
|
|
569
|
+
// includeZero: false,
|
|
570
|
+
// },
|
|
571
|
+
// },
|
|
572
|
+
// bubble: {
|
|
573
|
+
// radiusMapsTo: 'surplus',
|
|
574
|
+
// },
|
|
575
|
+
// height: '400px',
|
|
576
|
+
// },
|
|
577
|
+
// };
|
|
578
|
+
|
|
579
|
+
// export const BubbleSkeleton = Template.bind({});
|
|
580
|
+
// BubbleSkeleton.args = {
|
|
581
|
+
// isInverse: false,
|
|
582
|
+
// type: CarbonChartType.bubble,
|
|
583
|
+
// dataSet: [],
|
|
584
|
+
// options: {
|
|
585
|
+
// title: 'Bubble (skeleton)',
|
|
586
|
+
// axes: {
|
|
587
|
+
// bottom: {
|
|
588
|
+
// title: 'No. of employees',
|
|
589
|
+
// mapsTo: 'sales',
|
|
590
|
+
// includeZero: false,
|
|
591
|
+
// },
|
|
592
|
+
// left: {
|
|
593
|
+
// title: 'Annual sales',
|
|
594
|
+
// mapsTo: 'profit',
|
|
595
|
+
// includeZero: false,
|
|
596
|
+
// },
|
|
597
|
+
// },
|
|
598
|
+
// bubble: {
|
|
599
|
+
// radiusMapsTo: 'surplus',
|
|
600
|
+
// },
|
|
601
|
+
// data: {
|
|
602
|
+
// loading: true,
|
|
603
|
+
// },
|
|
604
|
+
// height: '400px',
|
|
605
|
+
// },
|
|
606
|
+
// };
|
|
@@ -0,0 +1,89 @@
|
|
|
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/Bullet',
|
|
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 BasicBullet = Template.bind({});
|
|
31
|
+
BasicBullet.args = {
|
|
32
|
+
isInverse: false,
|
|
33
|
+
type: CarbonChartType.bullet,
|
|
34
|
+
dataSet: [
|
|
35
|
+
{
|
|
36
|
+
title: 'Item E',
|
|
37
|
+
group: 'D3',
|
|
38
|
+
ranges: [350, 650, 980],
|
|
39
|
+
marker: 1575,
|
|
40
|
+
value: 400,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: 'Item D',
|
|
44
|
+
group: 'D2',
|
|
45
|
+
ranges: [750, 1200, null],
|
|
46
|
+
marker: 1725,
|
|
47
|
+
value: 2100,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: 'Item C',
|
|
51
|
+
group: 'D3',
|
|
52
|
+
ranges: [350, 500, 1005],
|
|
53
|
+
marker: 1340,
|
|
54
|
+
value: 550,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'Item B',
|
|
58
|
+
group: 'D1',
|
|
59
|
+
ranges: [300, 895, 1600],
|
|
60
|
+
marker: 1455,
|
|
61
|
+
value: 1000,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: 'Item A',
|
|
65
|
+
group: 'D1',
|
|
66
|
+
ranges: [800, 1000, 1400],
|
|
67
|
+
marker: 1275,
|
|
68
|
+
value: 250,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
options: {
|
|
72
|
+
title: 'Basic bullet',
|
|
73
|
+
axes: {
|
|
74
|
+
bottom: {
|
|
75
|
+
mapsTo: 'value',
|
|
76
|
+
extendLinearDomainBy: 'marker',
|
|
77
|
+
},
|
|
78
|
+
left: {
|
|
79
|
+
scaleType: 'labels',
|
|
80
|
+
mapsTo: 'title',
|
|
81
|
+
},
|
|
82
|
+
right: {
|
|
83
|
+
scaleType: 'labels-ratio',
|
|
84
|
+
mapsTo: 'title',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
height: '251px',
|
|
88
|
+
},
|
|
89
|
+
};
|