@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,56 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
|
-
import { ValueOf } from '@redsift/design-system';
|
|
3
|
-
import { AnyScale, TicksSpec } from '../../types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Component variant.
|
|
7
|
-
*/
|
|
8
|
-
export const AxisVariant = {
|
|
9
|
-
none: 'none',
|
|
10
|
-
line: 'line',
|
|
11
|
-
lineTick: 'lineTick',
|
|
12
|
-
tick: 'tick',
|
|
13
|
-
tickValue: 'tickValue',
|
|
14
|
-
default: 'default',
|
|
15
|
-
} as const;
|
|
16
|
-
export type AxisVariant = ValueOf<typeof AxisVariant>;
|
|
17
|
-
|
|
18
|
-
export const AxisPosition = {
|
|
19
|
-
top: 'top',
|
|
20
|
-
right: 'right',
|
|
21
|
-
bottom: 'bottom',
|
|
22
|
-
left: 'left',
|
|
23
|
-
};
|
|
24
|
-
export type AxisPosition = ValueOf<typeof AxisPosition>;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Component props.
|
|
28
|
-
*/
|
|
29
|
-
export interface AxisProps extends Omit<ComponentProps<'g'>, 'scale'> {
|
|
30
|
-
areLabelsRotated?: boolean;
|
|
31
|
-
format?: string;
|
|
32
|
-
legend?: string;
|
|
33
|
-
legendOffset?: number;
|
|
34
|
-
legendPosition?: 'start' | 'middle' | 'end';
|
|
35
|
-
/** Length of the axis. */
|
|
36
|
-
length?: number;
|
|
37
|
-
/** Position of axis. top|bottom means this is an x axis, right|left means this is an y axis. */
|
|
38
|
-
position?: AxisPosition;
|
|
39
|
-
/** Scale (d3.js) used to generate the axis. */
|
|
40
|
-
scale: AnyScale;
|
|
41
|
-
tickPadding?: number;
|
|
42
|
-
tickRotation?: number;
|
|
43
|
-
tickSize?: number;
|
|
44
|
-
tickValues?: TicksSpec;
|
|
45
|
-
/** Variant. */
|
|
46
|
-
variant?: AxisVariant;
|
|
47
|
-
/** X position. */
|
|
48
|
-
x?: number;
|
|
49
|
-
/** Y position. */
|
|
50
|
-
y?: number;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type StyledAxisProps = Omit<
|
|
54
|
-
AxisProps,
|
|
55
|
-
'areXLabelsRotated' | 'size' | 'scale'
|
|
56
|
-
> & {};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import type { StoryObj } from '@storybook/react';
|
|
4
|
-
import { scaleLinear as d3scaleLinear } from 'd3';
|
|
5
|
-
|
|
6
|
-
import { Bar, BarOrientation, BarProps } from '.';
|
|
7
|
-
import { BarDatum, TooltipVariant } from '../../types';
|
|
8
|
-
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Charts/Core/Bar',
|
|
11
|
-
component: Bar,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
type Story = StoryObj<BarProps>;
|
|
16
|
-
|
|
17
|
-
const scale = d3scaleLinear().domain([0, 1000]).range([0, 500]);
|
|
18
|
-
|
|
19
|
-
export const Simple: Story = {
|
|
20
|
-
render: () => (
|
|
21
|
-
<>
|
|
22
|
-
{Object.keys(BarOrientation).map((orientation) => (
|
|
23
|
-
<svg width={500} height={500} key={orientation}>
|
|
24
|
-
<Bar
|
|
25
|
-
orientation={orientation}
|
|
26
|
-
data={{
|
|
27
|
-
data: {
|
|
28
|
-
key: 'Croissant',
|
|
29
|
-
value: 333,
|
|
30
|
-
},
|
|
31
|
-
}}
|
|
32
|
-
scale={scale}
|
|
33
|
-
/>
|
|
34
|
-
</svg>
|
|
35
|
-
))}
|
|
36
|
-
</>
|
|
37
|
-
),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Clickable: Story = {
|
|
41
|
-
render: () => (
|
|
42
|
-
<>
|
|
43
|
-
{Object.keys(BarOrientation).map((orientation) => (
|
|
44
|
-
<svg width={500} height={500} key={orientation}>
|
|
45
|
-
<Bar
|
|
46
|
-
index={0}
|
|
47
|
-
isSelected={false}
|
|
48
|
-
onClick={(datum) => console.log(datum)}
|
|
49
|
-
orientation={orientation}
|
|
50
|
-
data={{
|
|
51
|
-
data: {
|
|
52
|
-
key: 'Button',
|
|
53
|
-
value: 150,
|
|
54
|
-
},
|
|
55
|
-
}}
|
|
56
|
-
scale={scale}
|
|
57
|
-
/>
|
|
58
|
-
<Bar
|
|
59
|
-
index={1}
|
|
60
|
-
isSelected
|
|
61
|
-
onClick={(datum) => {
|
|
62
|
-
window.open(
|
|
63
|
-
`https://en.wikipedia.org/wiki/${datum.data.key}`,
|
|
64
|
-
'_blank'
|
|
65
|
-
);
|
|
66
|
-
}}
|
|
67
|
-
orientation={orientation}
|
|
68
|
-
data={{
|
|
69
|
-
data: {
|
|
70
|
-
key: 'Link',
|
|
71
|
-
value: 333,
|
|
72
|
-
},
|
|
73
|
-
}}
|
|
74
|
-
role="link"
|
|
75
|
-
scale={scale}
|
|
76
|
-
/>
|
|
77
|
-
</svg>
|
|
78
|
-
))}
|
|
79
|
-
</>
|
|
80
|
-
),
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Selectable: Story = {
|
|
84
|
-
render: () => (
|
|
85
|
-
<>
|
|
86
|
-
{Object.keys(BarOrientation).map((orientation) => (
|
|
87
|
-
<svg width={500} height={500} key={orientation}>
|
|
88
|
-
<Bar
|
|
89
|
-
index={0}
|
|
90
|
-
isSelected={false}
|
|
91
|
-
orientation={orientation}
|
|
92
|
-
data={{
|
|
93
|
-
data: {
|
|
94
|
-
key: 'Deselected',
|
|
95
|
-
value: 150,
|
|
96
|
-
},
|
|
97
|
-
}}
|
|
98
|
-
role="option"
|
|
99
|
-
scale={scale}
|
|
100
|
-
/>
|
|
101
|
-
<Bar
|
|
102
|
-
index={1}
|
|
103
|
-
isSelected
|
|
104
|
-
orientation={orientation}
|
|
105
|
-
data={{
|
|
106
|
-
data: {
|
|
107
|
-
key: 'Selected',
|
|
108
|
-
value: 333,
|
|
109
|
-
},
|
|
110
|
-
}}
|
|
111
|
-
role="option"
|
|
112
|
-
scale={scale}
|
|
113
|
-
/>
|
|
114
|
-
</svg>
|
|
115
|
-
))}
|
|
116
|
-
</>
|
|
117
|
-
),
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export const WithTooltip: Story = {
|
|
121
|
-
render: () => (
|
|
122
|
-
<>
|
|
123
|
-
{Object.keys(BarOrientation).map((orientation) => (
|
|
124
|
-
<svg width={500} height={500} key={orientation}>
|
|
125
|
-
{Object.keys(TooltipVariant).map((tooltipVariant, index) => (
|
|
126
|
-
<Bar
|
|
127
|
-
index={index}
|
|
128
|
-
isSelected
|
|
129
|
-
key={tooltipVariant}
|
|
130
|
-
labelDecorator={(datum: BarDatum) =>
|
|
131
|
-
`${datum.data.key
|
|
132
|
-
.charAt(0)
|
|
133
|
-
.toUpperCase()}${datum.data.key.slice(1)}`
|
|
134
|
-
}
|
|
135
|
-
orientation={orientation}
|
|
136
|
-
data={{
|
|
137
|
-
data: {
|
|
138
|
-
key: tooltipVariant,
|
|
139
|
-
value: 333,
|
|
140
|
-
percent: 0.05,
|
|
141
|
-
},
|
|
142
|
-
}}
|
|
143
|
-
tooltipVariant={tooltipVariant as TooltipVariant}
|
|
144
|
-
role="option"
|
|
145
|
-
scale={scale}
|
|
146
|
-
/>
|
|
147
|
-
))}
|
|
148
|
-
</svg>
|
|
149
|
-
))}
|
|
150
|
-
</>
|
|
151
|
-
),
|
|
152
|
-
};
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
3
|
-
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import { scaleLinear as d3scaleLinear } from 'd3';
|
|
5
|
-
|
|
6
|
-
import { Bar } from './Bar';
|
|
7
|
-
import { TooltipVariant } from '../../types';
|
|
8
|
-
|
|
9
|
-
jest.mock('@redsift/design-system', () => ({
|
|
10
|
-
...jest.requireActual('@redsift/design-system'),
|
|
11
|
-
useId: () => ['123'],
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
const scale = d3scaleLinear().domain([0, 1000]).range([0, 500]);
|
|
15
|
-
|
|
16
|
-
describe('Bar', () => {
|
|
17
|
-
const onClickSpy = jest.fn();
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
onClickSpy.mockClear();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('supports click', async () => {
|
|
24
|
-
const { getByRole } = render(
|
|
25
|
-
<svg width={500} height={500}>
|
|
26
|
-
<Bar
|
|
27
|
-
id="123"
|
|
28
|
-
index={0}
|
|
29
|
-
data={{
|
|
30
|
-
data: {
|
|
31
|
-
key: 'Croissant',
|
|
32
|
-
value: 333,
|
|
33
|
-
},
|
|
34
|
-
}}
|
|
35
|
-
scale={scale}
|
|
36
|
-
onClick={onClickSpy}
|
|
37
|
-
/>
|
|
38
|
-
</svg>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const bar = getByRole('button');
|
|
42
|
-
fireEvent.click(bar);
|
|
43
|
-
expect(onClickSpy).toHaveBeenCalledWith({
|
|
44
|
-
data: { key: 'Croissant', value: 333 },
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('supports keydown', async () => {
|
|
49
|
-
const { getByRole } = render(
|
|
50
|
-
<svg width={500} height={500}>
|
|
51
|
-
<Bar
|
|
52
|
-
id="123"
|
|
53
|
-
index={0}
|
|
54
|
-
data={{
|
|
55
|
-
data: {
|
|
56
|
-
key: 'Croissant',
|
|
57
|
-
value: 333,
|
|
58
|
-
},
|
|
59
|
-
}}
|
|
60
|
-
scale={scale}
|
|
61
|
-
onClick={onClickSpy}
|
|
62
|
-
orientation="vertical"
|
|
63
|
-
/>
|
|
64
|
-
</svg>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const bar = getByRole('button');
|
|
68
|
-
fireEvent.keyDown(bar, { key: 'Enter', code: 'Enter', charCode: 13 });
|
|
69
|
-
expect(onClickSpy).toHaveBeenCalledWith({
|
|
70
|
-
data: { key: 'Croissant', value: 333 },
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('shows a tooltip on hover', async () => {
|
|
75
|
-
const user = userEvent.setup();
|
|
76
|
-
const { getByRole } = render(
|
|
77
|
-
<svg width={500} height={500}>
|
|
78
|
-
<Bar
|
|
79
|
-
id="123"
|
|
80
|
-
index={0}
|
|
81
|
-
// The onClick gives the bar the role "button" which is then used to access the bars.
|
|
82
|
-
onClick={onClickSpy}
|
|
83
|
-
data={{
|
|
84
|
-
data: {
|
|
85
|
-
key: 'Croissant',
|
|
86
|
-
value: 333,
|
|
87
|
-
},
|
|
88
|
-
}}
|
|
89
|
-
scale={scale}
|
|
90
|
-
tooltipVariant={TooltipVariant.label}
|
|
91
|
-
/>
|
|
92
|
-
</svg>
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const bar = getByRole('button');
|
|
96
|
-
await user.hover(bar);
|
|
97
|
-
await waitFor(() => {
|
|
98
|
-
expect(screen.getByRole('tooltip', { exact: true })).toBeInTheDocument();
|
|
99
|
-
});
|
|
100
|
-
const tooltip = screen.getByRole('tooltip');
|
|
101
|
-
expect(tooltip.textContent).toContain('Croissant');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it.each`
|
|
105
|
-
Type | props | result
|
|
106
|
-
${'with label'} | ${{ data: { data: { key: 'Croissant', value: 333 } }, tooltipVariant: TooltipVariant.label }} | ${'Croissant'}
|
|
107
|
-
${'with value'} | ${{ data: { data: { key: 'Croissant', value: 333 } }, tooltipVariant: TooltipVariant.value }} | ${'Croissant - 333'}
|
|
108
|
-
${'with percent'} | ${{ data: { data: { key: 'Croissant', value: 333, percent: 0.05 } }, tooltipVariant: TooltipVariant.percent }} | ${'Croissant - 5%'}
|
|
109
|
-
${'with empty value if there is a label'} | ${{ data: { data: { key: 'Croissant', value: 0 } }, tooltipVariant: TooltipVariant.value }} | ${'Croissant'}
|
|
110
|
-
`('it shows a tooltip on hover $Type', async function ({ props, result }) {
|
|
111
|
-
const user = userEvent.setup();
|
|
112
|
-
const { getByRole } = render(
|
|
113
|
-
<svg width={500} height={500}>
|
|
114
|
-
<Bar
|
|
115
|
-
id="123"
|
|
116
|
-
index={0}
|
|
117
|
-
// The onClick gives the bar the role "button" which is then used to access the bars.
|
|
118
|
-
onClick={onClickSpy}
|
|
119
|
-
scale={scale}
|
|
120
|
-
{...props}
|
|
121
|
-
/>
|
|
122
|
-
</svg>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
const bar = getByRole('button');
|
|
126
|
-
await user.hover(bar);
|
|
127
|
-
await waitFor(() => {
|
|
128
|
-
expect(screen.getByRole('tooltip', { exact: true })).toBeInTheDocument();
|
|
129
|
-
});
|
|
130
|
-
const tooltip = screen.getByRole('tooltip');
|
|
131
|
-
expect(tooltip.textContent).toBe(result);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it.each`
|
|
135
|
-
Type | props
|
|
136
|
-
${'with variant label when label is empty'} | ${{ data: { data: { key: '', value: 333 } }, tooltipVariant: TooltipVariant.label }}
|
|
137
|
-
`('it does not show a tooltip on hover $Type', async function ({ props }) {
|
|
138
|
-
const user = userEvent.setup();
|
|
139
|
-
const { getByRole } = render(
|
|
140
|
-
<svg width={500} height={500}>
|
|
141
|
-
<Bar
|
|
142
|
-
id="123"
|
|
143
|
-
index={0}
|
|
144
|
-
// The onClick gives the bar the role "button" which is then used to access the bars.
|
|
145
|
-
onClick={onClickSpy}
|
|
146
|
-
scale={scale}
|
|
147
|
-
{...props}
|
|
148
|
-
/>
|
|
149
|
-
</svg>
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
const bar = getByRole('button');
|
|
153
|
-
await user.hover(bar);
|
|
154
|
-
expect(() => screen.getByRole('tooltip')).toThrow('Unable to find an accessible element with the role "tooltip"');
|
|
155
|
-
});
|
|
156
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { animated, useSpring } from '@react-spring/web';
|
|
4
|
-
import { interpolate as d3interpolate } from 'd3';
|
|
5
|
-
|
|
6
|
-
import { Comp } from '@redsift/design-system';
|
|
7
|
-
|
|
8
|
-
import { BarOrientation, BarProps } from './types';
|
|
9
|
-
import { StyledBar } from './styles';
|
|
10
|
-
import { monochrome } from '../../scheme';
|
|
11
|
-
import { config } from '../../config';
|
|
12
|
-
|
|
13
|
-
const COMPONENT_NAME = 'Bar';
|
|
14
|
-
const CLASSNAME = 'redsift-bar';
|
|
15
|
-
const DEFAULT_PROPS: Partial<BarProps> = {
|
|
16
|
-
color: monochrome,
|
|
17
|
-
index: 0,
|
|
18
|
-
gap: 5,
|
|
19
|
-
height: 40,
|
|
20
|
-
orientation: BarOrientation.horizontal,
|
|
21
|
-
previousData: {
|
|
22
|
-
data: {
|
|
23
|
-
key: '',
|
|
24
|
-
value: 0,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
width: 40,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Bar: Comp<BarProps, SVGGElement> = forwardRef((props, ref) => {
|
|
31
|
-
const {
|
|
32
|
-
color,
|
|
33
|
-
data,
|
|
34
|
-
index,
|
|
35
|
-
isSelected: propsIsSelected,
|
|
36
|
-
labelDecorator,
|
|
37
|
-
onClick,
|
|
38
|
-
role,
|
|
39
|
-
} = props;
|
|
40
|
-
|
|
41
|
-
const {
|
|
42
|
-
className,
|
|
43
|
-
gap,
|
|
44
|
-
height,
|
|
45
|
-
orientation,
|
|
46
|
-
previousData,
|
|
47
|
-
scale,
|
|
48
|
-
width,
|
|
49
|
-
...forwardedProps
|
|
50
|
-
} = props;
|
|
51
|
-
|
|
52
|
-
const interpolator = d3interpolate(
|
|
53
|
-
previousData!.data?.value || 0,
|
|
54
|
-
data.data.value
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const text = labelDecorator ? labelDecorator(data) : data.data.key;
|
|
58
|
-
const isSelectable = role === 'option';
|
|
59
|
-
const isDeselected = isSelectable && propsIsSelected === false;
|
|
60
|
-
|
|
61
|
-
const animatedProps = useSpring({
|
|
62
|
-
...config,
|
|
63
|
-
to: async (next: (props?: object) => Promise<void>) => {
|
|
64
|
-
await next({ t: 1 });
|
|
65
|
-
},
|
|
66
|
-
from: { t: 0 },
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<StyledBar
|
|
71
|
-
{...forwardedProps}
|
|
72
|
-
ref={ref}
|
|
73
|
-
className={classNames(Bar.className, className)}
|
|
74
|
-
transform={
|
|
75
|
-
orientation === BarOrientation.horizontal
|
|
76
|
-
? `translate(0, ${gap! * (index! + 1) + height! * index!})`
|
|
77
|
-
: `translate(${gap! * (index! + 1) + width! * index!}, 0)`
|
|
78
|
-
}
|
|
79
|
-
$clickable={Boolean(onClick)}
|
|
80
|
-
>
|
|
81
|
-
{orientation === BarOrientation.horizontal ? (
|
|
82
|
-
<animated.rect
|
|
83
|
-
height={height}
|
|
84
|
-
fill={isDeselected ? 'var(--redsift-color-neutral-lightgrey)' : color}
|
|
85
|
-
width={
|
|
86
|
-
config.immediate
|
|
87
|
-
? scale(data.data.value)
|
|
88
|
-
: animatedProps.t.to((t) => scale(interpolator(t)))
|
|
89
|
-
}
|
|
90
|
-
/>
|
|
91
|
-
) : (
|
|
92
|
-
<animated.rect
|
|
93
|
-
height={
|
|
94
|
-
config.immediate
|
|
95
|
-
? scale(data.data.value)
|
|
96
|
-
: animatedProps.t.to((t) => scale(interpolator(t)))
|
|
97
|
-
}
|
|
98
|
-
fill={isDeselected ? 'var(--redsift-color-neutral-lightgrey)' : color}
|
|
99
|
-
width={width}
|
|
100
|
-
/>
|
|
101
|
-
)}
|
|
102
|
-
{orientation === BarOrientation.horizontal ? (
|
|
103
|
-
<text x="10" y={height! / 2} dy="0.35em" aria-hidden={true}>
|
|
104
|
-
{text}
|
|
105
|
-
</text>
|
|
106
|
-
) : null}
|
|
107
|
-
</StyledBar>
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
Bar.className = CLASSNAME;
|
|
111
|
-
Bar.defaultProps = DEFAULT_PROPS;
|
|
112
|
-
Bar.displayName = COMPONENT_NAME;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { StyledBarProps } from './types';
|
|
3
|
-
import { DataPoint } from '../DataPoint';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Component style.
|
|
7
|
-
*/
|
|
8
|
-
export const StyledBar = styled(DataPoint)<StyledBarProps>`
|
|
9
|
-
rect {
|
|
10
|
-
fill-opacity: 0.9;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
${({ $clickable }) =>
|
|
14
|
-
$clickable
|
|
15
|
-
? css`
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
|
|
18
|
-
&:hover,
|
|
19
|
-
&:focus,
|
|
20
|
-
&.focused {
|
|
21
|
-
outline: none;
|
|
22
|
-
rect {
|
|
23
|
-
fill-opacity: 0.7;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// &:focus-visible {
|
|
28
|
-
// rect {
|
|
29
|
-
// stroke: var(--redsift-color-default-primary);
|
|
30
|
-
// stroke-width: 4px;
|
|
31
|
-
// paint-order: stroke;
|
|
32
|
-
// }
|
|
33
|
-
// }
|
|
34
|
-
|
|
35
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
36
|
-
&:focus-visible,
|
|
37
|
-
&.focused {
|
|
38
|
-
outline: 2px solid var(--redsift-color-default-primary);
|
|
39
|
-
transition: outline-offset 75ms ease-out;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&:not(&:active)&:focus-visible,
|
|
43
|
-
&:not(&:active)&.focused {
|
|
44
|
-
transition-duration: 0.25s;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&:not(&:active)&:focus-visible,
|
|
49
|
-
&:not(&:active)&.focused {
|
|
50
|
-
outline-offset: 0.2rem;
|
|
51
|
-
}
|
|
52
|
-
`
|
|
53
|
-
: ''}}
|
|
54
|
-
`;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ScaleLinear as d3ScaleLinear } from 'd3';
|
|
2
|
-
import { ValueOf } from '@redsift/design-system';
|
|
3
|
-
import { BarDatum } from '../../types';
|
|
4
|
-
import { DataPointProps, StyledDataPointProps } from '../DataPoint';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Component variant.
|
|
8
|
-
*/
|
|
9
|
-
export const BarOrientation = {
|
|
10
|
-
horizontal: 'horizontal',
|
|
11
|
-
vertical: 'vertical',
|
|
12
|
-
};
|
|
13
|
-
export type BarOrientation = ValueOf<typeof BarOrientation>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Component props.
|
|
17
|
-
*/
|
|
18
|
-
export interface BarProps extends DataPointProps<BarDatum> {
|
|
19
|
-
/** Gap between two siblings. */
|
|
20
|
-
gap?: number;
|
|
21
|
-
/** Height of the bar in horizontal orientation. */
|
|
22
|
-
height?: number;
|
|
23
|
-
/** Orientation of the bar. */
|
|
24
|
-
orientation?: BarOrientation;
|
|
25
|
-
/** A linear continuous scale defined over a numeric domain used to determine the width or height of the bar (depending on the orientation). */
|
|
26
|
-
scale: d3ScaleLinear<number, number, never>;
|
|
27
|
-
/** Width of the bar in vertical orientation. */
|
|
28
|
-
width?: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type StyledBarProps = StyledDataPointProps & Omit<BarProps, 'scale'>;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { PresentationColorPalette } from '@redsift/design-system';
|
|
4
|
-
import { BarChart } from '.';
|
|
5
|
-
import { CategoryData, ChartSize, ChartTheme, ColorTheme, TooltipVariant } from '../../types';
|
|
6
|
-
|
|
7
|
-
const themes = {
|
|
8
|
-
...ColorTheme,
|
|
9
|
-
'success-warning-danger': {
|
|
10
|
-
success: 'Bread',
|
|
11
|
-
warning: 'Tea',
|
|
12
|
-
danger: 'Coffee',
|
|
13
|
-
},
|
|
14
|
-
'success-warning-danger-neutral': {
|
|
15
|
-
success: 'Bread',
|
|
16
|
-
warning: 'Tea',
|
|
17
|
-
danger: 'Coffee',
|
|
18
|
-
neutral: 'Pastry',
|
|
19
|
-
},
|
|
20
|
-
custom: {
|
|
21
|
-
Coffee: PresentationColorPalette.purple,
|
|
22
|
-
Bread: PresentationColorPalette.pink,
|
|
23
|
-
Tea: PresentationColorPalette.aqua,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const meta: Meta<typeof BarChart> = {
|
|
28
|
-
title: 'Charts/BarChart',
|
|
29
|
-
component: BarChart as any,
|
|
30
|
-
argTypes: {
|
|
31
|
-
tooltipVariant: {
|
|
32
|
-
options: Object.values(TooltipVariant),
|
|
33
|
-
control: { type: 'select' },
|
|
34
|
-
},
|
|
35
|
-
size: {
|
|
36
|
-
options: Object.values(ChartSize),
|
|
37
|
-
control: { type: 'select' },
|
|
38
|
-
},
|
|
39
|
-
theme: {
|
|
40
|
-
options: Object.keys(themes),
|
|
41
|
-
mapping: themes,
|
|
42
|
-
control: {
|
|
43
|
-
type: 'select',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
export default meta;
|
|
49
|
-
type Story = StoryObj<typeof BarChart>;
|
|
50
|
-
|
|
51
|
-
const data: CategoryData = [
|
|
52
|
-
{ key: 'Cookies', value: 540 },
|
|
53
|
-
{ key: 'Coffee', value: 5471 },
|
|
54
|
-
{ key: 'Bread', value: 3325 },
|
|
55
|
-
{ key: 'Tea', value: 1435 },
|
|
56
|
-
{ key: 'Pastry', value: 856 },
|
|
57
|
-
{ key: 'Sandwich', value: 771 },
|
|
58
|
-
{ key: 'Croissant', value: 771 },
|
|
59
|
-
{ key: 'Hot chocolate', value: 588 },
|
|
60
|
-
{ key: 'Toast', value: 318 },
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
export const Controls: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
title: 'Bar Chart',
|
|
66
|
-
tooltipVariant: 'value',
|
|
67
|
-
size: 'medium',
|
|
68
|
-
theme: 'success-warning-danger-neutral' as ChartTheme,
|
|
69
|
-
caping: 4,
|
|
70
|
-
others: true,
|
|
71
|
-
onBarClick: (datum) => console.log(datum),
|
|
72
|
-
data: data,
|
|
73
|
-
},
|
|
74
|
-
};
|