@redsift/charts 9.2.3 → 9.2.4
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/index.js → index.js} +2 -1
- package/index.js.map +1 -0
- package/package.json +3 -2
- package/coverage/clover.xml +0 -1096
- package/coverage/coverage-final.json +0 -60
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/components/Arc/Arc.tsx.html +0 -304
- package/coverage/lcov-report/components/Arc/index.html +0 -146
- package/coverage/lcov-report/components/Arc/index.ts.html +0 -94
- package/coverage/lcov-report/components/Arc/styles.ts.html +0 -208
- package/coverage/lcov-report/components/Arcs/Arcs.tsx.html +0 -409
- package/coverage/lcov-report/components/Arcs/index.html +0 -146
- package/coverage/lcov-report/components/Arcs/index.ts.html +0 -94
- package/coverage/lcov-report/components/Arcs/styles.ts.html +0 -106
- package/coverage/lcov-report/components/Axis/Axis.tsx.html +0 -754
- package/coverage/lcov-report/components/Axis/computeTicks.ts.html +0 -481
- package/coverage/lcov-report/components/Axis/index.html +0 -176
- package/coverage/lcov-report/components/Axis/index.ts.html +0 -94
- package/coverage/lcov-report/components/Axis/styles.ts.html +0 -148
- package/coverage/lcov-report/components/Axis/types.ts.html +0 -253
- package/coverage/lcov-report/components/Bar/Bar.tsx.html +0 -421
- package/coverage/lcov-report/components/Bar/index.html +0 -161
- package/coverage/lcov-report/components/Bar/index.ts.html +0 -94
- package/coverage/lcov-report/components/Bar/styles.ts.html +0 -247
- package/coverage/lcov-report/components/Bar/types.ts.html +0 -178
- package/coverage/lcov-report/components/BarChart/BarChart.tsx.html +0 -352
- package/coverage/lcov-report/components/BarChart/EmptyBarChart.tsx.html +0 -259
- package/coverage/lcov-report/components/BarChart/LoadingBarChart.tsx.html +0 -145
- package/coverage/lcov-report/components/BarChart/RenderedBarChart.tsx.html +0 -430
- package/coverage/lcov-report/components/BarChart/index.html +0 -206
- package/coverage/lcov-report/components/BarChart/index.ts.html +0 -94
- package/coverage/lcov-report/components/BarChart/styles.ts.html +0 -190
- package/coverage/lcov-report/components/BarChart/utils.ts.html +0 -145
- package/coverage/lcov-report/components/BottomAxis/BottomAxis.tsx.html +0 -247
- package/coverage/lcov-report/components/BottomAxis/index.html +0 -146
- package/coverage/lcov-report/components/BottomAxis/index.ts.html +0 -94
- package/coverage/lcov-report/components/BottomAxis/styles.ts.html +0 -139
- package/coverage/lcov-report/components/ChartContainer/ChartContainer.tsx.html +0 -361
- package/coverage/lcov-report/components/ChartContainer/index.html +0 -146
- package/coverage/lcov-report/components/ChartContainer/index.ts.html +0 -94
- package/coverage/lcov-report/components/ChartContainer/intl/index.html +0 -116
- package/coverage/lcov-report/components/ChartContainer/intl/index.ts.html +0 -106
- package/coverage/lcov-report/components/ChartContainer/styles.ts.html +0 -208
- package/coverage/lcov-report/components/DataPoint/DataPoint.tsx.html +0 -391
- package/coverage/lcov-report/components/DataPoint/index.html +0 -146
- package/coverage/lcov-report/components/DataPoint/index.ts.html +0 -94
- package/coverage/lcov-report/components/DataPoint/styles.ts.html +0 -109
- package/coverage/lcov-report/components/Dot/Dot.tsx.html +0 -232
- package/coverage/lcov-report/components/Dot/index.html +0 -146
- package/coverage/lcov-report/components/Dot/index.ts.html +0 -94
- package/coverage/lcov-report/components/Dot/styles.ts.html +0 -184
- package/coverage/lcov-report/components/HorizontalBar/HorizontalBar.tsx.html +0 -541
- package/coverage/lcov-report/components/HorizontalBar/index.html +0 -161
- package/coverage/lcov-report/components/HorizontalBar/index.ts.html +0 -94
- package/coverage/lcov-report/components/HorizontalBar/styles.ts.html +0 -187
- package/coverage/lcov-report/components/HorizontalBar/types.ts.html +0 -301
- package/coverage/lcov-report/components/HorizontalBarChart/HorizontalBarChart.tsx.html +0 -691
- package/coverage/lcov-report/components/HorizontalBarChart/index.html +0 -146
- package/coverage/lcov-report/components/HorizontalBarChart/index.ts.html +0 -94
- package/coverage/lcov-report/components/HorizontalBarChart/styles.ts.html +0 -196
- package/coverage/lcov-report/components/HorizontalBarChart/types.ts.html +0 -301
- package/coverage/lcov-report/components/Legend/Legend.tsx.html +0 -268
- package/coverage/lcov-report/components/Legend/index.html +0 -146
- package/coverage/lcov-report/components/Legend/index.ts.html +0 -94
- package/coverage/lcov-report/components/Legend/styles.ts.html +0 -130
- package/coverage/lcov-report/components/LegendItem/LegendItem.tsx.html +0 -325
- package/coverage/lcov-report/components/LegendItem/index.html +0 -146
- package/coverage/lcov-report/components/LegendItem/index.ts.html +0 -94
- package/coverage/lcov-report/components/LegendItem/styles.ts.html +0 -205
- package/coverage/lcov-report/components/PieChart/EmptyPieChart.tsx.html +0 -343
- package/coverage/lcov-report/components/PieChart/LoadingPieChart.tsx.html +0 -145
- package/coverage/lcov-report/components/PieChart/PieChart.tsx.html +0 -385
- package/coverage/lcov-report/components/PieChart/RenderedPieChart.tsx.html +0 -607
- package/coverage/lcov-report/components/PieChart/index.html +0 -221
- package/coverage/lcov-report/components/PieChart/index.ts.html +0 -94
- package/coverage/lcov-report/components/PieChart/styles.ts.html +0 -370
- package/coverage/lcov-report/components/PieChart/types.ts.html +0 -367
- package/coverage/lcov-report/components/PieChart/utils.ts.html +0 -199
- package/coverage/lcov-report/components/ScatterPlot/EmptyScatterPlot.tsx.html +0 -295
- package/coverage/lcov-report/components/ScatterPlot/LoadingScatterPlot.tsx.html +0 -145
- package/coverage/lcov-report/components/ScatterPlot/RenderedScatterPlot.tsx.html +0 -1048
- package/coverage/lcov-report/components/ScatterPlot/ScatterPlot.tsx.html +0 -367
- package/coverage/lcov-report/components/ScatterPlot/index.html +0 -221
- package/coverage/lcov-report/components/ScatterPlot/index.ts.html +0 -94
- package/coverage/lcov-report/components/ScatterPlot/styles.ts.html +0 -190
- package/coverage/lcov-report/components/ScatterPlot/types.ts.html +0 -394
- package/coverage/lcov-report/components/ScatterPlot/utils.ts.html +0 -388
- package/coverage/lcov-report/core/Arc/Arc.tsx.html +0 -304
- package/coverage/lcov-report/core/Arc/index.html +0 -146
- package/coverage/lcov-report/core/Arc/index.ts.html +0 -94
- package/coverage/lcov-report/core/Arc/styles.ts.html +0 -202
- package/coverage/lcov-report/core/Arcs/Arcs.tsx.html +0 -421
- package/coverage/lcov-report/core/Arcs/index.html +0 -146
- package/coverage/lcov-report/core/Arcs/index.ts.html +0 -94
- package/coverage/lcov-report/core/Arcs/styles.ts.html +0 -106
- package/coverage/lcov-report/core/Axis/Axis.tsx.html +0 -754
- package/coverage/lcov-report/core/Axis/computeTicks.ts.html +0 -481
- package/coverage/lcov-report/core/Axis/index.html +0 -176
- package/coverage/lcov-report/core/Axis/index.ts.html +0 -94
- package/coverage/lcov-report/core/Axis/styles.ts.html +0 -145
- package/coverage/lcov-report/core/Axis/types.ts.html +0 -253
- package/coverage/lcov-report/core/Bar/Bar.tsx.html +0 -421
- package/coverage/lcov-report/core/Bar/index.html +0 -161
- package/coverage/lcov-report/core/Bar/index.ts.html +0 -94
- package/coverage/lcov-report/core/Bar/styles.ts.html +0 -190
- package/coverage/lcov-report/core/Bar/types.ts.html +0 -178
- package/coverage/lcov-report/core/BottomAxis/BottomAxis.tsx.html +0 -277
- package/coverage/lcov-report/core/BottomAxis/index.html +0 -146
- package/coverage/lcov-report/core/BottomAxis/index.ts.html +0 -94
- package/coverage/lcov-report/core/BottomAxis/styles.ts.html +0 -139
- package/coverage/lcov-report/core/ChartConfig/ChartConfig.ts.html +0 -97
- package/coverage/lcov-report/core/ChartConfig/index.html +0 -131
- package/coverage/lcov-report/core/ChartConfig/index.ts.html +0 -88
- package/coverage/lcov-report/core/ChartContainer/ChartContainer.tsx.html +0 -421
- package/coverage/lcov-report/core/ChartContainer/index.html +0 -146
- package/coverage/lcov-report/core/ChartContainer/index.ts.html +0 -94
- package/coverage/lcov-report/core/ChartContainer/intl/index.html +0 -116
- package/coverage/lcov-report/core/ChartContainer/intl/index.ts.html +0 -106
- package/coverage/lcov-report/core/ChartContainer/styles.ts.html +0 -205
- package/coverage/lcov-report/core/DataPoint/DataPoint.tsx.html +0 -442
- package/coverage/lcov-report/core/DataPoint/index.html +0 -146
- package/coverage/lcov-report/core/DataPoint/index.ts.html +0 -94
- package/coverage/lcov-report/core/DataPoint/styles.ts.html +0 -109
- package/coverage/lcov-report/core/Dot/Dot.tsx.html +0 -232
- package/coverage/lcov-report/core/Dot/index.html +0 -146
- package/coverage/lcov-report/core/Dot/index.ts.html +0 -94
- package/coverage/lcov-report/core/Dot/styles.ts.html +0 -184
- package/coverage/lcov-report/core/Legend/Legend.tsx.html +0 -277
- package/coverage/lcov-report/core/Legend/index.html +0 -146
- package/coverage/lcov-report/core/Legend/index.ts.html +0 -94
- package/coverage/lcov-report/core/Legend/styles.ts.html +0 -172
- package/coverage/lcov-report/core/Point/Point.tsx.html +0 -484
- package/coverage/lcov-report/core/Point/index.html +0 -146
- package/coverage/lcov-report/core/Point/index.ts.html +0 -94
- package/coverage/lcov-report/core/Point/styles.ts.html +0 -169
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/gallery/HorizontalBarChart/HorizontalBarChart.tsx.html +0 -706
- package/coverage/lcov-report/gallery/HorizontalBarChart/index.html +0 -161
- package/coverage/lcov-report/gallery/HorizontalBarChart/index.ts.html +0 -94
- package/coverage/lcov-report/gallery/HorizontalBarChart/styles.ts.html +0 -316
- package/coverage/lcov-report/gallery/HorizontalBarChart/types.ts.html +0 -310
- package/coverage/lcov-report/gallery/PieChart/PieChart.tsx.html +0 -1252
- package/coverage/lcov-report/gallery/PieChart/index.html +0 -161
- package/coverage/lcov-report/gallery/PieChart/index.ts.html +0 -94
- package/coverage/lcov-report/gallery/PieChart/styles.ts.html +0 -517
- package/coverage/lcov-report/gallery/PieChart/types.ts.html +0 -388
- package/coverage/lcov-report/gallery/ScatterPlot/index.html +0 -146
- package/coverage/lcov-report/gallery/ScatterPlot/index.ts.html +0 -94
- package/coverage/lcov-report/gallery/ScatterPlot/styles.ts.html +0 -343
- package/coverage/lcov-report/gallery/ScatterPlot/types.ts.html +0 -433
- package/coverage/lcov-report/hooks/index.html +0 -176
- package/coverage/lcov-report/hooks/index.ts.html +0 -97
- package/coverage/lcov-report/hooks/useBrush.tsx.html +0 -430
- package/coverage/lcov-report/hooks/useColor.tsx.html +0 -163
- package/coverage/lcov-report/hooks/useFormatCategoricalData.tsx.html +0 -289
- package/coverage/lcov-report/hooks/useIsEmpty.tsx.html +0 -118
- package/coverage/lcov-report/hooks/useZoom.tsx.html +0 -235
- package/coverage/lcov-report/index.html +0 -311
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -2345
- package/coverage/storybook/coverage-storybook.json +0 -79382
- package/dist/index.js.map +0 -1
- package/dist/package.json +0 -98
- package/index.ts +0 -1
- package/jest.config.js +0 -3
- package/rollup.config.js +0 -13
- package/src/components/Arc/Arc.test.tsx +0 -80
- package/src/components/Arc/Arc.tsx +0 -73
- package/src/components/Arc/index.ts +0 -3
- package/src/components/Arc/styles.ts +0 -41
- package/src/components/Arc/types.ts +0 -18
- package/src/components/Arcs/Arcs.stories.tsx +0 -177
- package/src/components/Arcs/Arcs.tsx +0 -108
- package/src/components/Arcs/index.ts +0 -3
- package/src/components/Arcs/styles.ts +0 -7
- package/src/components/Arcs/types.ts +0 -26
- package/src/components/Axis/Axis.stories.tsx +0 -297
- package/src/components/Axis/Axis.tsx +0 -223
- package/src/components/Axis/computeTicks.ts +0 -132
- package/src/components/Axis/index.ts +0 -3
- package/src/components/Axis/styles.ts +0 -21
- package/src/components/Axis/types.ts +0 -56
- package/src/components/Bar/Bar.stories.tsx +0 -152
- package/src/components/Bar/Bar.test.tsx +0 -156
- package/src/components/Bar/Bar.tsx +0 -112
- package/src/components/Bar/index.ts +0 -3
- package/src/components/Bar/styles.ts +0 -54
- package/src/components/Bar/types.ts +0 -31
- package/src/components/BarChart/BarChart.stories.tsx +0 -74
- package/src/components/BarChart/BarChart.test.tsx +0 -178
- package/src/components/BarChart/BarChart.tsx +0 -89
- package/src/components/BarChart/EmptyBarChart.tsx +0 -58
- package/src/components/BarChart/LoadingBarChart.tsx +0 -20
- package/src/components/BarChart/RenderedBarChart.tsx +0 -115
- package/src/components/BarChart/__snapshots__/BarChart.test.tsx.snap +0 -7028
- package/src/components/BarChart/index.ts +0 -3
- package/src/components/BarChart/styles.ts +0 -35
- package/src/components/BarChart/types.ts +0 -58
- package/src/components/BarChart/utils.ts +0 -20
- package/src/components/ChartContainer/ChartContainer.stories.tsx +0 -81
- package/src/components/ChartContainer/ChartContainer.test.tsx +0 -71
- package/src/components/ChartContainer/ChartContainer.tsx +0 -92
- package/src/components/ChartContainer/index.ts +0 -3
- package/src/components/ChartContainer/intl/en-US.json +0 -3
- package/src/components/ChartContainer/intl/fr-FR.json +0 -3
- package/src/components/ChartContainer/intl/index.ts +0 -7
- package/src/components/ChartContainer/styles.ts +0 -41
- package/src/components/ChartContainer/types.ts +0 -26
- package/src/components/DataPoint/DataPoint.tsx +0 -102
- package/src/components/DataPoint/index.ts +0 -3
- package/src/components/DataPoint/styles.ts +0 -8
- package/src/components/DataPoint/types.ts +0 -33
- package/src/components/Dot/Dot.stories.tsx +0 -157
- package/src/components/Dot/Dot.test.tsx +0 -136
- package/src/components/Dot/Dot.tsx +0 -49
- package/src/components/Dot/index.ts +0 -3
- package/src/components/Dot/styles.ts +0 -33
- package/src/components/Dot/types.ts +0 -16
- package/src/components/Legend/Legend.stories.tsx +0 -108
- package/src/components/Legend/Legend.tsx +0 -61
- package/src/components/Legend/index.ts +0 -3
- package/src/components/Legend/styles.ts +0 -15
- package/src/components/Legend/types.ts +0 -27
- package/src/components/LegendItem/LegendItem.test.tsx +0 -69
- package/src/components/LegendItem/LegendItem.tsx +0 -80
- package/src/components/LegendItem/index.ts +0 -3
- package/src/components/LegendItem/styles.ts +0 -40
- package/src/components/LegendItem/types.ts +0 -30
- package/src/components/PieChart/EmptyPieChart.tsx +0 -86
- package/src/components/PieChart/LoadingPieChart.tsx +0 -20
- package/src/components/PieChart/PieChart.stories.tsx +0 -85
- package/src/components/PieChart/PieChart.test.tsx +0 -183
- package/src/components/PieChart/PieChart.tsx +0 -100
- package/src/components/PieChart/RenderedPieChart.tsx +0 -174
- package/src/components/PieChart/__snapshots__/PieChart.test.tsx.snap +0 -21020
- package/src/components/PieChart/index.ts +0 -3
- package/src/components/PieChart/styles.ts +0 -95
- package/src/components/PieChart/types.ts +0 -94
- package/src/components/PieChart/utils.ts +0 -38
- package/src/components/ScatterPlot/EmptyScatterPlot.tsx +0 -70
- package/src/components/ScatterPlot/LoadingScatterPlot.tsx +0 -20
- package/src/components/ScatterPlot/RenderedScatterPlot.tsx +0 -321
- package/src/components/ScatterPlot/ScatterPlot.stories.tsx +0 -101
- package/src/components/ScatterPlot/ScatterPlot.test.tsx +0 -61
- package/src/components/ScatterPlot/ScatterPlot.tsx +0 -94
- package/src/components/ScatterPlot/__snapshots__/ScatterPlot.test.tsx.snap +0 -91712
- package/src/components/ScatterPlot/index.ts +0 -3
- package/src/components/ScatterPlot/styles.ts +0 -35
- package/src/components/ScatterPlot/types.ts +0 -103
- package/src/components/ScatterPlot/utils.ts +0 -101
- package/src/config.ts +0 -10
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useBrush.tsx +0 -115
- package/src/hooks/useColor.tsx +0 -26
- package/src/hooks/useFormatCategoricalData.tsx +0 -68
- package/src/hooks/useZoom.tsx +0 -50
- package/src/index.ts +0 -15
- package/src/scheme.ts +0 -213
- package/src/types/data.ts +0 -52
- package/src/types/index.ts +0 -5
- package/src/types/legend.ts +0 -19
- package/src/types/scale.ts +0 -79
- package/src/types/size.ts +0 -17
- package/src/types/theme.ts +0 -27
- package/tsconfig.json +0 -3
- /package/{dist/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import mock from '../../../../../.storybook/static/mocks/bakery-trimmed.json';
|
|
4
|
-
|
|
5
|
-
import { PresentationColorPalette } from '@redsift/design-system';
|
|
6
|
-
import { ScatterPlot } from '.';
|
|
7
|
-
import { ScatterPlotLabelVariant, ScatterPlotVariant } from './types';
|
|
8
|
-
import { ChartSize, ColorTheme, CoordinatesCategoryData, CoordinatesCategoryDim, TooltipVariant } from '../../types';
|
|
9
|
-
import { AxisVariant } from '../Axis';
|
|
10
|
-
|
|
11
|
-
const themes = {
|
|
12
|
-
...ColorTheme,
|
|
13
|
-
'success-warning-danger': {
|
|
14
|
-
success: 'Bread',
|
|
15
|
-
warning: 'Tea',
|
|
16
|
-
danger: 'Coffee',
|
|
17
|
-
},
|
|
18
|
-
'success-warning-danger-neutral': {
|
|
19
|
-
success: 'Bread',
|
|
20
|
-
warning: 'Tea',
|
|
21
|
-
danger: 'Coffee',
|
|
22
|
-
neutral: 'Pastry',
|
|
23
|
-
},
|
|
24
|
-
custom: {
|
|
25
|
-
Coffee: PresentationColorPalette.purple,
|
|
26
|
-
Bread: PresentationColorPalette.pink,
|
|
27
|
-
Tea: PresentationColorPalette.aqua,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const meta: Meta<typeof ScatterPlot> = {
|
|
32
|
-
title: 'Charts/ScatterPlot',
|
|
33
|
-
component: ScatterPlot as any,
|
|
34
|
-
argTypes: {
|
|
35
|
-
variant: {
|
|
36
|
-
options: Object.values(ScatterPlotVariant),
|
|
37
|
-
control: { type: 'select' },
|
|
38
|
-
},
|
|
39
|
-
labelVariant: {
|
|
40
|
-
options: Object.values(ScatterPlotLabelVariant),
|
|
41
|
-
control: { type: 'select' },
|
|
42
|
-
},
|
|
43
|
-
tooltipVariant: {
|
|
44
|
-
options: Object.values(TooltipVariant),
|
|
45
|
-
control: { type: 'select' },
|
|
46
|
-
},
|
|
47
|
-
size: {
|
|
48
|
-
options: Object.values(ChartSize),
|
|
49
|
-
control: { type: 'select' },
|
|
50
|
-
},
|
|
51
|
-
theme: {
|
|
52
|
-
options: Object.keys(themes),
|
|
53
|
-
mapping: themes,
|
|
54
|
-
control: {
|
|
55
|
-
type: 'select',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
xAxisVariant: {
|
|
59
|
-
options: Object.values(AxisVariant),
|
|
60
|
-
control: { type: 'select' },
|
|
61
|
-
},
|
|
62
|
-
yAxisVariant: {
|
|
63
|
-
options: Object.values(AxisVariant),
|
|
64
|
-
control: { type: 'select' },
|
|
65
|
-
},
|
|
66
|
-
xAxisPlacement: {
|
|
67
|
-
options: ['bottom', 'top', 'both'],
|
|
68
|
-
control: { type: 'select' },
|
|
69
|
-
},
|
|
70
|
-
yAxisPlacement: {
|
|
71
|
-
options: ['left', 'right', 'both'],
|
|
72
|
-
control: { type: 'select' },
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
export default meta;
|
|
77
|
-
type Story = StoryObj<typeof ScatterPlot>;
|
|
78
|
-
|
|
79
|
-
const data: CoordinatesCategoryData = mock.map((d) => ({
|
|
80
|
-
key: [+d.x!, +d.y!, d.Items] as CoordinatesCategoryDim,
|
|
81
|
-
value: 1,
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
export const Controls: Story = {
|
|
85
|
-
args: {
|
|
86
|
-
title: 'Scatter Plot',
|
|
87
|
-
variant: 'gridded',
|
|
88
|
-
labelVariant: 'externalLabelValue',
|
|
89
|
-
tooltipVariant: 'value',
|
|
90
|
-
size: 'large',
|
|
91
|
-
theme: 'default',
|
|
92
|
-
isBrushable: true,
|
|
93
|
-
xAxisVariant: 'default',
|
|
94
|
-
yAxisVariant: 'default',
|
|
95
|
-
xAxisPlacement: 'bottom',
|
|
96
|
-
yAxisPlacement: 'left',
|
|
97
|
-
caption:
|
|
98
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sit amet odio eu ex ornare sagittis egestas non massa.',
|
|
99
|
-
data: data,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { composeStory } from '@storybook/react';
|
|
5
|
-
import Meta, { Controls } from './ScatterPlot.stories';
|
|
6
|
-
|
|
7
|
-
import { ScatterPlotLabelVariant, ScatterPlotVariant } from './types';
|
|
8
|
-
import { ChartSize, ChartTheme, ColorTheme, TooltipVariant } from '../../types';
|
|
9
|
-
import { PresentationColorPalette } from '@redsift/design-system';
|
|
10
|
-
|
|
11
|
-
const themes = {
|
|
12
|
-
...ColorTheme,
|
|
13
|
-
'success-warning-danger': {
|
|
14
|
-
success: 'Bread',
|
|
15
|
-
warning: 'Tea',
|
|
16
|
-
danger: 'Coffee',
|
|
17
|
-
},
|
|
18
|
-
'success-warning-danger-neutral': {
|
|
19
|
-
success: 'Bread',
|
|
20
|
-
warning: 'Tea',
|
|
21
|
-
danger: 'Coffee',
|
|
22
|
-
neutral: 'Pastry',
|
|
23
|
-
},
|
|
24
|
-
custom: {
|
|
25
|
-
Coffee: PresentationColorPalette.purple,
|
|
26
|
-
Bread: PresentationColorPalette.pink,
|
|
27
|
-
Tea: PresentationColorPalette.aqua,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
describe('ScatterPlot', () => {
|
|
32
|
-
it('should match snapshot', () => {
|
|
33
|
-
const ComposedStory = composeStory(Controls, Meta);
|
|
34
|
-
const tree = render(
|
|
35
|
-
<>
|
|
36
|
-
{Object.values(ScatterPlotVariant).map((variant, i) =>
|
|
37
|
-
Object.values(ChartSize).map((size, j) =>
|
|
38
|
-
Object.values(ScatterPlotLabelVariant).map((labelVariant, k) => (
|
|
39
|
-
<ComposedStory
|
|
40
|
-
key={`${variant}-${size}-${labelVariant}-${Object.values(TooltipVariant)[k]}`}
|
|
41
|
-
variant={variant}
|
|
42
|
-
labelVariant={labelVariant}
|
|
43
|
-
tooltipVariant={Object.values(TooltipVariant)[k]}
|
|
44
|
-
size={size}
|
|
45
|
-
theme={
|
|
46
|
-
Object.keys(themes)[
|
|
47
|
-
(i * Object.values(ChartSize).length + j * Object.values(ScatterPlotLabelVariant).length + k) %
|
|
48
|
-
Object.keys(themes).length
|
|
49
|
-
] as ChartTheme
|
|
50
|
-
}
|
|
51
|
-
xAxisVariant="default"
|
|
52
|
-
yAxisVariant="default"
|
|
53
|
-
/>
|
|
54
|
-
))
|
|
55
|
-
)
|
|
56
|
-
)}
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
expect(tree).toMatchSnapshot();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
|
|
4
|
-
import { Comp, useId } from '@redsift/design-system';
|
|
5
|
-
|
|
6
|
-
import { ChartSize, ColorTheme, TooltipVariant } from '../../types';
|
|
7
|
-
import { ScatterPlotLabelVariant, ScatterPlotProps, ScatterPlotVariant } from './types';
|
|
8
|
-
import { LoadingScatterPlot } from './LoadingScatterPlot';
|
|
9
|
-
import { EmptyScatterPlot } from './EmptyScatterPlot';
|
|
10
|
-
import { RenderedScatterPlot } from './RenderedScatterPlot';
|
|
11
|
-
import { AxisVariant } from '../Axis';
|
|
12
|
-
|
|
13
|
-
const COMPONENT_NAME = 'ScatterPlot';
|
|
14
|
-
const CLASSNAME = 'redsift-scatterplot';
|
|
15
|
-
const DEFAULT_PROPS: Partial<ScatterPlotProps> = {
|
|
16
|
-
hideControlKeyPanel: false,
|
|
17
|
-
labelVariant: ScatterPlotLabelVariant.externalLabel,
|
|
18
|
-
localeText: {
|
|
19
|
-
emptyChartText: 'No Data',
|
|
20
|
-
},
|
|
21
|
-
size: ChartSize.medium,
|
|
22
|
-
theme: ColorTheme.default,
|
|
23
|
-
tooltipVariant: TooltipVariant.none,
|
|
24
|
-
variant: ScatterPlotVariant.default,
|
|
25
|
-
xAxisVariant: AxisVariant.default,
|
|
26
|
-
xAxisPlacement: 'bottom',
|
|
27
|
-
yAxisVariant: AxisVariant.default,
|
|
28
|
-
yAxisPlacement: 'left',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const ScatterPlot: Comp<ScatterPlotProps, HTMLDivElement> = forwardRef((props, ref) => {
|
|
32
|
-
const {
|
|
33
|
-
className,
|
|
34
|
-
data: propsData,
|
|
35
|
-
dotRole,
|
|
36
|
-
emptyComponent,
|
|
37
|
-
id: propsId,
|
|
38
|
-
isDotSelected,
|
|
39
|
-
labelVariant,
|
|
40
|
-
localeText,
|
|
41
|
-
onBrush,
|
|
42
|
-
onBrushEnd,
|
|
43
|
-
onDotClick,
|
|
44
|
-
size,
|
|
45
|
-
theme,
|
|
46
|
-
tooltipVariant,
|
|
47
|
-
variant,
|
|
48
|
-
|
|
49
|
-
...forwardedProps
|
|
50
|
-
} = props;
|
|
51
|
-
const [_id] = useId();
|
|
52
|
-
const id = propsId ?? _id;
|
|
53
|
-
|
|
54
|
-
if (propsData === undefined || propsData === null) {
|
|
55
|
-
return <LoadingScatterPlot id={id} {...forwardedProps} ref={ref} />;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (propsData.length === 0) {
|
|
59
|
-
return (
|
|
60
|
-
<EmptyScatterPlot
|
|
61
|
-
data={propsData}
|
|
62
|
-
emptyComponent={emptyComponent}
|
|
63
|
-
localeText={localeText}
|
|
64
|
-
size={size}
|
|
65
|
-
{...forwardedProps}
|
|
66
|
-
ref={ref}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<RenderedScatterPlot
|
|
73
|
-
className={classNames(ScatterPlot.className, className)}
|
|
74
|
-
data={propsData}
|
|
75
|
-
dotRole={dotRole}
|
|
76
|
-
id={id}
|
|
77
|
-
isDotSelected={isDotSelected}
|
|
78
|
-
labelVariant={labelVariant}
|
|
79
|
-
localeText={localeText}
|
|
80
|
-
onBrush={onBrush}
|
|
81
|
-
onBrushEnd={onBrushEnd}
|
|
82
|
-
onDotClick={onDotClick}
|
|
83
|
-
size={size}
|
|
84
|
-
theme={theme}
|
|
85
|
-
tooltipVariant={tooltipVariant}
|
|
86
|
-
variant={variant}
|
|
87
|
-
{...forwardedProps}
|
|
88
|
-
ref={ref}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
ScatterPlot.className = CLASSNAME;
|
|
93
|
-
ScatterPlot.defaultProps = DEFAULT_PROPS;
|
|
94
|
-
ScatterPlot.displayName = COMPONENT_NAME;
|