@react-magma/charts 12.0.0 → 12.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.
Files changed (72) hide show
  1. package/dist/charts.js +2450 -1
  2. package/dist/charts.js.map +1 -1
  3. package/dist/charts.modern.module.js +2428 -1
  4. package/dist/charts.modern.module.js.map +1 -1
  5. package/dist/charts.umd.js +48555 -1
  6. package/dist/charts.umd.js.map +1 -1
  7. package/dist/components/CarbonChart/CarbonChart.d.ts +42 -41
  8. package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +310 -12
  9. package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +136 -7
  10. package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +214 -12
  11. package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +82 -6
  12. package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +234 -13
  13. package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +266 -14
  14. package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +53 -5
  15. package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +196 -9
  16. package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +35 -4
  17. package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +580 -15
  18. package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +120 -8
  19. package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +43 -5
  20. package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +89 -6
  21. package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +577 -20
  22. package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +55 -5
  23. package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +127 -8
  24. package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +101 -8
  25. package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +98 -7
  26. package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +173 -9
  27. package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +51 -4
  28. package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +38 -4
  29. package/dist/components/CarbonChart/index.d.ts +1 -1
  30. package/dist/components/LineChart/Chart.d.ts +27 -27
  31. package/dist/components/LineChart/ChartDataTable.d.ts +17 -17
  32. package/dist/components/LineChart/CustomAxisComponent.d.ts +3 -3
  33. package/dist/components/LineChart/CustomPointComponent.d.ts +17 -17
  34. package/dist/components/LineChart/DataTable.d.ts +5 -5
  35. package/dist/components/LineChart/GraphTooltip.d.ts +3 -3
  36. package/dist/components/LineChart/LegendButton.d.ts +6 -6
  37. package/dist/components/LineChart/LineChart.d.ts +67 -67
  38. package/dist/components/LineChart/LineChart.stories.d.ts +113 -23
  39. package/dist/components/LineChart/index.d.ts +1 -1
  40. package/dist/components/LineChart/magma-charts.d.ts +1 -1
  41. package/dist/index.d.ts +2 -2
  42. package/package.json +11 -6
  43. package/src/components/CarbonChart/CarbonChart.tsx +12 -16
  44. package/src/components/CarbonChart/CarbonChartArea.stories.tsx +674 -649
  45. package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +424 -414
  46. package/src/components/CarbonChart/CarbonChartBar.stories.tsx +352 -325
  47. package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +127 -116
  48. package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +872 -843
  49. package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +913 -879
  50. package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +238 -232
  51. package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +565 -547
  52. package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +59 -56
  53. package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1335 -1299
  54. package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +170 -153
  55. package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +50 -44
  56. package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +733 -724
  57. package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1656 -1605
  58. package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +81 -76
  59. package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +177 -162
  60. package/src/components/CarbonChart/CarbonChartPie.stories.tsx +154 -139
  61. package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +445 -433
  62. package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +427 -409
  63. package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +191 -188
  64. package/src/components/CarbonChart/CarbonChartStep.stories.tsx +145 -142
  65. package/src/components/CarbonChart/carbon-charts.css +7303 -0
  66. package/src/components/LineChart/LineChart.stories.tsx +91 -104
  67. package/dist/components/CarbonChart/CarbonChart.test.d.ts +0 -1
  68. package/dist/components/CarbonChart/embeddedStyles.d.ts +0 -1
  69. package/dist/components/LineChart/ChartDataTable.test.d.ts +0 -1
  70. package/dist/components/LineChart/LineChart.test.d.ts +0 -1
  71. package/dist/components/LineChart/test/exampleChartData.d.ts +0 -40
  72. package/src/components/CarbonChart/embeddedStyles.ts +0 -24880
@@ -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,93 +23,98 @@ 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
- //Lollipop//
33
- export const LollipopDiscrete = Template.bind({});
34
- LollipopDiscrete.args = {
35
- isInverse: false,
36
- type: CarbonChartType.lollipop,
37
- dataSet: [
38
- {
39
- group: 'Dataset 1',
40
- key: 'Qty',
41
- value: 34200,
42
- },
43
- {
44
- group: 'Dataset 2',
45
- key: 'More',
46
- value: 34200,
47
- },
48
- {
49
- group: 'Dataset 3',
50
- key: 'Sold',
51
- value: 41200,
52
- },
53
- {
54
- group: 'Dataset 4',
55
- key: 'Restocking',
56
- value: 22000,
57
- },
58
- ],
59
- options: {
60
- title: 'Lollipop (discrete)',
61
- axes: {
62
- bottom: {
63
- title: '2019 Annual Sales Figures',
64
- scaleType: 'labels',
65
- mapsTo: 'key',
32
+ export const LollipopDiscrete = {
33
+ render: Template,
34
+
35
+ args: {
36
+ isInverse: false,
37
+ type: CarbonChartType.lollipop,
38
+ dataSet: [
39
+ {
40
+ group: 'Dataset 1',
41
+ key: 'Qty',
42
+ value: 34200,
66
43
  },
67
- left: {
68
- mapsTo: 'value',
44
+ {
45
+ group: 'Dataset 2',
46
+ key: 'More',
47
+ value: 34200,
69
48
  },
49
+ {
50
+ group: 'Dataset 3',
51
+ key: 'Sold',
52
+ value: 41200,
53
+ },
54
+ {
55
+ group: 'Dataset 4',
56
+ key: 'Restocking',
57
+ value: 22000,
58
+ },
59
+ ],
60
+ options: {
61
+ title: 'Lollipop (discrete)',
62
+ axes: {
63
+ bottom: {
64
+ title: '2019 Annual Sales Figures',
65
+ scaleType: 'labels',
66
+ mapsTo: 'key',
67
+ },
68
+ left: {
69
+ mapsTo: 'value',
70
+ },
71
+ },
72
+ height: '400px',
70
73
  },
71
- height: '400px',
72
74
  },
73
75
  };
74
- export const LollipopHorizontalPresentation = Template.bind({});
75
- LollipopHorizontalPresentation.args = {
76
- isInverse: false,
77
- type: CarbonChartType.lollipop,
78
- dataSet: [
79
- {
80
- group: 'Dataset 1',
81
- key: 'Qty',
82
- value: 34200,
83
- },
84
- {
85
- group: 'Dataset 2',
86
- key: 'More',
87
- value: 34200,
88
- },
89
- {
90
- group: 'Dataset 3',
91
- key: 'Sold',
92
- value: 41200,
93
- },
94
- {
95
- group: 'Dataset 4',
96
- key: 'Restocking',
97
- value: 22000,
98
- },
99
- ],
100
- options: {
101
- title: 'Lollipop (horizontal) - presentation',
102
- axes: {
103
- left: {
104
- title: '2019 Annual Sales Figures',
105
- scaleType: 'labels',
106
- mapsTo: 'key',
76
+
77
+ export const LollipopHorizontalPresentation = {
78
+ render: Template,
79
+
80
+ args: {
81
+ isInverse: false,
82
+ type: CarbonChartType.lollipop,
83
+ dataSet: [
84
+ {
85
+ group: 'Dataset 1',
86
+ key: 'Qty',
87
+ value: 34200,
88
+ },
89
+ {
90
+ group: 'Dataset 2',
91
+ key: 'More',
92
+ value: 34200,
93
+ },
94
+ {
95
+ group: 'Dataset 3',
96
+ key: 'Sold',
97
+ value: 41200,
98
+ },
99
+ {
100
+ group: 'Dataset 4',
101
+ key: 'Restocking',
102
+ value: 22000,
107
103
  },
108
- bottom: {
109
- mapsTo: 'value',
104
+ ],
105
+ options: {
106
+ title: 'Lollipop (horizontal) - presentation',
107
+ axes: {
108
+ left: {
109
+ title: '2019 Annual Sales Figures',
110
+ scaleType: 'labels',
111
+ mapsTo: 'key',
112
+ },
113
+ bottom: {
114
+ mapsTo: 'value',
115
+ },
110
116
  },
117
+ height: '400px',
111
118
  },
112
- height: '400px',
113
119
  },
114
120
  };
115
- //Lollipop//
@@ -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,193 +23,208 @@ 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 MeterChartWithStatuses = Template.bind({});
33
- MeterChartWithStatuses.args = {
34
- isInverse: false,
35
- type: CarbonChartType.meter,
36
- dataSet: [
37
- {
38
- group: 'Dataset 1',
39
- value: 56,
40
- },
41
- ],
42
- options: {
43
- title: 'Meter Chart - with statuses',
44
- meter: {
45
- peak: 80,
46
- status: {
47
- ranges: [
48
- {
49
- range: [0, 50],
50
- status: 'success',
51
- },
52
- {
53
- range: [50, 60],
54
- status: 'warning',
55
- },
56
- {
57
- range: [60, 100],
58
- status: 'danger',
59
- },
60
- ],
32
+ export const MeterChartWithStatuses = {
33
+ render: Template,
34
+
35
+ args: {
36
+ isInverse: false,
37
+ type: CarbonChartType.meter,
38
+ dataSet: [
39
+ {
40
+ group: 'Dataset 1',
41
+ value: 56,
42
+ },
43
+ ],
44
+ options: {
45
+ title: 'Meter Chart - with statuses',
46
+ meter: {
47
+ peak: 80,
48
+ status: {
49
+ ranges: [
50
+ {
51
+ range: [0, 50],
52
+ status: 'success',
53
+ },
54
+ {
55
+ range: [50, 60],
56
+ status: 'warning',
57
+ },
58
+ {
59
+ range: [60, 100],
60
+ status: 'danger',
61
+ },
62
+ ],
63
+ },
61
64
  },
65
+ height: '100px',
62
66
  },
63
- height: '100px',
64
67
  },
65
68
  };
66
69
 
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,
70
+ export const MeterChartNoStatus = {
71
+ render: Template,
72
+
73
+ args: {
74
+ isInverse: false,
75
+ type: CarbonChartType.meter,
76
+ dataSet: [
77
+ {
78
+ group: 'Dataset 1',
79
+ value: 56,
80
+ },
81
+ ],
82
+ options: {
83
+ title: 'Meter Chart - no status',
84
+ meter: {
85
+ peak: 70,
86
+ },
87
+ height: '100px',
81
88
  },
82
- height: '100px',
83
89
  },
84
90
  };
85
91
 
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',
92
+ export const ProportionalMeterChart = {
93
+ render: Template,
94
+
95
+ args: {
96
+ isInverse: false,
97
+ type: CarbonChartType.meter,
98
+ dataSet: [
99
+ {
100
+ group: 'emails',
101
+ value: 202,
115
102
  },
116
- },
117
- color: {
118
- pairing: {
119
- option: 2,
103
+ {
104
+ group: 'photos',
105
+ value: 654,
106
+ },
107
+ {
108
+ group: 'text messages',
109
+ value: 723,
110
+ },
111
+ {
112
+ group: 'other',
113
+ value: 120,
114
+ },
115
+ ],
116
+ options: {
117
+ title: 'Proportional Meter Chart',
118
+ height: '130px',
119
+ meter: {
120
+ proportional: {
121
+ total: 2000,
122
+ unit: 'GB',
123
+ },
124
+ },
125
+ color: {
126
+ pairing: {
127
+ option: 2,
128
+ },
120
129
  },
121
130
  },
122
131
  },
123
132
  };
124
133
 
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
- ],
134
+ export const ProportionalMeterChartPeakAndStatuses = {
135
+ render: Template,
136
+
137
+ args: {
138
+ isInverse: false,
139
+ type: CarbonChartType.meter,
140
+ dataSet: [
141
+ {
142
+ group: 'emails',
143
+ value: 202,
171
144
  },
172
- },
173
- color: {
174
- pairing: {
175
- option: 2,
145
+ {
146
+ group: 'photos',
147
+ value: 654,
148
+ },
149
+ {
150
+ group: 'text messages',
151
+ value: 723,
152
+ },
153
+ {
154
+ group: 'other',
155
+ value: 120,
156
+ },
157
+ ],
158
+ options: {
159
+ title: 'Proportional Meter Chart - peak and statuses',
160
+ height: '130px',
161
+ meter: {
162
+ peak: 1800,
163
+ proportional: {
164
+ total: 2000,
165
+ unit: 'GB',
166
+ },
167
+ status: {
168
+ ranges: [
169
+ {
170
+ range: [0, 800],
171
+ status: 'success',
172
+ },
173
+ {
174
+ range: [800, 1800],
175
+ status: 'warning',
176
+ },
177
+ {
178
+ range: [1800, 2000],
179
+ status: 'danger',
180
+ },
181
+ ],
182
+ },
183
+ },
184
+ color: {
185
+ pairing: {
186
+ option: 2,
187
+ },
176
188
  },
177
189
  },
178
190
  },
179
191
  };
180
192
 
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.`,
193
+ export const ProportionalMeterChartTruncated = {
194
+ render: Template,
195
+
196
+ args: {
197
+ isInverse: false,
198
+ type: CarbonChartType.meter,
199
+ dataSet: [
200
+ {
201
+ group: 'emails',
202
+ value: 202,
203
+ },
204
+ {
205
+ group: 'photos',
206
+ value: 654,
207
+ },
208
+ {
209
+ group: 'text messages',
210
+ value: 723,
211
+ },
212
+ {
213
+ group: 'other',
214
+ value: 120,
215
+ },
216
+ ],
217
+ options: {
218
+ title: 'Proportional Meter Chart (truncated)',
219
+ height: '130px',
220
+ meter: {
221
+ proportional: {
222
+ total: 2000,
223
+ unit: 'MB',
224
+ totalFormatter: e => `custom total string for: ${e}`,
225
+ breakdownFormatter: e =>
226
+ `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.`,
227
+ },
213
228
  },
214
229
  },
215
230
  },