@semcore/d3-chart 2.3.0-1 → 2.3.2
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/CHANGELOG.md +31 -1
- package/lib/cjs/Area.js +9 -9
- package/lib/cjs/Axis.js +14 -14
- package/lib/cjs/Bar.js +8 -8
- package/lib/cjs/Bubble.js +10 -10
- package/lib/cjs/Donut.js +7 -7
- package/lib/cjs/Dots.js +9 -9
- package/lib/cjs/GroupBar.js +6 -6
- package/lib/cjs/HorizontalBar.js +8 -8
- package/lib/cjs/Hover.js +4 -4
- package/lib/cjs/Line.js +8 -8
- package/lib/cjs/Plot.js +4 -4
- package/lib/cjs/RadialTree.js +11 -11
- package/lib/cjs/ReferenceLine.js +10 -10
- package/lib/cjs/ResponsiveContainer.js +1 -0
- package/lib/cjs/ResponsiveContainer.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +7 -7
- package/lib/cjs/StackBar.js +6 -6
- package/lib/cjs/StackedArea.js +7 -7
- package/lib/cjs/Tooltip.js +8 -8
- package/lib/cjs/Venn.js +7 -7
- package/lib/cjs/a11y/PlotA11yModule.js +18 -6
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +7 -5
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/a11y/insights.js.map +1 -1
- package/lib/cjs/a11y/locale.js +6 -2
- package/lib/cjs/a11y/locale.js.map +1 -1
- package/lib/es6/Area.js +9 -9
- package/lib/es6/Axis.js +14 -14
- package/lib/es6/Bar.js +8 -8
- package/lib/es6/Bubble.js +10 -10
- package/lib/es6/Donut.js +7 -7
- package/lib/es6/Dots.js +9 -9
- package/lib/es6/GroupBar.js +6 -6
- package/lib/es6/HorizontalBar.js +8 -8
- package/lib/es6/Hover.js +4 -4
- package/lib/es6/Line.js +8 -8
- package/lib/es6/Plot.js +4 -4
- package/lib/es6/RadialTree.js +11 -11
- package/lib/es6/ReferenceLine.js +10 -10
- package/lib/es6/ResponsiveContainer.js +1 -0
- package/lib/es6/ResponsiveContainer.js.map +1 -1
- package/lib/es6/ScatterPlot.js +7 -7
- package/lib/es6/StackBar.js +6 -6
- package/lib/es6/StackedArea.js +7 -7
- package/lib/es6/Tooltip.js +8 -8
- package/lib/es6/Venn.js +7 -7
- package/lib/es6/a11y/PlotA11yModule.js +14 -6
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +6 -5
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/a11y/insights.js.map +1 -1
- package/lib/es6/a11y/locale.js +6 -2
- package/lib/es6/a11y/locale.js.map +1 -1
- package/lib/types/a11y/hints.d.ts +2 -23
- package/lib/types/a11y/locale.d.ts +1 -1
- package/lib/types/a11y/serialize.d.ts +3 -3
- package/lib/types/a11y/summarize.d.ts +1 -1
- package/lib/types/utils.d.ts +4 -4
- package/package.json +2 -2
- package/lib/cjs/a11y/datasets/charts-a11y.js +0 -591
- package/lib/cjs/a11y/datasets/charts-a11y.js.map +0 -1
- package/lib/cjs/a11y/datasets/gold.json +0 -7961
- package/lib/cjs/a11y/datasets/imdb.json +0 -10002
- package/lib/cjs/a11y/datasets/readme.md +0 -5
- package/lib/cjs/a11y/datasets/stores.json +0 -6274
- package/lib/cjs/a11y/datasets/titanic.json +0 -5436
- package/lib/es6/a11y/datasets/charts-a11y.js +0 -590
- package/lib/es6/a11y/datasets/charts-a11y.js.map +0 -1
- package/lib/es6/a11y/datasets/gold.json +0 -7961
- package/lib/es6/a11y/datasets/imdb.json +0 -10002
- package/lib/es6/a11y/datasets/readme.md +0 -5
- package/lib/es6/a11y/datasets/stores.json +0 -6274
- package/lib/es6/a11y/datasets/titanic.json +0 -5436
- package/lib/types/a11y/datasets/charts-a11y.d.ts +0 -0
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
// import React from 'react';
|
|
2
|
-
// import {
|
|
3
|
-
// Line,
|
|
4
|
-
// XAxis,
|
|
5
|
-
// Plot,
|
|
6
|
-
// YAxis,
|
|
7
|
-
// minMax,
|
|
8
|
-
// Tooltip,
|
|
9
|
-
// Bubble,
|
|
10
|
-
// Donut,
|
|
11
|
-
// colors,
|
|
12
|
-
// Bar,
|
|
13
|
-
// HorizontalBar,
|
|
14
|
-
// GroupBar,
|
|
15
|
-
// HoverRect,
|
|
16
|
-
// RadialTree,
|
|
17
|
-
// Plot,
|
|
18
|
-
// ScatterPlot,
|
|
19
|
-
// XAxis,
|
|
20
|
-
// YAxis,
|
|
21
|
-
// minMax,
|
|
22
|
-
// Tooltip,
|
|
23
|
-
// StackBar,
|
|
24
|
-
// Plot,
|
|
25
|
-
// XAxis,
|
|
26
|
-
// YAxis,
|
|
27
|
-
// minMax,
|
|
28
|
-
// colors,
|
|
29
|
-
// StackedArea,
|
|
30
|
-
// HoverLine,
|
|
31
|
-
// Tooltip,
|
|
32
|
-
// Venn,
|
|
33
|
-
// } from '@semcore/d3-chart';
|
|
34
|
-
// import { Flex, Box, Flex, Box } from '@semcore/flex-box';
|
|
35
|
-
// import { Text, Text, Text } from '@semcore/typography';
|
|
36
|
-
// import LikeM from '@semcore/icon/Like/m';
|
|
37
|
-
// import resolveColor from '@semcore/utils/src/color';
|
|
38
|
-
// import { scaleLinear, scaleBand, scaleLinear, scaleLinear } from 'd3-scale';
|
|
39
|
-
// import goldData from '../../../semcore/d3-chart/src/a11y/datasets/gold.json';
|
|
40
|
-
// import imbdmData from '../../../semcore/d3-chart/src/a11y/datasets/imdb.json';
|
|
41
|
-
// import titanicData from '../../../semcore/d3-chart/src/a11y/datasets/titanic.json';
|
|
42
|
-
// const Stonks = () => {
|
|
43
|
-
// const MARGIN = 40;
|
|
44
|
-
// const width = 500;
|
|
45
|
-
// const height = 300;
|
|
46
|
-
// const data = goldData
|
|
47
|
-
// .map((row) => {
|
|
48
|
-
// const [d, m, y] = row.Date.split('-');
|
|
49
|
-
// return {
|
|
50
|
-
// ...row,
|
|
51
|
-
// Date: new Date(`${m}-${d}-${y}`),
|
|
52
|
-
// };
|
|
53
|
-
// })
|
|
54
|
-
// .filter((_, index) => index % 10 === 0);
|
|
55
|
-
// const xScale = scaleLinear()
|
|
56
|
-
// .range([MARGIN, width - MARGIN])
|
|
57
|
-
// .domain(minMax(data, 'Date'));
|
|
58
|
-
// const yScale = scaleLinear()
|
|
59
|
-
// .range([height - MARGIN, MARGIN])
|
|
60
|
-
// .domain(minMax(data, 'United States(USD)'));
|
|
61
|
-
// return (
|
|
62
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
63
|
-
// <YAxis>
|
|
64
|
-
// <YAxis.Ticks />
|
|
65
|
-
// <YAxis.Grid />
|
|
66
|
-
// <YAxis.Title>Price</YAxis.Title>
|
|
67
|
-
// </YAxis>
|
|
68
|
-
// <XAxis>
|
|
69
|
-
// <XAxis.Title>Year</XAxis.Title>
|
|
70
|
-
// <XAxis.Ticks ticks={xScale.ticks(6)}>
|
|
71
|
-
// {({ value }) => ({
|
|
72
|
-
// children: formatDate(value, {
|
|
73
|
-
// month: 'short',
|
|
74
|
-
// day: 'numeric',
|
|
75
|
-
// year: 'numeric',
|
|
76
|
-
// }),
|
|
77
|
-
// })}
|
|
78
|
-
// </XAxis.Ticks>
|
|
79
|
-
// </XAxis>
|
|
80
|
-
// <Line x="Date" y="United States(USD)">
|
|
81
|
-
// <Line.Dots display />
|
|
82
|
-
// </Line>
|
|
83
|
-
// <Line x="Date" y="Europe(EUR)">
|
|
84
|
-
// <Line.Dots display />
|
|
85
|
-
// </Line>
|
|
86
|
-
// <Line x="Date" y="Australia(AUD)">
|
|
87
|
-
// <Line.Dots display />
|
|
88
|
-
// </Line>
|
|
89
|
-
// </Plot>
|
|
90
|
-
// );
|
|
91
|
-
// };
|
|
92
|
-
// const FilmBubbles = () => {
|
|
93
|
-
// const MARGIN = 40;
|
|
94
|
-
// const width = 500;
|
|
95
|
-
// const height = 300;
|
|
96
|
-
// const data = imbdmData
|
|
97
|
-
// .map((row) => ({ ...row, label: row.Title }))
|
|
98
|
-
// .filter((_, index) => index % 70 === 0);
|
|
99
|
-
// const xScale = scaleLinear()
|
|
100
|
-
// .range([MARGIN, width - MARGIN])
|
|
101
|
-
// .domain([1950, 2020]);
|
|
102
|
-
// const yScale = scaleLinear()
|
|
103
|
-
// .range([height - MARGIN, MARGIN])
|
|
104
|
-
// .domain([0, 10]);
|
|
105
|
-
// return (
|
|
106
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
107
|
-
// <YAxis>
|
|
108
|
-
// <YAxis.Ticks />
|
|
109
|
-
// <YAxis.Grid />
|
|
110
|
-
// </YAxis>
|
|
111
|
-
// <XAxis>
|
|
112
|
-
// <XAxis.Ticks />
|
|
113
|
-
// </XAxis>
|
|
114
|
-
// <Bubble x="ReleaseYear" y="IMDb-Rating" value="IMDb-Rating" />
|
|
115
|
-
// </Plot>
|
|
116
|
-
// );
|
|
117
|
-
// };
|
|
118
|
-
// const SurvivedTitanicClassesPie = () => {
|
|
119
|
-
// const data: Record<string, number> = {};
|
|
120
|
-
// for (const row of titanicData) {
|
|
121
|
-
// const className = String(row.Pclass);
|
|
122
|
-
// data[className] = data[className] ? data[className] + 1 : 1;
|
|
123
|
-
// }
|
|
124
|
-
// return (
|
|
125
|
-
// <Plot width={300} height={300} data={data}>
|
|
126
|
-
// <Donut innerRadius={100}>
|
|
127
|
-
// <Donut.Pie dataKey="1" name="Class 1" />
|
|
128
|
-
// <Donut.Pie dataKey="2" color={colors['green-02']} name="Class 2" />
|
|
129
|
-
// <Donut.Pie dataKey="3" color={colors['violet-04']} name="Class 3" />
|
|
130
|
-
// <Donut.Label>Survived classes</Donut.Label>
|
|
131
|
-
// </Donut>
|
|
132
|
-
// <Tooltip>
|
|
133
|
-
// {({ dataKey, name }) => {
|
|
134
|
-
// return {
|
|
135
|
-
// children: (
|
|
136
|
-
// <>
|
|
137
|
-
// <Tooltip.Title>{name}</Tooltip.Title>
|
|
138
|
-
// <Flex justifyContent="space-between">
|
|
139
|
-
// <Text bold>{data[dataKey]}</Text>
|
|
140
|
-
// </Flex>
|
|
141
|
-
// </>
|
|
142
|
-
// ),
|
|
143
|
-
// };
|
|
144
|
-
// }}
|
|
145
|
-
// </Tooltip>
|
|
146
|
-
// </Plot>
|
|
147
|
-
// );
|
|
148
|
-
// };
|
|
149
|
-
// const SurvivedTitanicClassesBars = () => {
|
|
150
|
-
// const pieData: Record<string, number> = {};
|
|
151
|
-
// for (const row of titanicData) {
|
|
152
|
-
// const className = String(row.Pclass);
|
|
153
|
-
// pieData[className] = pieData[className] ? pieData[className] + 1 : 1;
|
|
154
|
-
// }
|
|
155
|
-
// const data = Object.entries(pieData).map(([className, survived]) => ({
|
|
156
|
-
// className: `Class ${className}`,
|
|
157
|
-
// survived,
|
|
158
|
-
// }));
|
|
159
|
-
// const MARGIN = 40;
|
|
160
|
-
// const width = 500;
|
|
161
|
-
// const height = 300;
|
|
162
|
-
// const xScale = scaleBand()
|
|
163
|
-
// .range([MARGIN, width - MARGIN])
|
|
164
|
-
// .domain(data.map((d) => d.className))
|
|
165
|
-
// .paddingInner(0.4)
|
|
166
|
-
// .paddingOuter(0.2);
|
|
167
|
-
// const yScale = scaleLinear()
|
|
168
|
-
// .range([height - MARGIN, MARGIN])
|
|
169
|
-
// .domain([0, 260]);
|
|
170
|
-
// return (
|
|
171
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
172
|
-
// <YAxis>
|
|
173
|
-
// <YAxis.Ticks />
|
|
174
|
-
// <YAxis.Grid />
|
|
175
|
-
// </YAxis>
|
|
176
|
-
// <XAxis>
|
|
177
|
-
// <XAxis.Ticks />
|
|
178
|
-
// <XAxis.Title>Survived passengers</XAxis.Title>
|
|
179
|
-
// </XAxis>
|
|
180
|
-
// <Bar x="className" y="survived" />
|
|
181
|
-
// </Plot>
|
|
182
|
-
// );
|
|
183
|
-
// };
|
|
184
|
-
// const HorizaontalBars = () => {
|
|
185
|
-
// const data = [...Array(5).keys()].map((d, i) => ({
|
|
186
|
-
// category: `Category ${i}`,
|
|
187
|
-
// bar: i + (Math.random() * 10).toFixed('2'),
|
|
188
|
-
// }));
|
|
189
|
-
// const MARGIN = 40;
|
|
190
|
-
// const width = 500;
|
|
191
|
-
// const height = 300;
|
|
192
|
-
// const xScale = scaleLinear()
|
|
193
|
-
// .range([MARGIN * 2, width - MARGIN * 2])
|
|
194
|
-
// .domain([0, Math.max(...data.map((d) => d.bar))]);
|
|
195
|
-
// const yScale = scaleBand()
|
|
196
|
-
// .range([height - MARGIN, MARGIN])
|
|
197
|
-
// .domain(data.map((d) => d.category))
|
|
198
|
-
// .paddingInner(0.4)
|
|
199
|
-
// .paddingOuter(0.2);
|
|
200
|
-
// return (
|
|
201
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
202
|
-
// <YAxis>
|
|
203
|
-
// <YAxis.Ticks />
|
|
204
|
-
// </YAxis>
|
|
205
|
-
// <HorizontalBar x="bar" y="category">
|
|
206
|
-
// {({ value, x, y, width, height }) => {
|
|
207
|
-
// return {
|
|
208
|
-
// children: (
|
|
209
|
-
// <text
|
|
210
|
-
// x={x + width + 16}
|
|
211
|
-
// y={y + height / 2}
|
|
212
|
-
// textAnchor="start"
|
|
213
|
-
// alignmentBaseline="middle"
|
|
214
|
-
// fill={resolveColor('gray60')}
|
|
215
|
-
// >
|
|
216
|
-
// $ {value.bar}
|
|
217
|
-
// </text>
|
|
218
|
-
// ),
|
|
219
|
-
// };
|
|
220
|
-
// }}
|
|
221
|
-
// </HorizontalBar>
|
|
222
|
-
// </Plot>
|
|
223
|
-
// );
|
|
224
|
-
// };
|
|
225
|
-
// const GroupBars = () => {
|
|
226
|
-
// const data = [...Array(5).keys()].map((d, i) => ({
|
|
227
|
-
// category: `Category ${i}`,
|
|
228
|
-
// bar1: Math.random() * 10,
|
|
229
|
-
// bar2: Math.random() * 10,
|
|
230
|
-
// }));
|
|
231
|
-
// const MARGIN = 40;
|
|
232
|
-
// const width = 500;
|
|
233
|
-
// const height = 300;
|
|
234
|
-
// const xScale = scaleLinear()
|
|
235
|
-
// .range([MARGIN * 2, width - MARGIN])
|
|
236
|
-
// .domain([0, 10]);
|
|
237
|
-
// const yScale = scaleBand()
|
|
238
|
-
// .range([height - MARGIN, MARGIN])
|
|
239
|
-
// .domain(data.map((d) => d.category))
|
|
240
|
-
// .paddingInner(0.4)
|
|
241
|
-
// .paddingOuter(0.2);
|
|
242
|
-
// return (
|
|
243
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
244
|
-
// <YAxis hide={false}>
|
|
245
|
-
// <YAxis.Ticks />
|
|
246
|
-
// </YAxis>
|
|
247
|
-
// <XAxis>
|
|
248
|
-
// <XAxis.Ticks />
|
|
249
|
-
// <XAxis.Grid />
|
|
250
|
-
// </XAxis>
|
|
251
|
-
// <Tooltip tag={HoverRect} y="category" wMin={100}>
|
|
252
|
-
// {({ yIndex }) => {
|
|
253
|
-
// return {
|
|
254
|
-
// children: (
|
|
255
|
-
// <>
|
|
256
|
-
// <Tooltip.Title>{data[yIndex].category}</Tooltip.Title>
|
|
257
|
-
// <Flex justifyContent="space-between">
|
|
258
|
-
// <Tooltip.Dot mr={4}>Bar 1</Tooltip.Dot>
|
|
259
|
-
// <Text bold>{data[yIndex].bar1}</Text>
|
|
260
|
-
// </Flex>
|
|
261
|
-
// <Flex mt={2} justifyContent="space-between">
|
|
262
|
-
// <Tooltip.Dot mr={4} color={colors['green-02']}>
|
|
263
|
-
// Bar 2
|
|
264
|
-
// </Tooltip.Dot>
|
|
265
|
-
// <Text bold>{data[yIndex].bar2}</Text>
|
|
266
|
-
// </Flex>
|
|
267
|
-
// </>
|
|
268
|
-
// ),
|
|
269
|
-
// };
|
|
270
|
-
// }}
|
|
271
|
-
// </Tooltip>
|
|
272
|
-
// <GroupBar y="category">
|
|
273
|
-
// <GroupBar.HorizontalBar x="bar1" />
|
|
274
|
-
// <GroupBar.HorizontalBar x="bar2" color={colors['green-02']} />
|
|
275
|
-
// </GroupBar>
|
|
276
|
-
// </Plot>
|
|
277
|
-
// );
|
|
278
|
-
// };
|
|
279
|
-
// const RadialTreeExample = () => {
|
|
280
|
-
// const width = 500;
|
|
281
|
-
// const height = 500;
|
|
282
|
-
// const data = Array(12)
|
|
283
|
-
// .fill({})
|
|
284
|
-
// .map((_, i) => ({
|
|
285
|
-
// label: `Sheep ${i + 1}`,
|
|
286
|
-
// icon: LikeM,
|
|
287
|
-
// }));
|
|
288
|
-
// return (
|
|
289
|
-
// <Plot data={data} scale={[scaleLinear(), scaleLinear()]} width={width} height={height}>
|
|
290
|
-
// <RadialTree color="#AB6CFE">
|
|
291
|
-
// <RadialTree.Radian>
|
|
292
|
-
// <RadialTree.Radian.Label />
|
|
293
|
-
// <RadialTree.Radian.Line />
|
|
294
|
-
// <RadialTree.Radian.Cap />
|
|
295
|
-
// <RadialTree.Radian.Icon />
|
|
296
|
-
// </RadialTree.Radian>
|
|
297
|
-
// <RadialTree.Title>Sleeping</RadialTree.Title>
|
|
298
|
-
// </RadialTree>
|
|
299
|
-
// </Plot>
|
|
300
|
-
// );
|
|
301
|
-
// };
|
|
302
|
-
// const ScatterPlotChart = () => {
|
|
303
|
-
// const data = Array(20)
|
|
304
|
-
// .fill({})
|
|
305
|
-
// .map((d, i) => ({
|
|
306
|
-
// x: i,
|
|
307
|
-
// y: Math.random() * 10,
|
|
308
|
-
// }));
|
|
309
|
-
// const MARGIN = 40;
|
|
310
|
-
// const width = 500;
|
|
311
|
-
// const height = 300;
|
|
312
|
-
// const xScale = scaleLinear()
|
|
313
|
-
// .range([MARGIN, width - MARGIN])
|
|
314
|
-
// .domain(minMax(data, 'x'));
|
|
315
|
-
// const yScale = scaleLinear()
|
|
316
|
-
// .range([height - MARGIN, MARGIN])
|
|
317
|
-
// .domain([0, 10]);
|
|
318
|
-
// return (
|
|
319
|
-
// <Plot scale={[xScale, yScale]} width={width} height={height} data={data}>
|
|
320
|
-
// <YAxis>
|
|
321
|
-
// <YAxis.Ticks />
|
|
322
|
-
// <YAxis.Grid />
|
|
323
|
-
// </YAxis>
|
|
324
|
-
// <XAxis>
|
|
325
|
-
// <XAxis.Ticks />
|
|
326
|
-
// </XAxis>
|
|
327
|
-
// <ScatterPlot x="x" y="y" />
|
|
328
|
-
// <Tooltip>
|
|
329
|
-
// {({ xIndex }) => {
|
|
330
|
-
// return {
|
|
331
|
-
// children: (
|
|
332
|
-
// <>
|
|
333
|
-
// <Tooltip.Title>Data</Tooltip.Title>
|
|
334
|
-
// <Text tag="div">X axis {data[xIndex].x}</Text>
|
|
335
|
-
// <Text tag="div">Y axis {data[xIndex].y}</Text>
|
|
336
|
-
// </>
|
|
337
|
-
// ),
|
|
338
|
-
// };
|
|
339
|
-
// }}
|
|
340
|
-
// </Tooltip>
|
|
341
|
-
// </Plot>
|
|
342
|
-
// );
|
|
343
|
-
// };
|
|
344
|
-
// const StackedBarChart = () => {
|
|
345
|
-
// const MARGIN = 40;
|
|
346
|
-
// const width = 500;
|
|
347
|
-
// const height = 300;
|
|
348
|
-
// const data = [...Array(5).keys()].map((d, i) => ({
|
|
349
|
-
// category: `Category ${i}`,
|
|
350
|
-
// stack1: Math.random() * 10,
|
|
351
|
-
// stack2: Math.random() * 10,
|
|
352
|
-
// }));
|
|
353
|
-
// const xScale = scaleBand()
|
|
354
|
-
// .range([MARGIN, width - MARGIN])
|
|
355
|
-
// .domain(data.map((d) => d.category))
|
|
356
|
-
// .paddingInner(0.4)
|
|
357
|
-
// .paddingOuter(0.2);
|
|
358
|
-
// const yScale = scaleLinear()
|
|
359
|
-
// .range([height - MARGIN, MARGIN])
|
|
360
|
-
// .domain([0, 20]);
|
|
361
|
-
// return (
|
|
362
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
363
|
-
// <YAxis>
|
|
364
|
-
// <YAxis.Ticks />
|
|
365
|
-
// <YAxis.Grid />
|
|
366
|
-
// </YAxis>
|
|
367
|
-
// <XAxis>
|
|
368
|
-
// <XAxis.Ticks />
|
|
369
|
-
// </XAxis>
|
|
370
|
-
// <Tooltip tag={HoverRect} x="category" wMin={100}>
|
|
371
|
-
// {({ xIndex }) => {
|
|
372
|
-
// return {
|
|
373
|
-
// children: (
|
|
374
|
-
// <>
|
|
375
|
-
// <Tooltip.Title>{data[xIndex].category}</Tooltip.Title>
|
|
376
|
-
// <Flex justifyContent="space-between">
|
|
377
|
-
// <Tooltip.Dot mr={4}>Stack 1</Tooltip.Dot>
|
|
378
|
-
// <Text bold>{data[xIndex].stack1}</Text>
|
|
379
|
-
// </Flex>
|
|
380
|
-
// <Flex mt={2} justifyContent="space-between">
|
|
381
|
-
// <Tooltip.Dot mr={4} color={colors['blue-02']}>
|
|
382
|
-
// Stack 2
|
|
383
|
-
// </Tooltip.Dot>
|
|
384
|
-
// <Text bold>{data[xIndex].stack2}</Text>
|
|
385
|
-
// </Flex>
|
|
386
|
-
// <Flex mt={2} justifyContent="space-between">
|
|
387
|
-
// <Box mr={4}>Total</Box>
|
|
388
|
-
// <Text bold>{data[xIndex].stack1 + data[xIndex].stack2}</Text>
|
|
389
|
-
// </Flex>
|
|
390
|
-
// </>
|
|
391
|
-
// ),
|
|
392
|
-
// };
|
|
393
|
-
// }}
|
|
394
|
-
// </Tooltip>
|
|
395
|
-
// <StackBar x="category">
|
|
396
|
-
// <StackBar.Bar y="stack1" />
|
|
397
|
-
// <StackBar.Bar y="stack2" color={colors['blue-02']} />
|
|
398
|
-
// </StackBar>
|
|
399
|
-
// </Plot>
|
|
400
|
-
// );
|
|
401
|
-
// };
|
|
402
|
-
// import { curveCardinal } from 'd3-shape';
|
|
403
|
-
// function formatDate(value, options) {
|
|
404
|
-
// return new Intl.DateTimeFormat('en', options).format(value);
|
|
405
|
-
// }
|
|
406
|
-
// const StackedAreaChart = () => {
|
|
407
|
-
// const date = new Date();
|
|
408
|
-
// const data = [...Array(5).keys()].map((d, i) => ({
|
|
409
|
-
// time: new Date(date.setDate(date.getDate() + 5)),
|
|
410
|
-
// stack1: Math.random() * 5,
|
|
411
|
-
// stack2: Math.random() * 5,
|
|
412
|
-
// stack3: Math.random() * 5,
|
|
413
|
-
// }));
|
|
414
|
-
// const MARGIN = 40;
|
|
415
|
-
// const width = 500;
|
|
416
|
-
// const height = 300;
|
|
417
|
-
// const xScale = scaleLinear()
|
|
418
|
-
// .range([MARGIN, width - MARGIN])
|
|
419
|
-
// .domain(minMax(data, 'time'));
|
|
420
|
-
// const yScale = scaleLinear()
|
|
421
|
-
// .range([height - MARGIN, MARGIN])
|
|
422
|
-
// .domain([0, 15]);
|
|
423
|
-
// return (
|
|
424
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
425
|
-
// <YAxis>
|
|
426
|
-
// <YAxis.Ticks />
|
|
427
|
-
// <YAxis.Grid />
|
|
428
|
-
// </YAxis>
|
|
429
|
-
// <XAxis>
|
|
430
|
-
// <XAxis.Ticks ticks={data.map((d) => +d.time)}>
|
|
431
|
-
// {({ value }) => ({
|
|
432
|
-
// children: formatDate(value, {
|
|
433
|
-
// month: 'short',
|
|
434
|
-
// day: 'numeric',
|
|
435
|
-
// }),
|
|
436
|
-
// })}
|
|
437
|
-
// </XAxis.Ticks>
|
|
438
|
-
// </XAxis>
|
|
439
|
-
// <Tooltip tag={HoverLine} x="time" wMin={100}>
|
|
440
|
-
// {({ xIndex }) => {
|
|
441
|
-
// return {
|
|
442
|
-
// children: (
|
|
443
|
-
// <>
|
|
444
|
-
// <Tooltip.Title>
|
|
445
|
-
// {formatDate(data[xIndex].time, {
|
|
446
|
-
// year: 'numeric',
|
|
447
|
-
// month: 'long',
|
|
448
|
-
// day: 'numeric',
|
|
449
|
-
// })}
|
|
450
|
-
// </Tooltip.Title>
|
|
451
|
-
// <Flex justifyContent="space-between">
|
|
452
|
-
// <Tooltip.Dot mr={4}>Stack 1</Tooltip.Dot>
|
|
453
|
-
// <Text bold>{data[xIndex].stack1}</Text>
|
|
454
|
-
// </Flex>
|
|
455
|
-
// <Flex mt={2} justifyContent="space-between">
|
|
456
|
-
// <Tooltip.Dot mr={4} color={colors['green-02']}>
|
|
457
|
-
// Stack 2
|
|
458
|
-
// </Tooltip.Dot>
|
|
459
|
-
// <Text bold>{data[xIndex].stack2}</Text>
|
|
460
|
-
// </Flex>
|
|
461
|
-
// <Flex mt={2} justifyContent="space-between">
|
|
462
|
-
// <Tooltip.Dot mr={4} color={colors['orange-04']}>
|
|
463
|
-
// Stack 3
|
|
464
|
-
// </Tooltip.Dot>
|
|
465
|
-
// <Text bold>{data[xIndex].stack3}</Text>
|
|
466
|
-
// </Flex>
|
|
467
|
-
// <Flex mt={2} justifyContent="space-between">
|
|
468
|
-
// <Box mr={4}>Total</Box>
|
|
469
|
-
// <Text bold>
|
|
470
|
-
// {data[xIndex].stack1 + data[xIndex].stack2 + data[xIndex].stack3}
|
|
471
|
-
// </Text>
|
|
472
|
-
// </Flex>
|
|
473
|
-
// </>
|
|
474
|
-
// ),
|
|
475
|
-
// };
|
|
476
|
-
// }}
|
|
477
|
-
// </Tooltip>
|
|
478
|
-
// <StackedArea x="time">
|
|
479
|
-
// <StackedArea.Area y="stack1" curve={curveCardinal}>
|
|
480
|
-
// <StackedArea.Area.Dots />
|
|
481
|
-
// </StackedArea.Area>
|
|
482
|
-
// <StackedArea.Area y="stack2" fill="#59DDAA50" color="#59DDAA" curve={curveCardinal}>
|
|
483
|
-
// <StackedArea.Area.Dots />
|
|
484
|
-
// </StackedArea.Area>
|
|
485
|
-
// <StackedArea.Area y="stack3" fill="#FF622D50" color="#FF622D" curve={curveCardinal}>
|
|
486
|
-
// <StackedArea.Area.Dots />
|
|
487
|
-
// </StackedArea.Area>
|
|
488
|
-
// </StackedArea>
|
|
489
|
-
// </Plot>
|
|
490
|
-
// );
|
|
491
|
-
// };
|
|
492
|
-
// const VennChart = () => {
|
|
493
|
-
// const data = {
|
|
494
|
-
// G: 200,
|
|
495
|
-
// F: 200,
|
|
496
|
-
// C: 500,
|
|
497
|
-
// U: 1,
|
|
498
|
-
// 'G/F': 100,
|
|
499
|
-
// 'G/C': 100,
|
|
500
|
-
// 'F/C': 100,
|
|
501
|
-
// 'G/F/C': 100,
|
|
502
|
-
// };
|
|
503
|
-
// return (
|
|
504
|
-
// <Plot height={300} width={400} data={data}>
|
|
505
|
-
// <Venn>
|
|
506
|
-
// <Venn.Circle dataKey="G" name="Good" />
|
|
507
|
-
// <Venn.Circle dataKey="F" name="Fast" color={colors['blue-03']} />
|
|
508
|
-
// <Venn.Circle dataKey="C" name="Cheap" color={colors['orange-04']} />
|
|
509
|
-
// <Venn.Circle dataKey="U" name="Unknown" color={colors['pink-03']} />
|
|
510
|
-
// <Venn.Intersection dataKey="G/F" name="Good & Fast" />
|
|
511
|
-
// <Venn.Intersection dataKey="G/C" name="Good & Cheap" />
|
|
512
|
-
// <Venn.Intersection dataKey="F/C" name="Fast & Cheap" />
|
|
513
|
-
// <Venn.Intersection dataKey="G/F/C" name="Good & Fast & Cheap" />
|
|
514
|
-
// </Venn>
|
|
515
|
-
// <Tooltip>
|
|
516
|
-
// {({ name, dataKey }) => {
|
|
517
|
-
// return {
|
|
518
|
-
// children: (
|
|
519
|
-
// <>
|
|
520
|
-
// <Tooltip.Title>{name}</Tooltip.Title>
|
|
521
|
-
// <Text bold>{data[dataKey]}</Text>
|
|
522
|
-
// </>
|
|
523
|
-
// ),
|
|
524
|
-
// };
|
|
525
|
-
// }}
|
|
526
|
-
// </Tooltip>
|
|
527
|
-
// </Plot>
|
|
528
|
-
// );
|
|
529
|
-
// };
|
|
530
|
-
// const MixedChart = () => {
|
|
531
|
-
// const MARGIN = 40;
|
|
532
|
-
// const width = 500;
|
|
533
|
-
// const height = 300;
|
|
534
|
-
// const data = goldData
|
|
535
|
-
// .map((row) => {
|
|
536
|
-
// const [d, m, y] = row.Date.split('-');
|
|
537
|
-
// return {
|
|
538
|
-
// ...row,
|
|
539
|
-
// Date: new Date(`${m}-${d}-${y}`),
|
|
540
|
-
// };
|
|
541
|
-
// })
|
|
542
|
-
// .filter((_, index) => index % 10 === 0);
|
|
543
|
-
// const xScale = scaleLinear()
|
|
544
|
-
// .range([MARGIN, width - MARGIN])
|
|
545
|
-
// .domain(minMax(data, 'Date'));
|
|
546
|
-
// const yScale = scaleLinear()
|
|
547
|
-
// .range([height - MARGIN, MARGIN])
|
|
548
|
-
// .domain(minMax(data, 'United States(USD)'));
|
|
549
|
-
// return (
|
|
550
|
-
// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>
|
|
551
|
-
// <YAxis>
|
|
552
|
-
// <YAxis.Ticks />
|
|
553
|
-
// <YAxis.Grid />
|
|
554
|
-
// <YAxis.Title>Price</YAxis.Title>
|
|
555
|
-
// </YAxis>
|
|
556
|
-
// <XAxis>
|
|
557
|
-
// <XAxis.Title>Year</XAxis.Title>
|
|
558
|
-
// <XAxis.Ticks />
|
|
559
|
-
// </XAxis>
|
|
560
|
-
// <Line x="Date" y="United States(USD)">
|
|
561
|
-
// <Line.Dots display />
|
|
562
|
-
// </Line>
|
|
563
|
-
// <Line x="Date" y="Europe(EUR)">
|
|
564
|
-
// <Line.Dots display />
|
|
565
|
-
// </Line>
|
|
566
|
-
// <Line x="Date" y="Australia(AUD)">
|
|
567
|
-
// <Line.Dots display />
|
|
568
|
-
// </Line>
|
|
569
|
-
// </Plot>
|
|
570
|
-
// );
|
|
571
|
-
// };
|
|
572
|
-
// export default () => {
|
|
573
|
-
// return (
|
|
574
|
-
// <div>
|
|
575
|
-
// <Stonks /> <br />
|
|
576
|
-
// <FilmBubbles /> <br />
|
|
577
|
-
// <SurvivedTitanicClassesPie /> <br />
|
|
578
|
-
// <SurvivedTitanicClassesBars /> <br />
|
|
579
|
-
// <HorizaontalBars /> <br />
|
|
580
|
-
// <GroupBars /> <br />
|
|
581
|
-
// <RadialTreeExample /> <br />
|
|
582
|
-
// <ScatterPlotChart /> <br />
|
|
583
|
-
// <StackedBarChart /> <br />
|
|
584
|
-
// <StackedAreaChart /> <br />
|
|
585
|
-
// <VennChart /> <br />
|
|
586
|
-
// <MixedChart /> <br />
|
|
587
|
-
// </div>
|
|
588
|
-
// );
|
|
589
|
-
// };
|
|
590
|
-
//# sourceMappingURL=charts-a11y.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"charts-a11y.js","names":[],"sources":["../../../../src/a11y/datasets/charts-a11y.tsx"],"sourcesContent":["// import React from 'react';\n// import {\n// Line,\n// XAxis,\n// Plot,\n// YAxis,\n// minMax,\n// Tooltip,\n// Bubble,\n// Donut,\n// colors,\n// Bar,\n// HorizontalBar,\n// GroupBar,\n// HoverRect,\n// RadialTree,\n// Plot,\n// ScatterPlot,\n// XAxis,\n// YAxis,\n// minMax,\n// Tooltip,\n// StackBar,\n// Plot,\n// XAxis,\n// YAxis,\n// minMax,\n// colors,\n// StackedArea,\n// HoverLine,\n// Tooltip,\n// Venn,\n// } from '@semcore/d3-chart';\n// import { Flex, Box, Flex, Box } from '@semcore/flex-box';\n// import { Text, Text, Text } from '@semcore/typography';\n// import LikeM from '@semcore/icon/Like/m';\n// import resolveColor from '@semcore/utils/src/color';\n// import { scaleLinear, scaleBand, scaleLinear, scaleLinear } from 'd3-scale';\n// import goldData from '../../../semcore/d3-chart/src/a11y/datasets/gold.json';\n// import imbdmData from '../../../semcore/d3-chart/src/a11y/datasets/imdb.json';\n// import titanicData from '../../../semcore/d3-chart/src/a11y/datasets/titanic.json';\n// const Stonks = () => {\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const data = goldData\n// .map((row) => {\n// const [d, m, y] = row.Date.split('-');\n// return {\n// ...row,\n// Date: new Date(`${m}-${d}-${y}`),\n// };\n// })\n// .filter((_, index) => index % 10 === 0);\n// const xScale = scaleLinear()\n// .range([MARGIN, width - MARGIN])\n// .domain(minMax(data, 'Date'));\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain(minMax(data, 'United States(USD)'));\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// <YAxis.Title>Price</YAxis.Title>\n// </YAxis>\n// <XAxis>\n// <XAxis.Title>Year</XAxis.Title>\n// <XAxis.Ticks ticks={xScale.ticks(6)}>\n// {({ value }) => ({\n// children: formatDate(value, {\n// month: 'short',\n// day: 'numeric',\n// year: 'numeric',\n// }),\n// })}\n// </XAxis.Ticks>\n// </XAxis>\n// <Line x=\"Date\" y=\"United States(USD)\">\n// <Line.Dots display />\n// </Line>\n// <Line x=\"Date\" y=\"Europe(EUR)\">\n// <Line.Dots display />\n// </Line>\n// <Line x=\"Date\" y=\"Australia(AUD)\">\n// <Line.Dots display />\n// </Line>\n// </Plot>\n// );\n// };\n\n// const FilmBubbles = () => {\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const data = imbdmData\n// .map((row) => ({ ...row, label: row.Title }))\n// .filter((_, index) => index % 70 === 0);\n// const xScale = scaleLinear()\n// .range([MARGIN, width - MARGIN])\n// .domain([1950, 2020]);\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain([0, 10]);\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// </YAxis>\n// <XAxis>\n// <XAxis.Ticks />\n// </XAxis>\n// <Bubble x=\"ReleaseYear\" y=\"IMDb-Rating\" value=\"IMDb-Rating\" />\n// </Plot>\n// );\n// };\n\n// const SurvivedTitanicClassesPie = () => {\n// const data: Record<string, number> = {};\n// for (const row of titanicData) {\n// const className = String(row.Pclass);\n// data[className] = data[className] ? data[className] + 1 : 1;\n// }\n// return (\n// <Plot width={300} height={300} data={data}>\n// <Donut innerRadius={100}>\n// <Donut.Pie dataKey=\"1\" name=\"Class 1\" />\n// <Donut.Pie dataKey=\"2\" color={colors['green-02']} name=\"Class 2\" />\n// <Donut.Pie dataKey=\"3\" color={colors['violet-04']} name=\"Class 3\" />\n// <Donut.Label>Survived classes</Donut.Label>\n// </Donut>\n// <Tooltip>\n// {({ dataKey, name }) => {\n// return {\n// children: (\n// <>\n// <Tooltip.Title>{name}</Tooltip.Title>\n// <Flex justifyContent=\"space-between\">\n// <Text bold>{data[dataKey]}</Text>\n// </Flex>\n// </>\n// ),\n// };\n// }}\n// </Tooltip>\n// </Plot>\n// );\n// };\n\n// const SurvivedTitanicClassesBars = () => {\n// const pieData: Record<string, number> = {};\n// for (const row of titanicData) {\n// const className = String(row.Pclass);\n// pieData[className] = pieData[className] ? pieData[className] + 1 : 1;\n// }\n// const data = Object.entries(pieData).map(([className, survived]) => ({\n// className: `Class ${className}`,\n// survived,\n// }));\n\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const xScale = scaleBand()\n// .range([MARGIN, width - MARGIN])\n// .domain(data.map((d) => d.className))\n// .paddingInner(0.4)\n// .paddingOuter(0.2);\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain([0, 260]);\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// </YAxis>\n// <XAxis>\n// <XAxis.Ticks />\n// <XAxis.Title>Survived passengers</XAxis.Title>\n// </XAxis>\n// <Bar x=\"className\" y=\"survived\" />\n// </Plot>\n// );\n// };\n\n// const HorizaontalBars = () => {\n// const data = [...Array(5).keys()].map((d, i) => ({\n// category: `Category ${i}`,\n// bar: i + (Math.random() * 10).toFixed('2'),\n// }));\n\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const xScale = scaleLinear()\n// .range([MARGIN * 2, width - MARGIN * 2])\n// .domain([0, Math.max(...data.map((d) => d.bar))]);\n// const yScale = scaleBand()\n// .range([height - MARGIN, MARGIN])\n// .domain(data.map((d) => d.category))\n// .paddingInner(0.4)\n// .paddingOuter(0.2);\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// </YAxis>\n// <HorizontalBar x=\"bar\" y=\"category\">\n// {({ value, x, y, width, height }) => {\n// return {\n// children: (\n// <text\n// x={x + width + 16}\n// y={y + height / 2}\n// textAnchor=\"start\"\n// alignmentBaseline=\"middle\"\n// fill={resolveColor('gray60')}\n// >\n// $ {value.bar}\n// </text>\n// ),\n// };\n// }}\n// </HorizontalBar>\n// </Plot>\n// );\n// };\n\n// const GroupBars = () => {\n// const data = [...Array(5).keys()].map((d, i) => ({\n// category: `Category ${i}`,\n// bar1: Math.random() * 10,\n// bar2: Math.random() * 10,\n// }));\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const xScale = scaleLinear()\n// .range([MARGIN * 2, width - MARGIN])\n// .domain([0, 10]);\n// const yScale = scaleBand()\n// .range([height - MARGIN, MARGIN])\n// .domain(data.map((d) => d.category))\n// .paddingInner(0.4)\n// .paddingOuter(0.2);\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis hide={false}>\n// <YAxis.Ticks />\n// </YAxis>\n// <XAxis>\n// <XAxis.Ticks />\n// <XAxis.Grid />\n// </XAxis>\n// <Tooltip tag={HoverRect} y=\"category\" wMin={100}>\n// {({ yIndex }) => {\n// return {\n// children: (\n// <>\n// <Tooltip.Title>{data[yIndex].category}</Tooltip.Title>\n// <Flex justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4}>Bar 1</Tooltip.Dot>\n// <Text bold>{data[yIndex].bar1}</Text>\n// </Flex>\n// <Flex mt={2} justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4} color={colors['green-02']}>\n// Bar 2\n// </Tooltip.Dot>\n// <Text bold>{data[yIndex].bar2}</Text>\n// </Flex>\n// </>\n// ),\n// };\n// }}\n// </Tooltip>\n// <GroupBar y=\"category\">\n// <GroupBar.HorizontalBar x=\"bar1\" />\n// <GroupBar.HorizontalBar x=\"bar2\" color={colors['green-02']} />\n// </GroupBar>\n// </Plot>\n// );\n// };\n\n// const RadialTreeExample = () => {\n// const width = 500;\n// const height = 500;\n// const data = Array(12)\n// .fill({})\n// .map((_, i) => ({\n// label: `Sheep ${i + 1}`,\n// icon: LikeM,\n// }));\n// return (\n// <Plot data={data} scale={[scaleLinear(), scaleLinear()]} width={width} height={height}>\n// <RadialTree color=\"#AB6CFE\">\n// <RadialTree.Radian>\n// <RadialTree.Radian.Label />\n// <RadialTree.Radian.Line />\n// <RadialTree.Radian.Cap />\n// <RadialTree.Radian.Icon />\n// </RadialTree.Radian>\n// <RadialTree.Title>Sleeping</RadialTree.Title>\n// </RadialTree>\n// </Plot>\n// );\n// };\n\n// const ScatterPlotChart = () => {\n// const data = Array(20)\n// .fill({})\n// .map((d, i) => ({\n// x: i,\n// y: Math.random() * 10,\n// }));\n\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n\n// const xScale = scaleLinear()\n// .range([MARGIN, width - MARGIN])\n// .domain(minMax(data, 'x'));\n\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain([0, 10]);\n\n// return (\n// <Plot scale={[xScale, yScale]} width={width} height={height} data={data}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// </YAxis>\n// <XAxis>\n// <XAxis.Ticks />\n// </XAxis>\n// <ScatterPlot x=\"x\" y=\"y\" />\n// <Tooltip>\n// {({ xIndex }) => {\n// return {\n// children: (\n// <>\n// <Tooltip.Title>Data</Tooltip.Title>\n// <Text tag=\"div\">X axis {data[xIndex].x}</Text>\n// <Text tag=\"div\">Y axis {data[xIndex].y}</Text>\n// </>\n// ),\n// };\n// }}\n// </Tooltip>\n// </Plot>\n// );\n// };\n\n// const StackedBarChart = () => {\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const data = [...Array(5).keys()].map((d, i) => ({\n// category: `Category ${i}`,\n// stack1: Math.random() * 10,\n// stack2: Math.random() * 10,\n// }));\n// const xScale = scaleBand()\n// .range([MARGIN, width - MARGIN])\n// .domain(data.map((d) => d.category))\n// .paddingInner(0.4)\n// .paddingOuter(0.2);\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain([0, 20]);\n\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// </YAxis>\n// <XAxis>\n// <XAxis.Ticks />\n// </XAxis>\n// <Tooltip tag={HoverRect} x=\"category\" wMin={100}>\n// {({ xIndex }) => {\n// return {\n// children: (\n// <>\n// <Tooltip.Title>{data[xIndex].category}</Tooltip.Title>\n// <Flex justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4}>Stack 1</Tooltip.Dot>\n// <Text bold>{data[xIndex].stack1}</Text>\n// </Flex>\n// <Flex mt={2} justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4} color={colors['blue-02']}>\n// Stack 2\n// </Tooltip.Dot>\n// <Text bold>{data[xIndex].stack2}</Text>\n// </Flex>\n// <Flex mt={2} justifyContent=\"space-between\">\n// <Box mr={4}>Total</Box>\n// <Text bold>{data[xIndex].stack1 + data[xIndex].stack2}</Text>\n// </Flex>\n// </>\n// ),\n// };\n// }}\n// </Tooltip>\n// <StackBar x=\"category\">\n// <StackBar.Bar y=\"stack1\" />\n// <StackBar.Bar y=\"stack2\" color={colors['blue-02']} />\n// </StackBar>\n// </Plot>\n// );\n// };\n\n// import { curveCardinal } from 'd3-shape';\n\n// function formatDate(value, options) {\n// return new Intl.DateTimeFormat('en', options).format(value);\n// }\n\n// const StackedAreaChart = () => {\n// const date = new Date();\n// const data = [...Array(5).keys()].map((d, i) => ({\n// time: new Date(date.setDate(date.getDate() + 5)),\n// stack1: Math.random() * 5,\n// stack2: Math.random() * 5,\n// stack3: Math.random() * 5,\n// }));\n\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n\n// const xScale = scaleLinear()\n// .range([MARGIN, width - MARGIN])\n// .domain(minMax(data, 'time'));\n\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain([0, 15]);\n\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// </YAxis>\n// <XAxis>\n// <XAxis.Ticks ticks={data.map((d) => +d.time)}>\n// {({ value }) => ({\n// children: formatDate(value, {\n// month: 'short',\n// day: 'numeric',\n// }),\n// })}\n// </XAxis.Ticks>\n// </XAxis>\n// <Tooltip tag={HoverLine} x=\"time\" wMin={100}>\n// {({ xIndex }) => {\n// return {\n// children: (\n// <>\n// <Tooltip.Title>\n// {formatDate(data[xIndex].time, {\n// year: 'numeric',\n// month: 'long',\n// day: 'numeric',\n// })}\n// </Tooltip.Title>\n// <Flex justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4}>Stack 1</Tooltip.Dot>\n// <Text bold>{data[xIndex].stack1}</Text>\n// </Flex>\n// <Flex mt={2} justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4} color={colors['green-02']}>\n// Stack 2\n// </Tooltip.Dot>\n// <Text bold>{data[xIndex].stack2}</Text>\n// </Flex>\n// <Flex mt={2} justifyContent=\"space-between\">\n// <Tooltip.Dot mr={4} color={colors['orange-04']}>\n// Stack 3\n// </Tooltip.Dot>\n// <Text bold>{data[xIndex].stack3}</Text>\n// </Flex>\n// <Flex mt={2} justifyContent=\"space-between\">\n// <Box mr={4}>Total</Box>\n// <Text bold>\n// {data[xIndex].stack1 + data[xIndex].stack2 + data[xIndex].stack3}\n// </Text>\n// </Flex>\n// </>\n// ),\n// };\n// }}\n// </Tooltip>\n// <StackedArea x=\"time\">\n// <StackedArea.Area y=\"stack1\" curve={curveCardinal}>\n// <StackedArea.Area.Dots />\n// </StackedArea.Area>\n// <StackedArea.Area y=\"stack2\" fill=\"#59DDAA50\" color=\"#59DDAA\" curve={curveCardinal}>\n// <StackedArea.Area.Dots />\n// </StackedArea.Area>\n// <StackedArea.Area y=\"stack3\" fill=\"#FF622D50\" color=\"#FF622D\" curve={curveCardinal}>\n// <StackedArea.Area.Dots />\n// </StackedArea.Area>\n// </StackedArea>\n// </Plot>\n// );\n// };\n\n// const VennChart = () => {\n// const data = {\n// G: 200,\n// F: 200,\n// C: 500,\n// U: 1,\n// 'G/F': 100,\n// 'G/C': 100,\n// 'F/C': 100,\n// 'G/F/C': 100,\n// };\n\n// return (\n// <Plot height={300} width={400} data={data}>\n// <Venn>\n// <Venn.Circle dataKey=\"G\" name=\"Good\" />\n// <Venn.Circle dataKey=\"F\" name=\"Fast\" color={colors['blue-03']} />\n// <Venn.Circle dataKey=\"C\" name=\"Cheap\" color={colors['orange-04']} />\n// <Venn.Circle dataKey=\"U\" name=\"Unknown\" color={colors['pink-03']} />\n// <Venn.Intersection dataKey=\"G/F\" name=\"Good & Fast\" />\n// <Venn.Intersection dataKey=\"G/C\" name=\"Good & Cheap\" />\n// <Venn.Intersection dataKey=\"F/C\" name=\"Fast & Cheap\" />\n// <Venn.Intersection dataKey=\"G/F/C\" name=\"Good & Fast & Cheap\" />\n// </Venn>\n// <Tooltip>\n// {({ name, dataKey }) => {\n// return {\n// children: (\n// <>\n// <Tooltip.Title>{name}</Tooltip.Title>\n// <Text bold>{data[dataKey]}</Text>\n// </>\n// ),\n// };\n// }}\n// </Tooltip>\n// </Plot>\n// );\n// };\n\n// const MixedChart = () => {\n// const MARGIN = 40;\n// const width = 500;\n// const height = 300;\n// const data = goldData\n// .map((row) => {\n// const [d, m, y] = row.Date.split('-');\n// return {\n// ...row,\n// Date: new Date(`${m}-${d}-${y}`),\n// };\n// })\n// .filter((_, index) => index % 10 === 0);\n// const xScale = scaleLinear()\n// .range([MARGIN, width - MARGIN])\n// .domain(minMax(data, 'Date'));\n// const yScale = scaleLinear()\n// .range([height - MARGIN, MARGIN])\n// .domain(minMax(data, 'United States(USD)'));\n// return (\n// <Plot data={data} scale={[xScale, yScale]} width={width} height={height}>\n// <YAxis>\n// <YAxis.Ticks />\n// <YAxis.Grid />\n// <YAxis.Title>Price</YAxis.Title>\n// </YAxis>\n// <XAxis>\n// <XAxis.Title>Year</XAxis.Title>\n// <XAxis.Ticks />\n// </XAxis>\n// <Line x=\"Date\" y=\"United States(USD)\">\n// <Line.Dots display />\n// </Line>\n// <Line x=\"Date\" y=\"Europe(EUR)\">\n// <Line.Dots display />\n// </Line>\n// <Line x=\"Date\" y=\"Australia(AUD)\">\n// <Line.Dots display />\n// </Line>\n// </Plot>\n// );\n// };\n\n// export default () => {\n// return (\n// <div>\n// <Stonks /> <br />\n// <FilmBubbles /> <br />\n// <SurvivedTitanicClassesPie /> <br />\n// <SurvivedTitanicClassesBars /> <br />\n// <HorizaontalBars /> <br />\n// <GroupBars /> <br />\n// <RadialTreeExample /> <br />\n// <ScatterPlotChart /> <br />\n// <StackedBarChart /> <br />\n// <StackedAreaChart /> <br />\n// <VennChart /> <br />\n// <MixedChart /> <br />\n// </div>\n// );\n// };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|