@reshape-biotech/design-system 1.2.5 → 1.2.7
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/README.md +3 -1
- package/dist/app.css +97 -97
- package/dist/components/activity/Activity.stories.svelte +104 -104
- package/dist/components/activity/Activity.svelte +112 -112
- package/dist/components/avatar/Avatar.stories.svelte +23 -23
- package/dist/components/avatar/Avatar.svelte +54 -54
- package/dist/components/banner/Banner.stories.svelte +105 -105
- package/dist/components/banner/Banner.svelte +42 -42
- package/dist/components/button/Button.stories.svelte +61 -61
- package/dist/components/button/Button.svelte +95 -95
- package/dist/components/card/Card.stories.svelte +112 -112
- package/dist/components/card/Card.svelte +18 -18
- package/dist/components/checkbox/Checkbox.stories.svelte +8 -8
- package/dist/components/checkbox/Checkbox.svelte +17 -17
- package/dist/components/collapsible/Collapsible.stories.svelte +26 -26
- package/dist/components/collapsible/components/collapsible-content.svelte +20 -20
- package/dist/components/collapsible/components/collapsible-trigger.svelte +12 -12
- package/dist/components/combobox/Combobox.stories.svelte +412 -412
- package/dist/components/combobox/components/combobox-add.svelte +8 -8
- package/dist/components/combobox/components/combobox-content.svelte +39 -39
- package/dist/components/combobox/components/combobox-indicator.svelte +1 -1
- package/dist/components/datepicker/DatePicker.stories.svelte +196 -196
- package/dist/components/datepicker/DatePicker.svelte +173 -173
- package/dist/components/divider/Divider.stories.svelte +7 -7
- package/dist/components/divider/Divider.svelte +9 -9
- package/dist/components/drawer/Drawer.stories.svelte +51 -51
- package/dist/components/drawer/Drawer.svelte +33 -33
- package/dist/components/drawer/DrawerLabel.svelte +10 -10
- package/dist/components/dropdown/Dropdown.stories.svelte +210 -210
- package/dist/components/dropdown/Dropdown.svelte +57 -57
- package/dist/components/dropdown/components/DropdownContent.svelte +16 -16
- package/dist/components/dropdown/components/DropdownMenu.svelte +10 -10
- package/dist/components/dropdown/components/DropdownTrigger.svelte +37 -37
- package/dist/components/dropdown/components/OutlinedButton.svelte +9 -9
- package/dist/components/empty-content/EmptyContent.stories.svelte +38 -38
- package/dist/components/empty-content/EmptyContent.svelte +12 -12
- package/dist/components/graphs/bar-chart/BarChart.stories.svelte +91 -91
- package/dist/components/graphs/bar-chart/BarChart.svelte +147 -147
- package/dist/components/graphs/bar-chart/StackedBarChart.stories.svelte +57 -57
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte +198 -199
- package/dist/components/graphs/chart/Chart.stories.svelte +96 -96
- package/dist/components/graphs/chart/Chart.svelte +207 -207
- package/dist/components/graphs/line/LineChart.stories.svelte +138 -138
- package/dist/components/graphs/line/LineChart.svelte +140 -142
- package/dist/components/graphs/matrix/Matrix.stories.svelte +117 -117
- package/dist/components/graphs/matrix/Matrix.svelte +141 -141
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +168 -168
- package/dist/components/graphs/multiline/MultiLineChart.svelte +236 -236
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +84 -84
- package/dist/components/graphs/scatterplot/Scatterplot.svelte +302 -302
- package/dist/components/graphs/utils/duration.d.ts +1 -0
- package/dist/components/graphs/utils/duration.js +33 -0
- package/dist/components/graphs/utils/tooltipFormatter.js +1 -1
- package/dist/components/icon-button/IconButton.stories.svelte +64 -64
- package/dist/components/icon-button/IconButton.svelte +88 -88
- package/dist/components/icons/AnalysisIcon.stories.svelte +18 -18
- package/dist/components/icons/AnalysisIcon.svelte +96 -96
- package/dist/components/icons/Icon.stories.svelte +111 -111
- package/dist/components/icons/Icon.svelte +17 -17
- package/dist/components/icons/PrincipalIcon.svelte +59 -59
- package/dist/components/icons/custom/Halo.svelte +31 -31
- package/dist/components/icons/custom/Well.svelte +27 -27
- package/dist/components/icons/index.d.ts +3 -2
- package/dist/components/icons/index.js +3 -1
- package/dist/components/image/Image.svelte +42 -42
- package/dist/components/input/Input.stories.svelte +55 -55
- package/dist/components/input/Input.svelte +121 -121
- package/dist/components/label/Label.stories.svelte +18 -18
- package/dist/components/label/Label.svelte +11 -11
- package/dist/components/list/List.stories.svelte +84 -84
- package/dist/components/list/List.svelte +20 -20
- package/dist/components/logo/Logo.stories.svelte +15 -15
- package/dist/components/logo/Logo.svelte +30 -30
- package/dist/components/manual-cfu-counter/ManualCFUCounter.stories.svelte +102 -102
- package/dist/components/manual-cfu-counter/ManualCFUCounter.svelte +557 -565
- package/dist/components/manual-cfu-counter/test/ManualCFUCounterTestWrapper.svelte +11 -11
- package/dist/components/markdown/Markdown.stories.svelte +10 -10
- package/dist/components/markdown/Markdown.svelte +6 -6
- package/dist/components/modal/Modal.stories.svelte +29 -29
- package/dist/components/modal/Modal.svelte +71 -71
- package/dist/components/multi-cfu-counter/MultiCFUCounter.stories.svelte +215 -0
- package/dist/components/multi-cfu-counter/MultiCFUCounter.stories.svelte.d.ts +3 -0
- package/dist/components/multi-cfu-counter/MultiCFUCounter.svelte +662 -0
- package/dist/components/multi-cfu-counter/MultiCFUCounter.svelte.d.ts +32 -0
- package/dist/components/multi-cfu-counter/index.d.ts +1 -0
- package/dist/components/multi-cfu-counter/index.js +1 -0
- package/dist/components/multi-cfu-counter/test/MultiCFUCounterTestWrapper.svelte +28 -0
- package/dist/components/multi-cfu-counter/test/MultiCFUCounterTestWrapper.svelte.d.ts +20 -0
- package/dist/components/notification-popup/NotificationPopup.stories.svelte +18 -18
- package/dist/components/notification-popup/NotificationPopup.svelte +26 -26
- package/dist/components/notifications/Notifications.stories.svelte +101 -101
- package/dist/components/notifications/Notifications.svelte +9 -9
- package/dist/components/pill/Pill.stories.svelte +8 -8
- package/dist/components/pill/Pill.svelte +27 -27
- package/dist/components/progress-circle/ProgressCircle.stories.svelte +8 -8
- package/dist/components/progress-circle/ProgressCircle.svelte +54 -54
- package/dist/components/required-status-indicator/RequiredStatusIndicator.stories.svelte +18 -18
- package/dist/components/required-status-indicator/RequiredStatusIndicator.svelte +14 -14
- package/dist/components/segmented-control-buttons/ControlButton.svelte +36 -36
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.stories.svelte +35 -35
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.svelte +13 -13
- package/dist/components/select/Select.stories.svelte +77 -77
- package/dist/components/select/Select.svelte +114 -114
- package/dist/components/select-new/Select.stories.svelte +188 -188
- package/dist/components/select-new/components/Group.svelte +17 -17
- package/dist/components/select-new/components/MultiSelectTrigger.svelte +57 -57
- package/dist/components/select-new/components/SelectContent.svelte +22 -22
- package/dist/components/select-new/components/SelectGroupHeading.svelte +10 -10
- package/dist/components/select-new/components/SelectItem.svelte +25 -25
- package/dist/components/select-new/components/SelectTrigger.svelte +38 -38
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte +76 -76
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte.d.ts +1 -1
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte +53 -53
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte.d.ts +1 -1
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.js +1 -1
- package/dist/components/skeleton-loader/SkeletonLoader.stories.svelte +32 -32
- package/dist/components/skeleton-loader/SkeletonLoader.svelte +10 -10
- package/dist/components/skeleton-loader/StatcardSkeleton.svelte +9 -9
- package/dist/components/skeleton-loader/components/Skeleton.svelte +7 -7
- package/dist/components/skeleton-loader/components/SkeletonImage.svelte +12 -12
- package/dist/components/slider/Slider.stories.svelte +23 -23
- package/dist/components/slider/Slider.svelte +107 -107
- package/dist/components/spinner/Spinner.stories.svelte +8 -8
- package/dist/components/spinner/Spinner.svelte +18 -18
- package/dist/components/stat-card/StatCard.stories.svelte +26 -26
- package/dist/components/stat-card/StatCard.svelte +128 -128
- package/dist/components/status-badge/StatusBadge.stories.svelte +365 -365
- package/dist/components/status-badge/StatusBadge.svelte +54 -54
- package/dist/components/stepper/Stepper.stories.svelte +219 -219
- package/dist/components/stepper/components/stepper-root.svelte +12 -12
- package/dist/components/stepper/components/stepper-step.svelte +83 -83
- package/dist/components/table/Table.stories.svelte +87 -87
- package/dist/components/table/Table.svelte +32 -32
- package/dist/components/table/components/TBody.svelte +7 -7
- package/dist/components/table/components/THead.svelte +7 -7
- package/dist/components/table/components/Td.svelte +8 -8
- package/dist/components/table/components/Th.svelte +8 -8
- package/dist/components/table/components/Tr.svelte +11 -11
- package/dist/components/tabs/Tabs.stories.svelte +20 -20
- package/dist/components/tabs/Tabs.svelte +8 -8
- package/dist/components/tabs/components/Content.svelte +8 -8
- package/dist/components/tabs/components/Tab.svelte +14 -14
- package/dist/components/tabs/components/Tabs.svelte +7 -7
- package/dist/components/tag/Tag.stories.svelte +57 -57
- package/dist/components/tag/Tag.svelte +95 -95
- package/dist/components/textarea/Textarea.stories.svelte +70 -70
- package/dist/components/textarea/Textarea.svelte +76 -76
- package/dist/components/toast/Toast.stories.svelte +204 -204
- package/dist/components/toast/Toast.svelte +53 -53
- package/dist/components/toggle/Toggle.stories.svelte +9 -9
- package/dist/components/toggle/Toggle.svelte +53 -53
- package/dist/components/toggle-icon-button/ToggleIconButton.stories.svelte +152 -152
- package/dist/components/toggle-icon-button/ToggleIconButton.svelte +99 -99
- package/dist/components/tooltip/Tooltip.stories.svelte +105 -105
- package/dist/components/tooltip/Tooltip.svelte +26 -26
- package/dist/fonts/index.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/notifications.d.ts +1 -4
- package/dist/notifications.js +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +4 -0
- package/dist/tailwind-safelist.js +406 -398
- package/dist/tailwind.preset.d.ts +4 -0
- package/dist/tailwind.preset.js +10 -10
- package/dist/tokens/colors.d.ts +246 -0
- package/dist/tokens/colors.js +139 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +5 -0
- package/dist/tokens/typography.d.ts +48 -0
- package/dist/tokens/typography.js +48 -0
- package/dist/tokens.d.ts +16 -252
- package/dist/tokens.js +33 -164
- package/dist/types/fonts.d.ts +2 -2
- package/package.json +398 -78
|
@@ -1,119 +1,119 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { textColor } from '../../../tokens';
|
|
4
|
+
import BarChart from './BarChart.svelte';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Design System/Graphs/BarChart',
|
|
8
|
+
component: BarChart,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
// Define argTypes for props if needed, e.g., for controls
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const simpleData = [
|
|
16
|
+
{ category: 'A', value: 10 },
|
|
17
|
+
{ category: 'B', value: 20 },
|
|
18
|
+
{ category: 'C', value: 15 },
|
|
19
|
+
{ category: 'D', value: 25 },
|
|
20
|
+
{ category: 'E', value: 30 },
|
|
21
|
+
];
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
const longerLabelsData = [
|
|
24
|
+
{ longCategoryName: 'Very Long Label One', value: 45 },
|
|
25
|
+
{ longCategoryName: 'Another Quite Long Label', value: 35 },
|
|
26
|
+
{ longCategoryName: 'Short', value: 55 },
|
|
27
|
+
{ longCategoryName: 'Label Four Is Also Lengthy', value: 25 },
|
|
28
|
+
{ longCategoryName: 'Fifth Label Is Here', value: 65 },
|
|
29
|
+
];
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const customColorData = [
|
|
32
|
+
{ category: 'Apple', value: 50 },
|
|
33
|
+
{ category: 'Banana', value: 70 },
|
|
34
|
+
{ category: 'Cherry', value: 60 },
|
|
35
|
+
{ category: 'Date', value: 40 },
|
|
36
|
+
];
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const customColors = {
|
|
39
|
+
Apple: '#ff6b6b', // Red
|
|
40
|
+
Banana: '#feca57', // Yellow
|
|
41
|
+
Cherry: '#ff9ff3', // Pink
|
|
42
|
+
Date: '#a4b0be', // Grey
|
|
43
|
+
};
|
|
44
44
|
</script>
|
|
45
45
|
|
|
46
46
|
<Story
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
name="Base"
|
|
48
|
+
args={{ data: simpleData, xAxisName: 'category', yAxisName: 'Count', height: '400px' }}
|
|
49
49
|
/>
|
|
50
50
|
|
|
51
51
|
<Story
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
name="Custom Y-Axis Name"
|
|
53
|
+
args={{ data: simpleData, xAxisName: 'category', yAxisName: 'Units Sold', height: '400px' }}
|
|
54
54
|
/>
|
|
55
55
|
|
|
56
56
|
<Story
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
name="With Custom Colors"
|
|
58
|
+
args={{
|
|
59
|
+
data: customColorData,
|
|
60
|
+
xAxisName: 'category',
|
|
61
|
+
yAxisName: 'Fruit Amount',
|
|
62
|
+
colors: customColors,
|
|
63
|
+
height: '400px',
|
|
64
|
+
}}
|
|
65
65
|
/>
|
|
66
66
|
|
|
67
67
|
<Story
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
name="With Rotated Labels"
|
|
69
|
+
args={{
|
|
70
|
+
data: longerLabelsData,
|
|
71
|
+
xAxisName: 'longCategoryName',
|
|
72
|
+
yAxisName: 'Measurement',
|
|
73
|
+
rotateXAxisLabels: true,
|
|
74
|
+
height: '400px',
|
|
75
|
+
}}
|
|
76
76
|
/>
|
|
77
77
|
|
|
78
78
|
<Story
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
name="Empty Data"
|
|
80
|
+
args={{ data: [], xAxisName: 'category', yAxisName: 'Value', height: '400px' }}
|
|
81
81
|
/>
|
|
82
82
|
|
|
83
83
|
<Story
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
name="With Capture Interval"
|
|
85
|
+
args={{
|
|
86
|
+
data: [
|
|
87
|
+
{ category: '0', value: 10 },
|
|
88
|
+
{ category: '1', value: 20 },
|
|
89
|
+
{ category: '2', value: 15 },
|
|
90
|
+
{ category: '3', value: 25 },
|
|
91
|
+
{ category: '4', value: 30 },
|
|
92
|
+
{ category: '5', value: 18 },
|
|
93
|
+
{ category: '6', value: 22 },
|
|
94
|
+
],
|
|
95
|
+
xAxisName: 'category',
|
|
96
|
+
yAxisName: 'Value',
|
|
97
|
+
height: '400px',
|
|
98
|
+
captureInterval: 3600,
|
|
99
|
+
}}
|
|
100
100
|
/>
|
|
101
101
|
|
|
102
102
|
<Story
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
name="With Capture Interval - Short Duration"
|
|
104
|
+
args={{
|
|
105
|
+
data: [
|
|
106
|
+
{ category: '0', value: 10 },
|
|
107
|
+
{ category: '1', value: 20 },
|
|
108
|
+
{ category: '2', value: 15 },
|
|
109
|
+
{ category: '3', value: 25 },
|
|
110
|
+
{ category: '4', value: 30 },
|
|
111
|
+
{ category: '5', value: 18 },
|
|
112
|
+
{ category: '6', value: 22 },
|
|
113
|
+
],
|
|
114
|
+
xAxisName: 'category',
|
|
115
|
+
yAxisName: 'Value',
|
|
116
|
+
height: '400px',
|
|
117
|
+
captureInterval: 600,
|
|
118
|
+
}}
|
|
119
119
|
/>
|
|
@@ -1,162 +1,162 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { textColor, borderColor, backgroundColor, boxShadow, chartColor } from '../../../tokens';
|
|
3
|
+
import Chart, { type GenericChartProps } from '../chart/Chart.svelte';
|
|
4
|
+
import type { EChartsOption, BarSeriesOption } from 'echarts';
|
|
5
|
+
import { createTooltipFormatter } from '../utils/tooltipFormatter';
|
|
6
|
+
import { Duration } from 'luxon';
|
|
7
|
+
import { formattedDurationCompact } from '../utils/duration';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
type DataItem = {
|
|
10
|
+
value: number;
|
|
11
|
+
[key: string]: string | number; // Allows other properties, like the one used for xAxisName
|
|
12
|
+
};
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
interface BarChartProps extends Omit<GenericChartProps, 'timeIndex'> {
|
|
15
|
+
data: DataItem[];
|
|
16
|
+
colors?: Record<string, string>; // Optional: Color mapping per x-axis category
|
|
17
|
+
rotateXAxisLabels?: boolean;
|
|
18
|
+
grid?: EChartsOption['grid'];
|
|
19
|
+
captureInterval?: number;
|
|
20
|
+
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
let {
|
|
23
|
+
data,
|
|
24
|
+
colors,
|
|
25
|
+
rotateXAxisLabels = false,
|
|
26
|
+
xAxisName,
|
|
27
|
+
yAxisName,
|
|
28
|
+
captureInterval,
|
|
29
|
+
...props
|
|
30
|
+
}: BarChartProps = $props();
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
const defaultColors: Record<string, string> = {
|
|
33
|
+
accent: chartColor['accent'],
|
|
34
|
+
blue: chartColor['blue'],
|
|
35
|
+
orange: chartColor['orange'],
|
|
36
|
+
plum: chartColor['plum'],
|
|
37
|
+
sky: chartColor['sky'],
|
|
38
|
+
pear: chartColor['pear'],
|
|
39
|
+
pink: chartColor['pink'],
|
|
40
|
+
lilac: chartColor['lilac'],
|
|
41
|
+
lime: chartColor['lime'],
|
|
42
|
+
};
|
|
43
|
+
const defaultColorRotationArray = $derived(Object.values(defaultColors));
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
const xAxisData = $derived(data.map((item) => item[xAxisName]));
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
: undefined;
|
|
47
|
+
const captureIntervals = captureInterval
|
|
48
|
+
? Array(data.length)
|
|
49
|
+
.fill(null)
|
|
50
|
+
.map((_, timeIndex) => {
|
|
51
|
+
const seconds = timeIndex * captureInterval;
|
|
52
|
+
return formattedDurationCompact(seconds);
|
|
53
|
+
})
|
|
54
|
+
: undefined;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
const createBarDataItem = (value: number | null, color: string) => ({
|
|
57
|
+
value,
|
|
58
|
+
itemStyle: {
|
|
59
|
+
color,
|
|
60
|
+
borderRadius: 2,
|
|
61
|
+
borderWidth: 0.5,
|
|
62
|
+
borderColor: borderColor['white'],
|
|
63
|
+
},
|
|
64
|
+
emphasis: {
|
|
65
|
+
disabled: true,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
const chartSeries: BarSeriesOption[] = $derived.by(() => {
|
|
70
|
+
const seriesData = data.map((item) => item.value);
|
|
71
|
+
const seriesColors = data.map(
|
|
72
|
+
(item, index) =>
|
|
73
|
+
colors?.[item[xAxisName] as string] ??
|
|
74
|
+
defaultColorRotationArray[index % defaultColorRotationArray.length]
|
|
75
|
+
);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
const singleSeries: BarSeriesOption[] = [
|
|
78
|
+
{
|
|
79
|
+
name: yAxisName,
|
|
80
|
+
type: 'bar',
|
|
81
|
+
data: seriesData.map((value, index) => createBarDataItem(value, seriesColors[index])),
|
|
82
|
+
emphasis: { disabled: true },
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
return singleSeries;
|
|
86
|
+
});
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const formatTooltip = createTooltipFormatter({
|
|
89
|
+
yAxisName: yAxisName,
|
|
90
|
+
yAxisUnit: props.yAxisUnit,
|
|
91
|
+
});
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
93
|
+
const options: EChartsOption = $derived.by(() => {
|
|
94
|
+
return {
|
|
95
|
+
tooltip: {
|
|
96
|
+
trigger: 'axis',
|
|
97
|
+
axisPointer: {
|
|
98
|
+
type: 'shadow',
|
|
99
|
+
shadowStyle: {
|
|
100
|
+
color: backgroundColor['neutral'],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
borderWidth: 0,
|
|
104
|
+
borderRadius: 6,
|
|
105
|
+
extraCssText: `box-shadow: ${boxShadow.menu}`,
|
|
106
|
+
formatter: formatTooltip,
|
|
107
|
+
},
|
|
108
|
+
grid: {
|
|
109
|
+
containLabel: true,
|
|
110
|
+
left: 0,
|
|
111
|
+
right: 16,
|
|
112
|
+
bottom: 16,
|
|
113
|
+
top: 16,
|
|
114
|
+
},
|
|
115
|
+
xAxis: {
|
|
116
|
+
type: 'category',
|
|
117
|
+
data: captureIntervals || xAxisData,
|
|
118
|
+
axisTick: {
|
|
119
|
+
show: false,
|
|
120
|
+
alignWithLabel: true,
|
|
121
|
+
},
|
|
122
|
+
axisLabel: {
|
|
123
|
+
fontSize: 11,
|
|
124
|
+
color: textColor['secondary'],
|
|
125
|
+
show: true,
|
|
126
|
+
...(rotateXAxisLabels
|
|
127
|
+
? { rotate: 90, overflow: 'break', width: 60, padding: [0, 40, 0, 0] }
|
|
128
|
+
: { rotate: 0, overflow: 'truncate', ellipsis: '...', width: 80 }),
|
|
129
|
+
},
|
|
130
|
+
axisLine: {
|
|
131
|
+
lineStyle: {
|
|
132
|
+
color: borderColor['axis'],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
yAxis: {
|
|
137
|
+
type: 'value',
|
|
138
|
+
axisLabel: {
|
|
139
|
+
fontSize: 11,
|
|
140
|
+
color: textColor['secondary'],
|
|
141
|
+
},
|
|
142
|
+
axisLine: {
|
|
143
|
+
show: false,
|
|
144
|
+
},
|
|
145
|
+
splitLine: {
|
|
146
|
+
lineStyle: {
|
|
147
|
+
color: borderColor['input'],
|
|
148
|
+
type: 'dashed',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
textStyle: {
|
|
153
|
+
color: textColor['secondary'],
|
|
154
|
+
fontFamily: 'af Another Sans',
|
|
155
|
+
},
|
|
156
|
+
series: chartSeries,
|
|
157
|
+
color: defaultColorRotationArray,
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
160
|
</script>
|
|
161
161
|
|
|
162
162
|
<Chart {options} {...props} {xAxisName} {yAxisName} />
|
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
<script lang="ts" context="module">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { textColor } from '../../../tokens';
|
|
4
|
+
import StackedBarChart from './StackedBarChart.svelte';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Design System/Graphs/StackedBarChart',
|
|
8
|
+
component: StackedBarChart,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
});
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const stackedChartProps = {
|
|
13
|
+
xAxisCategories: ['ID 1', 'ID 2', 'ID 3', 'ID 4'],
|
|
14
|
+
series: [
|
|
15
|
+
{ name: 'Halo', data: [100, 132, 101, 134] },
|
|
16
|
+
{ name: 'Spot', data: [220, 182, 191, 234] },
|
|
17
|
+
{ name: 'Microbial', data: [150, 232, 201, 154] },
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const seriesColors = {
|
|
22
|
+
Halo: textColor['icon-warning'],
|
|
23
|
+
Spot: textColor['icon-tertiary'],
|
|
24
|
+
Microbial: textColor['icon-lime'],
|
|
25
|
+
};
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<Story
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
name="Default Colors"
|
|
30
|
+
args={{ ...stackedChartProps, height: '400px', xAxisName: 'ID', yAxisName: 'Count' }}
|
|
31
31
|
/>
|
|
32
32
|
|
|
33
33
|
<Story
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
name="Custom Colors"
|
|
35
|
+
args={{
|
|
36
|
+
...stackedChartProps,
|
|
37
|
+
height: '400px',
|
|
38
|
+
colors: seriesColors,
|
|
39
|
+
xAxisName: 'ID',
|
|
40
|
+
yAxisName: 'Count',
|
|
41
|
+
}}
|
|
42
42
|
/>
|
|
43
43
|
|
|
44
44
|
<Story
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
name="With Capture Interval"
|
|
46
|
+
args={{
|
|
47
|
+
xAxisCategories: ['0', '1', '2', '3', '4', '5', '6'],
|
|
48
|
+
series: [
|
|
49
|
+
{ name: 'Halo', data: [120, 132, 101, 134, 90, 230, 210] },
|
|
50
|
+
{ name: 'Spot', data: [220, 182, 191, 234, 290, 330, 310] },
|
|
51
|
+
{ name: 'Microbial', data: [150, 232, 201, 154, 190, 330, 410] },
|
|
52
|
+
],
|
|
53
|
+
height: '400px',
|
|
54
|
+
xAxisName: 'Time',
|
|
55
|
+
yAxisName: 'Count',
|
|
56
|
+
captureInterval: 3600,
|
|
57
|
+
}}
|
|
58
58
|
/>
|
|
59
59
|
|
|
60
60
|
<Story
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
name="With Capture Interval - Short Duration"
|
|
62
|
+
args={{
|
|
63
|
+
xAxisCategories: ['0', '1', '2', '3', '4', '5', '6'],
|
|
64
|
+
series: [
|
|
65
|
+
{ name: 'Halo', data: [120, 132, 101, 134, 90, 230, 210] },
|
|
66
|
+
{ name: 'Spot', data: [220, 182, 191, 234, 290, 330, 310] },
|
|
67
|
+
{ name: 'Microbial', data: [150, 232, 201, 154, 190, 330, 410] },
|
|
68
|
+
],
|
|
69
|
+
height: '400px',
|
|
70
|
+
xAxisName: 'Time',
|
|
71
|
+
yAxisName: 'Count',
|
|
72
|
+
captureInterval: 600,
|
|
73
|
+
}}
|
|
74
74
|
/>
|