@react-magma/charts 12.0.1 → 13.0.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 (82) hide show
  1. package/dist/charts.js +1 -2450
  2. package/dist/charts.js.map +1 -1
  3. package/dist/charts.modern.module.js +1 -2428
  4. package/dist/charts.modern.module.js.map +1 -1
  5. package/dist/charts.umd.js +1 -48555
  6. package/dist/charts.umd.js.map +1 -1
  7. package/dist/components/CarbonChart/CarbonChart.d.ts +1 -2
  8. package/dist/components/CarbonChart/CarbonChart.test.d.ts +1 -0
  9. package/dist/components/CarbonChart/embeddedStyles.d.ts +1 -0
  10. package/dist/index.d.ts +0 -1
  11. package/package.json +25 -27
  12. package/src/components/CarbonChart/CarbonChart.tsx +18 -13
  13. package/src/components/CarbonChart/CarbonChartArea.stories.tsx +1 -1
  14. package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +1 -1
  15. package/src/components/CarbonChart/CarbonChartBar.stories.tsx +1 -1
  16. package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +1 -1
  17. package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +1 -1
  18. package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +1 -1
  19. package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +1 -1
  20. package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +1 -1
  21. package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +1 -1
  22. package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +1 -1
  23. package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +1 -1
  24. package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +1 -1
  25. package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +1 -1
  26. package/src/components/CarbonChart/CarbonChartLine.stories.tsx +1 -1
  27. package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +1 -1
  28. package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +1 -1
  29. package/src/components/CarbonChart/CarbonChartPie.stories.tsx +1 -1
  30. package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +1 -1
  31. package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +1 -1
  32. package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +1 -1
  33. package/src/components/CarbonChart/CarbonChartStep.stories.tsx +1 -1
  34. package/src/components/CarbonChart/embeddedStyles.ts +24880 -0
  35. package/src/index.ts +0 -1
  36. package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +0 -310
  37. package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +0 -136
  38. package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +0 -214
  39. package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +0 -82
  40. package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +0 -234
  41. package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +0 -266
  42. package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +0 -53
  43. package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +0 -196
  44. package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +0 -35
  45. package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +0 -580
  46. package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +0 -120
  47. package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +0 -43
  48. package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +0 -89
  49. package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +0 -577
  50. package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +0 -55
  51. package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +0 -127
  52. package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +0 -101
  53. package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +0 -98
  54. package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +0 -173
  55. package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +0 -51
  56. package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +0 -38
  57. package/dist/components/LineChart/Chart.d.ts +0 -27
  58. package/dist/components/LineChart/ChartDataTable.d.ts +0 -17
  59. package/dist/components/LineChart/CustomAxisComponent.d.ts +0 -3
  60. package/dist/components/LineChart/CustomPointComponent.d.ts +0 -17
  61. package/dist/components/LineChart/DataTable.d.ts +0 -5
  62. package/dist/components/LineChart/GraphTooltip.d.ts +0 -3
  63. package/dist/components/LineChart/LegendButton.d.ts +0 -6
  64. package/dist/components/LineChart/LineChart.d.ts +0 -67
  65. package/dist/components/LineChart/LineChart.stories.d.ts +0 -113
  66. package/dist/components/LineChart/index.d.ts +0 -1
  67. package/dist/components/LineChart/magma-charts.d.ts +0 -1
  68. package/src/components/CarbonChart/carbon-charts.css +0 -7303
  69. package/src/components/LineChart/Chart.tsx +0 -241
  70. package/src/components/LineChart/ChartDataTable.test.js +0 -165
  71. package/src/components/LineChart/ChartDataTable.tsx +0 -135
  72. package/src/components/LineChart/CustomAxisComponent.tsx +0 -30
  73. package/src/components/LineChart/CustomPointComponent.tsx +0 -93
  74. package/src/components/LineChart/DataTable.tsx +0 -57
  75. package/src/components/LineChart/GraphTooltip.tsx +0 -100
  76. package/src/components/LineChart/LegendButton.tsx +0 -77
  77. package/src/components/LineChart/LineChart.stories.tsx +0 -399
  78. package/src/components/LineChart/LineChart.test.js +0 -501
  79. package/src/components/LineChart/LineChart.tsx +0 -669
  80. package/src/components/LineChart/index.ts +0 -1
  81. package/src/components/LineChart/magma-charts.ts +0 -279
  82. package/src/components/LineChart/test/exampleChartData.js +0 -289
@@ -1,57 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import {
4
- Card,
5
- Table,
6
- TableHead,
7
- TableBody,
8
- TableRow,
9
- TableHeaderCell,
10
- TableCell,
11
- TableHeaderCellScope,
12
- } from 'react-magma-dom';
13
-
14
- export interface DataTableProps {
15
- data?: any;
16
- }
17
-
18
- export const DataTable = props => {
19
- const { data } = props;
20
-
21
- return (
22
- <Card>
23
- <Table>
24
- <TableHead>
25
- <TableRow>
26
- <TableHeaderCell style={{ width: '160px' }} />
27
- <TableHeaderCell>Jan</TableHeaderCell>
28
- <TableHeaderCell>Feb</TableHeaderCell>
29
- <TableHeaderCell>Mar</TableHeaderCell>
30
- <TableHeaderCell>April</TableHeaderCell>
31
- <TableHeaderCell>May</TableHeaderCell>
32
- </TableRow>
33
- </TableHead>
34
- <TableBody>
35
- {data.map((dataset, i) => (
36
- <TableRow key={i}>
37
- <TableHeaderCell
38
- scope={TableHeaderCellScope.row}
39
- style={{
40
- borderRight: '1px solid #dfdfdf',
41
- borderBottom: 0,
42
- }}
43
- >
44
- Team {i + 1}
45
- </TableHeaderCell>
46
- <TableCell>${dataset[0].y * 10}k</TableCell>
47
- <TableCell>${dataset[1].y * 10}k</TableCell>
48
- <TableCell>${dataset[2].y * 10}k</TableCell>
49
- <TableCell>${dataset[3].y * 10}k</TableCell>
50
- <TableCell>${dataset[4].y * 10}k</TableCell>
51
- </TableRow>
52
- ))}
53
- </TableBody>
54
- </Table>
55
- </Card>
56
- );
57
- };
@@ -1,100 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import styled from '@emotion/styled';
4
- import {
5
- StyledTooltip,
6
- ThemeContext,
7
- TooltipArrow,
8
- TooltipPosition,
9
- ThemeInterface,
10
- } from 'react-magma-dom';
11
-
12
- const StyledGraphTooltip = styled(StyledTooltip)`
13
- background: ${(props: any) => props.theme.colors.neutral100};
14
- border: 1px solid ${(props: any) => props.theme.colors.neutral300};
15
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
16
- box-sizing: border-box;
17
- color: ${(props: any) => props.theme.colors.neutral};
18
- font-size: ${(props: any) => props.theme.typeScale.size02.fontSize};
19
- font-weight: normal;
20
- line-height: ${(props: any) => props.theme.typeScale.size02.lineHeight};
21
- margin: 0;
22
- padding: 8px;
23
- width: fit-content;
24
- div {
25
- margin-bottom: 8px;
26
- display: flex;
27
- align-items: flex-start;
28
- &:last-of-type {
29
- margin-bottom: 0;
30
- }
31
- }
32
- `;
33
-
34
- const TooltipColorSwatch = styled.span`
35
- background: ${(props: any) => props.color};
36
- border: ${(props: any) => (props.color ? 'none' : '3px solid black')};
37
- border-radius: 4px;
38
- height: 20px;
39
- width: 20px;
40
- margin-right: 8px;
41
- `;
42
-
43
- export const GraphTooltip = (props: any) => {
44
- const { datum, index, showTooltip, x, y } = props;
45
-
46
- const theme: ThemeInterface = React.useContext(ThemeContext);
47
- const linePointIndex = `${index}-${datum.index}`;
48
-
49
- return showTooltip === linePointIndex ? (
50
- <g style={{ pointerEvents: 'none' }}>
51
- <foreignObject x={x} y={y} width="275" height="100%">
52
- <StyledGraphTooltip
53
- position={TooltipPosition.top}
54
- role="tooltip"
55
- theme={theme}
56
- >
57
- <div>
58
- <TooltipColorSwatch color={theme.iterableColors[index]} />
59
- <span>{datum.label}</span>
60
- </div>
61
- <TooltipArrow theme={theme} />
62
- </StyledGraphTooltip>
63
- </foreignObject>
64
- </g>
65
- ) : null;
66
- };
67
-
68
- export const AxisTooltip = (props: any) => {
69
- const { x, y, activePoints, hiddenData, dataLength } = props;
70
-
71
- const pointsIndexes = Array.from(
72
- Array(dataLength - 0),
73
- (_, i) => i + 0
74
- ).filter(i => !hiddenData.includes(i));
75
-
76
- const theme: ThemeInterface = React.useContext(ThemeContext);
77
-
78
- return (
79
- <g style={{ pointerEvents: 'none' }}>
80
- <foreignObject x={x} y={y} width="275" height="100%">
81
- <StyledGraphTooltip
82
- data-testid="axis-tooltip"
83
- position={TooltipPosition.top}
84
- role="tooltip"
85
- theme={theme}
86
- >
87
- {activePoints.map((point: any, i: number) => (
88
- <div key={i}>
89
- <TooltipColorSwatch
90
- color={theme.iterableColors[pointsIndexes[i]]}
91
- />
92
- <span>{point.label}</span>
93
- </div>
94
- ))}
95
- <TooltipArrow theme={theme} />
96
- </StyledGraphTooltip>
97
- </foreignObject>
98
- </g>
99
- );
100
- };
@@ -1,77 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { ThemeContext, Checkbox } from 'react-magma-dom';
4
-
5
- export interface DataTableProps {
6
- name?: string;
7
- color?: string;
8
- }
9
-
10
- export const LegendButton = React.forwardRef<HTMLButtonElement, any>(
11
- (props, ref) => {
12
- const {
13
- children,
14
- color,
15
- dataIndex,
16
- isHidden,
17
- onClick,
18
- name,
19
- focusCurrentLine,
20
- resetLineFocus,
21
- ...other
22
- } = props;
23
-
24
- function handleClick() {
25
- onClick && typeof onClick === 'function' && onClick(dataIndex);
26
-
27
- if (!isHidden) {
28
- resetLineFocus &&
29
- typeof resetLineFocus === 'function' &&
30
- resetLineFocus();
31
- }
32
- }
33
-
34
- function handleOnMouseEnterOrFocus() {
35
- if (!isHidden) {
36
- focusCurrentLine &&
37
- typeof focusCurrentLine === 'function' &&
38
- focusCurrentLine(dataIndex);
39
- }
40
- }
41
-
42
- const theme = React.useContext(ThemeContext);
43
-
44
- return (
45
- <div
46
- style={{ display: 'inline-flex' }}
47
- onMouseEnter={handleOnMouseEnterOrFocus}
48
- onMouseLeave={resetLineFocus}
49
- >
50
- <Checkbox
51
- checked={!isHidden}
52
- color={color}
53
- containerStyle={{
54
- alignItems: 'center',
55
- border: '0',
56
- boxShadow: '0 0 0',
57
- color: theme.colors.neutral,
58
- display: 'inline-flex',
59
- margin: '0 36px 20px 0',
60
- padding: '0',
61
- }}
62
- inputStyle={{
63
- border: color ? `none` : `2px solid ${theme.colors.neutral800}`,
64
- borderRadius: '4px',
65
- }}
66
- labelText={name}
67
- onBlur={resetLineFocus}
68
- onClick={handleClick}
69
- onFocus={handleOnMouseEnterOrFocus}
70
- ref={ref}
71
- theme={theme}
72
- {...other}
73
- />
74
- </div>
75
- );
76
- }
77
- );
@@ -1,399 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { StoryFn, Meta } from '@storybook/react/types-6-0';
4
-
5
- import {
6
- historyOfTexas as historyOfTexasData,
7
- spendingRevenue as spendingRevenueData,
8
- votingParticipation as votingParticipationData,
9
- } from './test/exampleChartData';
10
-
11
- import { Chart, ChartProps } from './index';
12
-
13
- const data = [
14
- {
15
- name: 'Team 1',
16
- data: [
17
- { x: 1, y: 39, label: 'Team 1, January, $39k' },
18
- { x: 2, y: 28, label: 'Team 1, February, $28k' },
19
- { x: 3, y: 35, label: 'Team 1, March, $35k' },
20
- { x: 4, y: 44, label: 'Team 1, April, $44k' },
21
- { x: 5, y: 21, label: 'Team 1, May, $21k' },
22
- ],
23
- },
24
- {
25
- name: 'Team 2',
26
- data: [
27
- { x: 1, y: 27, label: 'Team 2, January, $27k' },
28
- { x: 2, y: 33, label: 'Team 2, February, $33k' },
29
- { x: 3, y: 39, label: 'Team 2, March, $39k' },
30
- { x: 4, y: 28, label: 'Team 2, April, $28k' },
31
- { x: 5, y: 19, label: 'Team 2, May, $19k' },
32
- ],
33
- },
34
- {
35
- name: 'Team 3',
36
- data: [
37
- { x: 1, y: 32, label: 'Team 3, January, $32k' },
38
- { x: 2, y: 41, label: 'Team 3, February, $41k' },
39
- { x: 3, y: 45, label: 'Team 3, March, $45k' },
40
- { x: 4, y: 56, label: 'Team 3, April, $56k' },
41
- { x: 5, y: 48, label: 'Team 3, May, $48k' },
42
- ],
43
- },
44
- {
45
- name: 'Team 4',
46
- data: [
47
- { x: 1, y: 48, label: 'Team 4, January, $48k' },
48
- { x: 2, y: 66, label: 'Team 4, February, $66k' },
49
- { x: 3, y: 52, label: 'Team 4, March, $52k' },
50
- { x: 4, y: 36, label: 'Team 4, April, $36k' },
51
- { x: 5, y: 10, label: 'Team 4, May, $10k' },
52
- ],
53
- },
54
- ];
55
-
56
- export default {
57
- title: 'Chart',
58
- component: Chart,
59
- } as Meta;
60
-
61
- const title = 'Annual sales figures for 2019';
62
-
63
- const description =
64
- 'description - Lorem ipsum dolor sitamet, consectetur adipiscing elit.';
65
-
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
- },
83
- },
84
- },
85
- };
86
-
87
- interface ExplicitDataInterface {
88
- month: string | number;
89
- sales: string | number;
90
- [key: string]: any;
91
- }
92
-
93
- const explicitData = [
94
- {
95
- name: 'Team 1',
96
- data: [
97
- { month: 1, sales: 39, label: 'Team 1, January, $39k' },
98
- { month: 2, sales: 28, label: 'Team 1, February, $28k' },
99
- { month: 3, sales: 35, label: 'Team 1, March, $35k' },
100
- { month: 4, sales: 44, label: 'Team 1, April, $44k' },
101
- { month: 5, sales: 21, label: 'Team 1, May, $21k' },
102
- { month: 6, sales: 22, label: 'Team 1, June, $22k' },
103
- { month: 7, sales: 67, label: 'Team 1, July, $67k' },
104
- { month: 8, sales: 110, label: 'Team 1, August, $110k' },
105
- { month: 9, sales: 90, label: 'Team 1, September, $90k' },
106
- { month: 10, sales: 47, label: 'Team 1, October, $47k' },
107
- { month: 11, sales: 17, label: 'Team 1, November, $17k' },
108
- { month: 12, sales: 24, label: 'Team 1, December, $24k' },
109
- ],
110
- },
111
- {
112
- name: 'Team 2',
113
- data: [
114
- { month: 1, sales: 27, label: 'Team 2, January, $27k' },
115
- { month: 2, sales: 33, label: 'Team 2, February, $33k' },
116
- { month: 3, sales: 39, label: 'Team 2, March, $39k' },
117
- { month: 4, sales: 28, label: 'Team 2, April, $28k' },
118
- { month: 5, sales: 19, label: 'Team 2, May, $19k' },
119
- { month: 6, sales: 22, label: 'Team 2, June, $22k' },
120
- { month: 7, sales: 27, label: 'Team 2, July, $27k' },
121
- { month: 8, sales: 21, label: 'Team 2, August, $21k' },
122
- { month: 9, sales: 30, label: 'Team 2, September, $30k' },
123
- { month: 10, sales: 29, label: 'Team 2, October, $29k' },
124
- { month: 11, sales: 34, label: 'Team 2, November, $34k' },
125
- { month: 12, sales: 36, label: 'Team 2, December, $36k' },
126
- ],
127
- },
128
- {
129
- name: 'Team 3',
130
- data: [
131
- { month: 1, sales: 39, label: 'Team 3, January, $39k' },
132
- { month: 2, sales: 39, label: 'Team 3, February, $39k' },
133
- { month: 3, sales: 39, label: 'Team 3, March, $39k' },
134
- { month: 4, sales: 39, label: 'Team 3, April, $39k' },
135
- { month: 5, sales: 39, label: 'Team 3, May, $39k' },
136
- { month: 6, sales: 39, label: 'Team 3, June, $39k' },
137
- { month: 7, sales: 39, label: 'Team 3, July, $39k' },
138
- { month: 8, sales: 39, label: 'Team 3, August, $39k' },
139
- { month: 9, sales: 39, label: 'Team 3, September, $39k' },
140
- { month: 10, sales: 39, label: 'Team 3, October, $39k' },
141
- { month: 11, sales: 39, label: 'Team 3, November, $39k' },
142
- { month: 12, sales: 39, label: 'Team 3, December, $39k' },
143
- ],
144
- },
145
- {
146
- name: 'Team 4',
147
- data: [
148
- { month: 1, sales: 48, label: 'Team 4, January, $48k' },
149
- { month: 2, sales: 66, label: 'Team 4, February, $66k' },
150
- { month: 3, sales: 52, label: 'Team 4, March, $52k' },
151
- { month: 4, sales: 36, label: 'Team 4, April, $36k' },
152
- { month: 5, sales: 10, label: 'Team 4, May, $10k' },
153
- { month: 6, sales: 15, label: 'Team 4, June, $15k' },
154
- { month: 7, sales: 100, label: 'Team 4, July, $100k' },
155
- { month: 8, sales: 12, label: 'Team 4, August, $12k' },
156
- { month: 9, sales: 54, label: 'Team 4, September, $54k' },
157
- { month: 10, sales: 48, label: 'Team 4, October, $48k' },
158
- { month: 11, sales: 76, label: 'Team 4, November, $76k' },
159
- { month: 12, sales: 32, label: 'Team 4, December, $32k' },
160
- ],
161
- },
162
- {
163
- name: 'Team 5',
164
- data: [
165
- { month: 1, sales: 24, label: 'Team 5, January, $24k' },
166
- { month: 2, sales: 9, label: 'Team 5, February, $9k' },
167
- { month: 3, sales: 17, label: 'Team 5, March, $17k' },
168
- { month: 4, sales: 28, label: 'Team 5, April, $28k' },
169
- { month: 5, sales: 31, label: 'Team 5, May, $31k' },
170
- { month: 6, sales: 68, label: 'Team 5, June, $68k' },
171
- { month: 7, sales: 70, label: 'Team 5, July, $70k' },
172
- { month: 8, sales: 81, label: 'Team 5, August, $81k' },
173
- { month: 9, sales: 81, label: 'Team 5, September, $81k' },
174
- { month: 10, sales: 81, label: 'Team 5, October, $81k' },
175
- { month: 11, sales: 84, label: 'Team 5, November, $84k' },
176
- { month: 12, sales: 76, label: 'Team 5, December, $76k' },
177
- ],
178
- },
179
- {
180
- name: 'Team 6',
181
- data: [
182
- { month: 1, sales: 75, label: 'Team 6, January, $75k' },
183
- { month: 2, sales: 43, label: 'Team 6, February, $43k' },
184
- { month: 3, sales: 72, label: 'Team 6, March, $72k' },
185
- { month: 4, sales: 38, label: 'Team 6, April, $38k' },
186
- { month: 5, sales: 81, label: 'Team 6, May, $81k' },
187
- { month: 6, sales: 21, label: 'Team 6, June, $21k' },
188
- { month: 7, sales: 74, label: 'Team 6, July, $74k' },
189
- { month: 8, sales: 64, label: 'Team 6, August, $64k' },
190
- { month: 9, sales: 42, label: 'Team 6, September, $42k' },
191
- { month: 10, sales: 72, label: 'Team 6, October, $72k' },
192
- { month: 11, sales: 34, label: 'Team 6, November, $34k' },
193
- { month: 12, sales: 90, label: 'Team 6, December, $90k' },
194
- ],
195
- },
196
- {
197
- name: 'Team 7',
198
- data: [
199
- { month: 1, sales: 53, label: 'Team 7, January, $53k' },
200
- { month: 2, sales: 43, label: 'Team 7, February, $43k' },
201
- { month: 3, sales: 43, label: 'Team 7, March, $43k' },
202
- { month: 4, sales: 43, label: 'Team 7, April, $43k' },
203
- { month: 5, sales: 49, label: 'Team 7, May, $49k' },
204
- { month: 6, sales: 51, label: 'Team 7, June, $51k' },
205
- { month: 7, sales: 32, label: 'Team 7, July, $32k' },
206
- { month: 8, sales: 32, label: 'Team 7, August, $32k' },
207
- { month: 9, sales: 32, label: 'Team 7, September, $32k' },
208
- { month: 10, sales: 57, label: 'Team 7, October, $57k' },
209
- { month: 11, sales: 50, label: 'Team 7, November, $50k' },
210
- { month: 12, sales: 64, label: 'Team 7, December, $64k' },
211
- ],
212
- },
213
- {
214
- name: 'Team 8',
215
- data: [
216
- { month: 1, sales: 60, label: 'Team 8, January, $60k' },
217
- { month: 2, sales: 24, label: 'Team 8, February, $24k' },
218
- { month: 3, sales: 55, label: 'Team 8, March, $55k' },
219
- { month: 4, sales: 61, label: 'Team 8, April, $61k' },
220
- { month: 5, sales: 78, label: 'Team 8, May, $78k' },
221
- { month: 6, sales: 26, label: 'Team 8, June, $26k' },
222
- { month: 7, sales: 38, label: 'Team 8, July, $38k' },
223
- { month: 8, sales: 39, label: 'Team 8, August, $39k' },
224
- { month: 9, sales: 59, label: 'Team 8, September, $59k' },
225
- { month: 10, sales: 51, label: 'Team 8, October, $51k' },
226
- { month: 11, sales: 17, label: 'Team 8, November, $17k' },
227
- { month: 12, sales: 22, label: 'Team 8, December, $22k' },
228
- ],
229
- },
230
- {
231
- name: 'Team 9',
232
- data: [
233
- { month: 1, sales: 103, label: 'Team 9, January, $103k' },
234
- { month: 2, sales: 99, label: 'Team 9, February, $99k' },
235
- { month: 3, sales: 78, label: 'Team 9, March, $78k' },
236
- { month: 4, sales: 63, label: 'Team 9, April, $63k' },
237
- { month: 5, sales: 68, label: 'Team 9, May, $68k' },
238
- { month: 6, sales: 112, label: 'Team 9, June, $112k' },
239
- { month: 7, sales: 97, label: 'Team 9, July, $97k' },
240
- { month: 8, sales: 37, label: 'Team 9, August, $37k' },
241
- { month: 9, sales: 49, label: 'Team 9, September, $49k' },
242
- { month: 10, sales: 58, label: 'Team 9, October, $58k' },
243
- { month: 11, sales: 78, label: 'Team 9, November, $78k' },
244
- { month: 12, sales: 92, label: 'Team 9, December, $92k' },
245
- ],
246
- },
247
- {
248
- name: 'Team 10',
249
- data: [
250
- { month: 1, sales: 36, label: 'Team 10, January, $36k' },
251
- { month: 2, sales: 22, label: 'Team 10, February, $22k' },
252
- { month: 3, sales: 3, label: 'Team 10, March, $3k' },
253
- { month: 4, sales: 7, label: 'Team 10, April, $7k' },
254
- { month: 5, sales: 14, label: 'Team 10, May, $14k' },
255
- { month: 6, sales: 30, label: 'Team 10, June, $30k' },
256
- { month: 7, sales: 33, label: 'Team 10, July, $33k' },
257
- { month: 8, sales: 54, label: 'Team 10, August, $54k' },
258
- { month: 9, sales: 61, label: 'Team 10, September, $61k' },
259
- { month: 10, sales: 77, label: 'Team 10, October, $77k' },
260
- { month: 11, sales: 75, label: 'Team 10, November, $75k' },
261
- { month: 12, sales: 88, label: 'Team 10, December, $88k' },
262
- ],
263
- },
264
- {
265
- name: 'Team 11',
266
- data: [
267
- { month: 1, sales: 12, label: 'Team 11, January, $12k' },
268
- { month: 2, sales: 19, label: 'Team 11, February, $19k' },
269
- { month: 3, sales: 57, label: 'Team 11, March, $57k' },
270
- { month: 4, sales: 96, label: 'Team 11, April, $96k' },
271
- { month: 5, sales: 82, label: 'Team 11, May, $82k' },
272
- { month: 6, sales: 82, label: 'Team 11, June, $82k' },
273
- { month: 7, sales: 82, label: 'Team 11, July, $82k' },
274
- { month: 8, sales: 99, label: 'Team 11, August, $99k' },
275
- { month: 9, sales: 52, label: 'Team 11, September, $52k' },
276
- { month: 10, sales: 81, label: 'Team 11, October, $81k' },
277
- { month: 11, sales: 73, label: 'Team 11, November, $73k' },
278
- { month: 12, sales: 8, label: 'Team 11, December, $8k' },
279
- ],
280
- },
281
- {
282
- name: 'Team 12',
283
- data: [
284
- { month: 1, sales: 0, label: 'Team 12, January, $0k' },
285
- { month: 2, sales: 0, label: 'Team 12, February, $0k' },
286
- { month: 3, sales: 0, label: 'Team 12, March, $0k' },
287
- { month: 4, sales: 0, label: 'Team 12, April, $0k' },
288
- { month: 5, sales: 0, label: 'Team 12, May, $0k' },
289
- { month: 6, sales: 3, label: 'Team 12, June, $3k' },
290
- { month: 7, sales: 7, label: 'Team 12, July, $7k' },
291
- { month: 8, sales: 5, label: 'Team 12, August, $5k' },
292
- { month: 9, sales: 1, label: 'Team 12, September, $1k' },
293
- { month: 10, sales: 0, label: 'Team 12, October, $0k' },
294
- { month: 11, sales: 0, label: 'Team 12, November, $0k' },
295
- { month: 12, sales: 0, label: 'Team 12, December, $0k' },
296
- ],
297
- },
298
- ];
299
-
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
- },
322
- },
323
- data: explicitData,
324
- x: 'month',
325
- y: 'sales',
326
- },
327
- };
328
-
329
- interface HistoryOfTexasInterface {
330
- year: number;
331
- number: number;
332
- label: string;
333
- }
334
-
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
- },
352
- },
353
- data: historyOfTexasData,
354
- x: 'year',
355
- y: 'number',
356
- },
357
- };
358
-
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
- },
372
- },
373
- },
374
- };
375
-
376
- interface VotingParticipationInterface {
377
- year: number;
378
- percent: number;
379
- label: string;
380
- }
381
-
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
- },
395
- },
396
- x: 'year',
397
- y: 'percent',
398
- },
399
- };