blixify-ui-web-mcp 0.1.2 → 0.1.18
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/lib/components/action/button/README.md +12 -11
- package/lib/components/action/button/button.stories.tsx +4 -10
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +4 -10
- package/lib/components/action/iconButton/iconButton.stories.tsx +4 -10
- package/lib/components/action/radioList/radioList.stories.tsx +4 -10
- package/lib/components/action/slider/slider.stories.tsx +4 -10
- package/lib/components/action/textButton/textButton.stories.tsx +4 -10
- package/lib/components/action/toggle/toggle.stories.tsx +4 -10
- package/lib/components/advanced/collapse/collapse.stories.tsx +4 -10
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +4 -10
- package/lib/components/advanced/popUp/README.md +21 -7
- package/lib/components/advanced/popUp/popUp.stories.tsx +4 -10
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +30 -10
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +4 -10
- package/lib/components/auth/signIn/signIn.stories.tsx +4 -10
- package/lib/components/auth/signUp/signUp.stories.tsx +4 -10
- package/lib/components/chart/areaChart/areaChart.stories.tsx +7 -13
- package/lib/components/chart/barChart/barChart.stories.tsx +7 -13
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +8 -14
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +8 -14
- package/lib/components/chart/card/card.stories.tsx +4 -10
- package/lib/components/chart/ganttChart/README.md +96 -110
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +135 -125
- package/lib/components/chart/heatmapChart/README.md +93 -82
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +122 -84
- package/lib/components/chart/lineChart/lineChart.stories.tsx +4 -10
- package/lib/components/chart/pieChart/pieChart.stories.tsx +4 -10
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +8 -14
- package/lib/components/chart/radarChart/radarChart.stories.tsx +4 -10
- package/lib/components/chart/radialBar/radialChart.stories.tsx +4 -10
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +4 -10
- package/lib/components/chart/statsCard/statsCard.stories.tsx +4 -10
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +8 -14
- package/lib/components/chat/chatAnchor/README.md +61 -79
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +13 -19
- package/lib/components/chat/chatBase/README.md +244 -196
- package/lib/components/chat/chatBase/chatBase.stories.tsx +828 -250
- package/lib/components/chat/chatDashboard/README.md +89 -129
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +406 -117
- package/lib/components/data/dataGraph/README.md +135 -1
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +90 -77
- package/lib/components/data/dataReference/README.md +141 -43
- package/lib/components/data/dataReference/dataReference.stories.tsx +111 -45
- package/lib/components/data/dataTemplate/README.md +88 -61
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +4 -10
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +4 -10
- package/lib/components/data/dataWrapper/README.md +48 -46
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +258 -489
- package/lib/components/data/queryForm/queryForm.stories.tsx +4 -10
- package/lib/components/data/readQuery/readQuery.stories.tsx +4 -9
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +4 -10
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +4 -8
- package/lib/components/design/actionSection/actionSection.stories.tsx +6 -10
- package/lib/components/design/banner/banner.stories.tsx +4 -10
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +4 -10
- package/lib/components/design/blogSection/blogSection.stories.tsx +4 -10
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +4 -10
- package/lib/components/design/designList/designList.stories.tsx +4 -10
- package/lib/components/design/faq/faq.stories.tsx +4 -10
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +4 -10
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +4 -10
- package/lib/components/design/footerSection/footerSection.stories.tsx +4 -10
- package/lib/components/design/googleReview/googleReview.stories.tsx +4 -10
- package/lib/components/design/heroSection/heroSection.stories.tsx +4 -10
- package/lib/components/design/iconList/iconList.stories.tsx +4 -10
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +4 -10
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +4 -10
- package/lib/components/design/leftContent/leftContent.stories.tsx +4 -10
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +4 -10
- package/lib/components/design/onboarding/onboarding.stories.tsx +4 -10
- package/lib/components/design/pricing/pricing.stories.tsx +4 -10
- package/lib/components/design/rightContent/rightContent.stories.tsx +4 -10
- package/lib/components/design/sectionList/sectionList.stories.tsx +4 -10
- package/lib/components/design/teams/teams.stories.tsx +4 -10
- package/lib/components/display/alert/alert.stories.tsx +4 -10
- package/lib/components/display/calendar/README.md +49 -0
- package/lib/components/display/calendar/calendar.stories.tsx +71 -28
- package/lib/components/display/clipboard/clipboard.stories.tsx +4 -10
- package/lib/components/display/detailList/detailList.stories.tsx +5 -10
- package/lib/components/display/drawer/drawer.stories.tsx +5 -10
- package/lib/components/display/emptyState/emptyState.stories.tsx +4 -10
- package/lib/components/display/feeds/feeds.stories.tsx +4 -10
- package/lib/components/display/flexTable/README.md +11 -7
- package/lib/components/display/flexTable/flexTable.stories.tsx +114 -11
- package/lib/components/display/grid/README.md +28 -27
- package/lib/components/display/grid/grid.stories.tsx +4 -10
- package/lib/components/display/kanban/kanban.stories.tsx +14 -20
- package/lib/components/display/list/README.md +30 -29
- package/lib/components/display/list/list.stories.tsx +4 -10
- package/lib/components/display/loading/loading.stories.tsx +5 -10
- package/lib/components/display/mapView/mapView.stories.tsx +4 -10
- package/lib/components/display/modal/modal.stories.tsx +4 -11
- package/lib/components/display/notification/notification.stories.tsx +4 -10
- package/lib/components/display/progress/progress.stories.tsx +5 -10
- package/lib/components/display/stepper/stepper.stories.tsx +5 -10
- package/lib/components/display/table/README.md +38 -37
- package/lib/components/display/table/table.stories.tsx +8 -14
- package/lib/components/display/tag/tag.stories.tsx +4 -10
- package/lib/components/input/address/address.stories.tsx +4 -10
- package/lib/components/input/canvas/canvas.stories.tsx +4 -10
- package/lib/components/input/checkbox/checkbox.stories.tsx +4 -10
- package/lib/components/input/datePicker/datePicker.stories.tsx +4 -10
- package/lib/components/input/form/form.stories.tsx +4 -10
- package/lib/components/input/markdown/markdown.stories.tsx +5 -10
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +4 -10
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +4 -10
- package/lib/components/input/rating/rating.stories.tsx +4 -10
- package/lib/components/input/select/README.md +30 -29
- package/lib/components/input/select/select.stories.tsx +4 -10
- package/lib/components/input/signature/signature.stories.tsx +4 -10
- package/lib/components/input/textArea/textArea.stories.tsx +4 -10
- package/lib/components/input/textInput/textinput.stories.tsx +4 -10
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +135 -11
- package/lib/components/navigation/bars/README.md +90 -17
- package/lib/components/navigation/bars/bars.stories.tsx +128 -60
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +5 -10
- package/lib/components/navigation/breadcrumb/README.md +40 -20
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +34 -14
- package/lib/components/navigation/header/README.md +67 -108
- package/lib/components/navigation/header/header.stories.tsx +165 -49
- package/lib/components/navigation/leftNav/README.md +121 -66
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +178 -91
- package/lib/components/navigation/tabs/tabs.stories.tsx +57 -39
- package/lib/components/structure/column/column.stories.tsx +5 -10
- package/lib/components/structure/container/container.stories.tsx +5 -10
- package/lib/components/structure/link/link.stories.tsx +4 -10
- package/lib/components/structure/text/text.stories.tsx +5 -10
- package/lib/components/template/authPage/authPage.stories.tsx +6 -5
- package/lib/components/template/landingPage/landingPage.stories.tsx +8 -6
- package/lib/components/template/productListing/productListing.stories.tsx +7 -13
- package/lib/components/template/productOverview/productOverview.stories.tsx +5 -11
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +6 -12
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +7 -6
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +5 -11
- package/package.json +1 -1
|
@@ -4,53 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
6
6
|
|
|
7
|
-
A heatmap chart
|
|
7
|
+
A heatmap chart for visualising data density across two dimensions. Each cell is colour-coded by value using a built-in four-range scale (Low → Medium → High → Very High). Supports multi-series data, dark mode, date range filtering, and a clickable title link.
|
|
8
8
|
|
|
9
9
|
##### Import
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { HeatmapChart } from "blixify-ui-web/
|
|
12
|
+
import { HeatmapChart } from "blixify-ui-web/components/chart/heatmapChart";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
##### Usage
|
|
16
16
|
|
|
17
|
+
Basic multi-series heatmap:
|
|
18
|
+
|
|
17
19
|
```jsx
|
|
18
20
|
const multiSeriesData = [
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160,
|
|
23
|
-
170, 180,
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "Metric2",
|
|
28
|
-
data: [
|
|
29
|
-
15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165,
|
|
30
|
-
175, 185,
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "Metric3",
|
|
35
|
-
data: [
|
|
36
|
-
20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170,
|
|
37
|
-
180, 190,
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "Metric4",
|
|
42
|
-
data: [
|
|
43
|
-
25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175,
|
|
44
|
-
185, 195,
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "Metric5",
|
|
49
|
-
data: [
|
|
50
|
-
30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180,
|
|
51
|
-
190, 200,
|
|
52
|
-
],
|
|
53
|
-
},
|
|
21
|
+
{ name: "Week 1", data: [10, 45, 80, 120, 5, 60, 30, 95, 15, 70, 40, 110] },
|
|
22
|
+
{ name: "Week 2", data: [20, 55, 90, 10, 75, 35, 100, 25, 85, 50, 130, 65] },
|
|
23
|
+
{ name: "Week 3", data: [5, 30, 60, 95, 40, 115, 20, 80, 45, 105, 15, 70] },
|
|
54
24
|
];
|
|
55
25
|
|
|
56
26
|
const categories = [
|
|
@@ -66,39 +36,51 @@ const categories = [
|
|
|
66
36
|
"Oct",
|
|
67
37
|
"Nov",
|
|
68
38
|
"Dec",
|
|
69
|
-
"Q1",
|
|
70
|
-
"Q2",
|
|
71
|
-
"Q3",
|
|
72
|
-
"Q4",
|
|
73
|
-
"Y1",
|
|
74
|
-
"Y2",
|
|
75
39
|
];
|
|
76
40
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
41
|
+
<HeatmapChart
|
|
42
|
+
title="Monthly Activity"
|
|
43
|
+
multiSeriesData={multiSeriesData}
|
|
44
|
+
categories={categories}
|
|
45
|
+
showDataLabel={true}
|
|
46
|
+
/>;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
With date range picker and toolbar:
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
<HeatmapChart
|
|
53
|
+
title="Activity Distribution"
|
|
54
|
+
multiSeriesData={multiSeriesData}
|
|
55
|
+
categories={categories}
|
|
56
|
+
showToolbar={true}
|
|
57
|
+
dateRangeVisible={true}
|
|
58
|
+
onChangeDate={(range) => console.log(range)}
|
|
59
|
+
/>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Dark mode:
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
<HeatmapChart
|
|
66
|
+
title="Activity Distribution"
|
|
67
|
+
multiSeriesData={multiSeriesData}
|
|
68
|
+
categories={categories}
|
|
69
|
+
darkMode={true}
|
|
70
|
+
darkModeBg="bg-gray-900"
|
|
71
|
+
/>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Chart only (no card wrapper):
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
<HeatmapChart
|
|
78
|
+
title="Minimal"
|
|
79
|
+
multiSeriesData={multiSeriesData}
|
|
80
|
+
categories={categories}
|
|
81
|
+
chartOnly={true}
|
|
82
|
+
containerStyle="h-64 w-full"
|
|
83
|
+
/>
|
|
102
84
|
```
|
|
103
85
|
|
|
104
86
|
##### Required props
|
|
@@ -109,17 +91,46 @@ return (
|
|
|
109
91
|
|
|
110
92
|
##### Optional props
|
|
111
93
|
|
|
112
|
-
| Name
|
|
113
|
-
|
|
|
114
|
-
| `multiSeriesData`
|
|
115
|
-
| `categories`
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
94
|
+
| Name | Type | Default | Description |
|
|
95
|
+
| ------------------ | ---------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------ |
|
|
96
|
+
| `multiSeriesData` | `SeriesItem[]` | — | Array of series — each becomes a row in the heatmap. See SeriesItem below. |
|
|
97
|
+
| `categories` | `string[] \| number[]` | — | X-axis category labels. Length should match the `data` array length in each series. |
|
|
98
|
+
| `showDataLabel` | `boolean` | `true` | Show or hide the numeric value label inside each cell |
|
|
99
|
+
| `showToolbar` | `boolean` | — | Show or hide the ApexCharts toolbar (download, zoom, etc.) |
|
|
100
|
+
| `borderColor` | `string` | `#e7e7e7` | Grid border color |
|
|
101
|
+
| `newTabUrl` | `string` | — | When set, wraps the chart title in a link to this URL |
|
|
102
|
+
| `onClick` | `(x: string, y: string, value: number) => void` | — | Called when a cell is clicked with its x category, y series name, and numeric value |
|
|
103
|
+
| `colors` | `string[]` | — | Custom color array. Falls back to `localStorage.localChartColors` then the built-in color scale. |
|
|
104
|
+
| `enableGradient` | `boolean` | `false` | Applies a gradient fill to cells |
|
|
105
|
+
| `darkMode` | `boolean` | `false` | Switches axis labels and text to white |
|
|
106
|
+
| `darkModeBg` | `string` | `bg-gray-900` | Tailwind bg class for the card background in dark mode |
|
|
107
|
+
| `dateRangeVisible` | `boolean` | `false` | Shows a date range picker below the chart |
|
|
108
|
+
| `customDate` | `RangeInterface` | — | Pre-selected date range passed to the date range picker |
|
|
109
|
+
| `onChangeDate` | `(date?: RangeInterface) => void` | — | Called when the date range picker value changes |
|
|
110
|
+
| `chartSize` | `number` | `280` | Chart height in pixels |
|
|
111
|
+
| `chartOnly` | `boolean` | `false` | Renders only the chart with no card wrapper. Use `containerStyle` to size the container. |
|
|
112
|
+
| `containerStyle` | `string` | — | Tailwind classes applied to the outer container |
|
|
113
|
+
| `tool` | `ReactElement` | — | Extra element rendered in the top-right of the chart header |
|
|
114
|
+
| `minInterval` | `number` | — | Minimum interval for the date range picker |
|
|
115
|
+
| `linkType` | `"react" \| "gatsby" \| "next" \| "external" \| "default"` | — | Router adapter used when `newTabUrl` is set |
|
|
116
|
+
| `custom` | `any` | — | Custom link component used when `linkType` is `"react"`, `"gatsby"`, or `"next"` |
|
|
117
|
+
|
|
118
|
+
##### Built-in colour scale
|
|
119
|
+
|
|
120
|
+
The heatmap uses a fixed four-range colour scale by default:
|
|
121
|
+
|
|
122
|
+
| Range | Colour | Label |
|
|
123
|
+
| --------- | --------- | --------- |
|
|
124
|
+
| 0 – 10 | `#00A100` | Low |
|
|
125
|
+
| 11 – 50 | `#128FD9` | Medium |
|
|
126
|
+
| 51 – 100 | `#FFB200` | High |
|
|
127
|
+
| 101 – 200 | `#FF4560` | Very High |
|
|
128
|
+
|
|
129
|
+
Pass `colors` to override this scale with ApexCharts' default colour assignment.
|
|
130
|
+
|
|
131
|
+
##### SeriesItem
|
|
132
|
+
|
|
133
|
+
| Name | Type | Description |
|
|
134
|
+
| ------ | ---------- | ---------------------------------------------------------- |
|
|
135
|
+
| `name` | `string` | Row label shown on the y-axis |
|
|
136
|
+
| `data` | `number[]` | Numeric values for each x-axis category, in the same order |
|
|
@@ -1,106 +1,144 @@
|
|
|
1
|
-
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
1
|
import React, { useMemo } from "react";
|
|
4
2
|
import { HeatmapChart } from ".";
|
|
5
|
-
import
|
|
3
|
+
import { StorySection } from "../../storyUtils";
|
|
6
4
|
|
|
7
|
-
const
|
|
5
|
+
const meta = { title: "Chart/Heatmap Chart" };
|
|
6
|
+
export default meta;
|
|
8
7
|
|
|
9
|
-
stories.addParameters({
|
|
10
|
-
readme: {
|
|
11
|
-
content: README,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
const categories = [
|
|
10
|
+
"Jan",
|
|
11
|
+
"Feb",
|
|
12
|
+
"Mar",
|
|
13
|
+
"Apr",
|
|
14
|
+
"May",
|
|
15
|
+
"Jun",
|
|
16
|
+
"Jul",
|
|
17
|
+
"Aug",
|
|
18
|
+
"Sep",
|
|
19
|
+
"Oct",
|
|
20
|
+
"Nov",
|
|
21
|
+
"Dec",
|
|
22
|
+
];
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const rand = (min: number, max: number) =>
|
|
25
|
+
Math.floor(Math.random() * (max - min + 1)) + min;
|
|
26
|
+
|
|
27
|
+
export const HeatmapChartStory = () => {
|
|
31
28
|
const multiSeriesData = useMemo(
|
|
32
29
|
() => [
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "Metric2",
|
|
39
|
-
data: generateData(18, { min: 0, max: 90 }),
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "Metric3",
|
|
43
|
-
data: generateData(18, { min: 0, max: 90 }),
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "Metric4",
|
|
47
|
-
data: generateData(18, { min: 0, max: 90 }),
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: "Metric5",
|
|
51
|
-
data: generateData(18, { min: 0, max: 90 }),
|
|
52
|
-
},
|
|
30
|
+
{ name: "Week 1", data: categories.map(() => rand(0, 90)) },
|
|
31
|
+
{ name: "Week 2", data: categories.map(() => rand(0, 90)) },
|
|
32
|
+
{ name: "Week 3", data: categories.map(() => rand(0, 90)) },
|
|
33
|
+
{ name: "Week 4", data: categories.map(() => rand(0, 90)) },
|
|
34
|
+
{ name: "Week 5", data: categories.map(() => rand(0, 90)) },
|
|
53
35
|
],
|
|
54
36
|
[]
|
|
55
37
|
);
|
|
56
38
|
|
|
57
|
-
const
|
|
39
|
+
const wideSeriesData = useMemo(
|
|
58
40
|
() => [
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"Apr",
|
|
63
|
-
"May",
|
|
64
|
-
"Jun",
|
|
65
|
-
"Jul",
|
|
66
|
-
"Aug",
|
|
67
|
-
"Sep",
|
|
68
|
-
"Oct",
|
|
69
|
-
"Nov",
|
|
70
|
-
"Dec",
|
|
71
|
-
"Q1",
|
|
72
|
-
"Q2",
|
|
73
|
-
"Q3",
|
|
74
|
-
"Q4",
|
|
75
|
-
"Y1",
|
|
76
|
-
"Y2",
|
|
41
|
+
{ name: "Metric A", data: categories.map(() => rand(0, 200)) },
|
|
42
|
+
{ name: "Metric B", data: categories.map(() => rand(0, 200)) },
|
|
43
|
+
{ name: "Metric C", data: categories.map(() => rand(0, 200)) },
|
|
77
44
|
],
|
|
78
45
|
[]
|
|
79
46
|
);
|
|
80
47
|
|
|
81
48
|
return (
|
|
82
49
|
<>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
50
|
+
<StorySection
|
|
51
|
+
title="Default"
|
|
52
|
+
description="Each SeriesItem becomes a row. Values are colour-coded by the built-in scale: green (0–10), blue (11–50), amber (51–100), red (101–200). showDataLabel shows the numeric value inside each cell."
|
|
53
|
+
>
|
|
54
|
+
<div className="w-full">
|
|
55
|
+
<HeatmapChart
|
|
56
|
+
title="Monthly Activity"
|
|
57
|
+
multiSeriesData={multiSeriesData}
|
|
58
|
+
categories={categories}
|
|
59
|
+
showDataLabel={true}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</StorySection>
|
|
63
|
+
|
|
64
|
+
<StorySection
|
|
65
|
+
title="Full Colour Scale"
|
|
66
|
+
description="Values spanning all four ranges (0–200) show the complete built-in colour scale in one chart."
|
|
67
|
+
>
|
|
68
|
+
<div className="w-full">
|
|
69
|
+
<HeatmapChart
|
|
70
|
+
title="Full Range Metrics"
|
|
71
|
+
multiSeriesData={wideSeriesData}
|
|
72
|
+
categories={categories}
|
|
73
|
+
showDataLabel={true}
|
|
74
|
+
showToolbar={true}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
</StorySection>
|
|
78
|
+
|
|
79
|
+
<StorySection
|
|
80
|
+
title="With Date Range Picker"
|
|
81
|
+
description="dateRangeVisible=true shows a date range picker below the chart. onChangeDate is called when the range changes."
|
|
82
|
+
>
|
|
83
|
+
<div className="w-full">
|
|
84
|
+
<HeatmapChart
|
|
85
|
+
title="Activity Over Time"
|
|
86
|
+
multiSeriesData={multiSeriesData}
|
|
87
|
+
categories={categories}
|
|
88
|
+
showDataLabel={false}
|
|
89
|
+
dateRangeVisible={true}
|
|
90
|
+
onChangeDate={(range) => console.log("Date range changed", range)}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</StorySection>
|
|
94
|
+
|
|
95
|
+
<StorySection
|
|
96
|
+
title="Clickable Title Link"
|
|
97
|
+
description="newTabUrl wraps the chart title in a link. Useful for navigating to a detail page from a dashboard."
|
|
98
|
+
>
|
|
99
|
+
<div className="w-full">
|
|
100
|
+
<HeatmapChart
|
|
101
|
+
title="Activity (click title)"
|
|
102
|
+
multiSeriesData={multiSeriesData}
|
|
103
|
+
categories={categories}
|
|
104
|
+
showDataLabel={true}
|
|
105
|
+
newTabUrl="https://www.google.com/"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</StorySection>
|
|
109
|
+
|
|
110
|
+
<StorySection
|
|
111
|
+
title="Dark Mode"
|
|
112
|
+
description="darkMode=true switches axis labels and text to white. darkModeBg sets the card background colour."
|
|
113
|
+
dark
|
|
114
|
+
>
|
|
115
|
+
<div className="w-full">
|
|
116
|
+
<HeatmapChart
|
|
117
|
+
title="Activity Distribution"
|
|
118
|
+
multiSeriesData={multiSeriesData}
|
|
119
|
+
categories={categories}
|
|
120
|
+
showDataLabel={true}
|
|
121
|
+
darkMode={true}
|
|
122
|
+
darkModeBg="bg-gray-900"
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
</StorySection>
|
|
92
126
|
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
127
|
+
<StorySection
|
|
128
|
+
title="Chart Only"
|
|
129
|
+
description="chartOnly=true strips the card wrapper and renders just the chart. Use containerStyle to control dimensions."
|
|
130
|
+
>
|
|
131
|
+
<div className="w-full h-64">
|
|
132
|
+
<HeatmapChart
|
|
133
|
+
title="Minimal"
|
|
134
|
+
multiSeriesData={multiSeriesData}
|
|
135
|
+
categories={categories}
|
|
136
|
+
chartOnly={true}
|
|
137
|
+
containerStyle="h-64 w-full"
|
|
138
|
+
showDataLabel={false}
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</StorySection>
|
|
104
142
|
</>
|
|
105
143
|
);
|
|
106
|
-
}
|
|
144
|
+
}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
2
|
import React, { useCallback, useEffect, useState } from "react";
|
|
4
3
|
import { LineChart } from ".";
|
|
5
4
|
import { RangeInterface } from "../DateRange";
|
|
6
|
-
import README from "./README.md";
|
|
7
5
|
import { StorySection } from "../../storyUtils";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const meta = { title: "Chart/Line Chart" };
|
|
8
|
+
export default meta;
|
|
10
9
|
|
|
11
|
-
stories.addParameters({
|
|
12
|
-
readme: {
|
|
13
|
-
content: README,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
10
|
|
|
17
11
|
const multiLineSeries = [
|
|
18
12
|
{ name: "High - 2013", data: [-50, 29.1, 33.453, 60.09, 32, 32, 90] },
|
|
19
13
|
{ name: "Low - 2013", data: [12, 60, 14, 18, 17, 70, 13] },
|
|
20
14
|
];
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
export const LineChartStory = () => {
|
|
23
17
|
const [seriesData, setSeriesData] = useState([12, 60, 14, 18, 17]);
|
|
24
18
|
const [categoryData, setCategoryData] = useState<string[]>([
|
|
25
19
|
"JAN",
|
|
@@ -149,4 +143,4 @@ stories.add("Line Chart", () => {
|
|
|
149
143
|
</StorySection>
|
|
150
144
|
</div>
|
|
151
145
|
);
|
|
152
|
-
}
|
|
146
|
+
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { PieChart } from ".";
|
|
5
4
|
import { StorySection } from "../../storyUtils";
|
|
6
5
|
import { RangeInterface } from "../DateRange";
|
|
7
|
-
import README from "./README.md";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const meta = { title: "Chart/Pie Chart" };
|
|
8
|
+
export default meta;
|
|
10
9
|
|
|
11
|
-
stories.addParameters({
|
|
12
|
-
readme: {
|
|
13
|
-
content: README,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
10
|
|
|
17
11
|
const dummyData = [
|
|
18
12
|
{ label: "Apple", value: 10 },
|
|
@@ -25,7 +19,7 @@ const dummyData = [
|
|
|
25
19
|
const series = dummyData.map((d) => d.value);
|
|
26
20
|
const labels = dummyData.map((d) => d.label);
|
|
27
21
|
|
|
28
|
-
|
|
22
|
+
export const PieChartStory = () => {
|
|
29
23
|
const [seriesData, setSeriesData] = useState<number[]>([]);
|
|
30
24
|
const [labelData, setLabelData] = useState<string[]>([]);
|
|
31
25
|
|
|
@@ -177,4 +171,4 @@ stories.add("Pie Chart", () => {
|
|
|
177
171
|
</StorySection>
|
|
178
172
|
</>
|
|
179
173
|
);
|
|
180
|
-
}
|
|
174
|
+
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import
|
|
3
|
-
import moment from "moment";
|
|
2
|
+
import dayjs from "../../dayjs";
|
|
4
3
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
4
|
import { PolarAreaChart } from ".";
|
|
6
5
|
import { RangeInterface } from "../DateRange";
|
|
7
|
-
import README from "./README.md";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const meta = { title: "Chart/Polar Area Chart" };
|
|
8
|
+
export default meta;
|
|
10
9
|
|
|
11
|
-
stories.addParameters({
|
|
12
|
-
readme: {
|
|
13
|
-
content: README,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
export const PolarAreaChartStory = () => {
|
|
18
12
|
const [seriesData, setSeriesData] = useState<any[]>([]);
|
|
19
13
|
|
|
20
14
|
const chartDummyData = useMemo(() => {
|
|
@@ -63,7 +57,7 @@ stories.add("Polar Area Chart", () => {
|
|
|
63
57
|
}, [handleSetData]);
|
|
64
58
|
|
|
65
59
|
const sevenDaysAgo = new Date();
|
|
66
|
-
sevenDaysAgo.setDate(
|
|
60
|
+
sevenDaysAgo.setDate(dayjs().toDate().getDate() - 7);
|
|
67
61
|
|
|
68
62
|
return (
|
|
69
63
|
<>
|
|
@@ -76,7 +70,7 @@ stories.add("Polar Area Chart", () => {
|
|
|
76
70
|
dateRangeVisible={true}
|
|
77
71
|
customDate={{
|
|
78
72
|
startDate: sevenDaysAgo,
|
|
79
|
-
endDate:
|
|
73
|
+
endDate: dayjs().toDate(),
|
|
80
74
|
isDuration: true,
|
|
81
75
|
}}
|
|
82
76
|
onChangeDate={handleSetData}
|
|
@@ -92,7 +86,7 @@ stories.add("Polar Area Chart", () => {
|
|
|
92
86
|
dateRangeVisible={true}
|
|
93
87
|
customDate={{
|
|
94
88
|
startDate: sevenDaysAgo,
|
|
95
|
-
endDate:
|
|
89
|
+
endDate: dayjs().toDate(),
|
|
96
90
|
isDuration: true,
|
|
97
91
|
}}
|
|
98
92
|
onChangeDate={handleSetData}
|
|
@@ -103,4 +97,4 @@ stories.add("Polar Area Chart", () => {
|
|
|
103
97
|
/>
|
|
104
98
|
</>
|
|
105
99
|
);
|
|
106
|
-
}
|
|
100
|
+
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { storiesOf } from "@storybook/react";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { RadarChart } from ".";
|
|
4
|
-
import README from "./README.md";
|
|
5
3
|
|
|
6
|
-
const
|
|
4
|
+
const meta = { title: "Chart/Radar Chart" };
|
|
5
|
+
export default meta;
|
|
7
6
|
|
|
8
|
-
stories.addParameters({
|
|
9
|
-
readme: {
|
|
10
|
-
content: README,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
7
|
|
|
14
|
-
|
|
8
|
+
export const RadarChartStory = () => {
|
|
15
9
|
return (
|
|
16
10
|
<RadarChart
|
|
17
11
|
title={"Test Chart"}
|
|
@@ -33,4 +27,4 @@ stories.add("Radar Chart", () => {
|
|
|
33
27
|
onChangeDate={() => {}}
|
|
34
28
|
/>
|
|
35
29
|
);
|
|
36
|
-
}
|
|
30
|
+
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { RadialBar } from ".";
|
|
5
4
|
import { RangeInterface } from "../DateRange";
|
|
6
|
-
import README from "./README.md";
|
|
7
5
|
import colors from "tailwindcss/colors";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const meta = { title: "Chart/Radial Chart" };
|
|
8
|
+
export default meta;
|
|
10
9
|
|
|
11
|
-
stories.addParameters({
|
|
12
|
-
readme: {
|
|
13
|
-
content: README,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
export const RadialChart = () => {
|
|
18
12
|
const [seriesData, setSeriesData] = useState<number[]>([]);
|
|
19
13
|
const [labelData, setLabelData] = useState<string[]>([]);
|
|
20
14
|
|
|
@@ -133,4 +127,4 @@ stories.add("Radial Chart", () => {
|
|
|
133
127
|
/>
|
|
134
128
|
</div>
|
|
135
129
|
);
|
|
136
|
-
}
|
|
130
|
+
}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
-
import { storiesOf } from "@storybook/react";
|
|
3
2
|
import React, { useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { RangeBarChart } from ".";
|
|
5
|
-
import README from "./README.md";
|
|
6
4
|
|
|
7
|
-
const
|
|
5
|
+
const meta = { title: "Chart/Range Bar Chart" };
|
|
6
|
+
export default meta;
|
|
8
7
|
|
|
9
|
-
stories.addParameters({
|
|
10
|
-
readme: {
|
|
11
|
-
content: README,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
8
|
|
|
15
9
|
interface RangeData {
|
|
16
10
|
category: string;
|
|
17
11
|
value: [Date, Date];
|
|
18
12
|
}
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
export const RangeBarChartStory = () => {
|
|
21
15
|
const [rangeData, setRangeData] = useState<RangeData[]>([]);
|
|
22
16
|
|
|
23
17
|
const chartDummyData = useMemo((): RangeData[] => {
|
|
@@ -205,4 +199,4 @@ stories.add("Range Bar Chart", () => {
|
|
|
205
199
|
/>
|
|
206
200
|
</>
|
|
207
201
|
);
|
|
208
|
-
}
|
|
202
|
+
}
|