blixify-ui-web-mcp 0.1.1
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 +5 -0
- package/lib/components/action/button/README.md +75 -0
- package/lib/components/action/button/button.stories.tsx +138 -0
- package/lib/components/action/buttonGroup/README.md +79 -0
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
- package/lib/components/action/iconButton/README.md +39 -0
- package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
- package/lib/components/action/radioList/README.md +98 -0
- package/lib/components/action/radioList/radioList.stories.tsx +181 -0
- package/lib/components/action/slider/README.md +86 -0
- package/lib/components/action/slider/slider.stories.tsx +133 -0
- package/lib/components/action/textButton/README.md +34 -0
- package/lib/components/action/textButton/textButton.stories.tsx +16 -0
- package/lib/components/action/toggle/README.md +39 -0
- package/lib/components/action/toggle/toggle.stories.tsx +23 -0
- package/lib/components/advanced/collapse/README.md +106 -0
- package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
- package/lib/components/advanced/infoWindow/README.md +69 -0
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
- package/lib/components/advanced/popUp/README.md +95 -0
- package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
- package/lib/components/auth/bareSignIn/README.md +78 -0
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
- package/lib/components/auth/bareSignUp/README.md +130 -0
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
- package/lib/components/auth/signIn/README.md +53 -0
- package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
- package/lib/components/auth/signUp/README.md +136 -0
- package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
- package/lib/components/chart/README.md +13 -0
- package/lib/components/chart/areaChart/README.md +133 -0
- package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
- package/lib/components/chart/barChart/README.md +193 -0
- package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
- package/lib/components/chart/boxPlotChart/README.md +124 -0
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
- package/lib/components/chart/bubbleChart/README.md +166 -0
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
- package/lib/components/chart/card/README.md +107 -0
- package/lib/components/chart/card/card.stories.tsx +89 -0
- package/lib/components/chart/ganttChart/README.md +142 -0
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
- package/lib/components/chart/heatmapChart/README.md +125 -0
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
- package/lib/components/chart/lineChart/README.md +140 -0
- package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
- package/lib/components/chart/pieChart/README.md +117 -0
- package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
- package/lib/components/chart/polarAreaChart/README.md +126 -0
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
- package/lib/components/chart/radarChart/README.md +57 -0
- package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
- package/lib/components/chart/radialBar/README.md +152 -0
- package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
- package/lib/components/chart/rangeBarChart/README.md +323 -0
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
- package/lib/components/chart/statsCard/README.md +97 -0
- package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
- package/lib/components/chart/treemapChart/README.md +142 -0
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
- package/lib/components/chat/chatAnchor/README.md +113 -0
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
- package/lib/components/chat/chatBase/README.md +223 -0
- package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
- package/lib/components/chat/chatDashboard/README.md +161 -0
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
- package/lib/components/data/dataGraph/README.md +13 -0
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
- package/lib/components/data/dataReference/README.md +62 -0
- package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
- package/lib/components/data/dataTemplate/README.md +903 -0
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
- package/lib/components/data/dataWrapper/README.md +1077 -0
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
- package/lib/components/data/queryForm/README.md +56 -0
- package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
- package/lib/components/data/readQuery/README.md +282 -0
- package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
- package/lib/components/data/readQueryHoc/README.md +89 -0
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
- package/lib/components/data/writeQuery/README.md +178 -0
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
- package/lib/components/design/actionSection/README.md +47 -0
- package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
- package/lib/components/design/banner/README.md +43 -0
- package/lib/components/design/banner/banner.stories.tsx +34 -0
- package/lib/components/design/bannerAction/README.md +44 -0
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
- package/lib/components/design/blogSection/README.md +111 -0
- package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
- package/lib/components/design/carouselSection/README.md +82 -0
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
- package/lib/components/design/designList/README.md +60 -0
- package/lib/components/design/designList/designList.stories.tsx +44 -0
- package/lib/components/design/faq/README.md +121 -0
- package/lib/components/design/faq/faq.stories.tsx +103 -0
- package/lib/components/design/fileGrid/README.md +87 -0
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
- package/lib/components/design/fileViewer/README.md +40 -0
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
- package/lib/components/design/footerSection/README.md +62 -0
- package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
- package/lib/components/design/googleReview/README.md +45 -0
- package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
- package/lib/components/design/heroSection/README.md +48 -0
- package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
- package/lib/components/design/iconList/README.md +60 -0
- package/lib/components/design/iconList/iconList.stories.tsx +41 -0
- package/lib/components/design/imageGallery/README.md +56 -0
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
- package/lib/components/design/imageZoom/README.md +47 -0
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
- package/lib/components/design/leftContent/README.md +47 -0
- package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
- package/lib/components/design/logoCloud/README.md +42 -0
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
- package/lib/components/design/onboarding/README.md +100 -0
- package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
- package/lib/components/design/pricing/README.md +112 -0
- package/lib/components/design/pricing/pricing.stories.tsx +86 -0
- package/lib/components/design/rightContent/README.md +47 -0
- package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
- package/lib/components/design/sectionList/README.md +51 -0
- package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
- package/lib/components/design/teams/README.md +62 -0
- package/lib/components/design/teams/teams.stories.tsx +61 -0
- package/lib/components/display/alert/README.md +82 -0
- package/lib/components/display/alert/alert.stories.tsx +71 -0
- package/lib/components/display/calendar/README.md +113 -0
- package/lib/components/display/calendar/calendar.stories.tsx +159 -0
- package/lib/components/display/clipboard/README.md +36 -0
- package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
- package/lib/components/display/detailList/README.md +61 -0
- package/lib/components/display/detailList/detailList.stories.tsx +131 -0
- package/lib/components/display/drawer/README.md +74 -0
- package/lib/components/display/drawer/drawer.stories.tsx +66 -0
- package/lib/components/display/emptyState/README.md +38 -0
- package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
- package/lib/components/display/feeds/README.md +80 -0
- package/lib/components/display/feeds/feeds.stories.tsx +75 -0
- package/lib/components/display/flexTable/README.md +160 -0
- package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
- package/lib/components/display/grid/README.md +121 -0
- package/lib/components/display/grid/grid.stories.tsx +234 -0
- package/lib/components/display/kanban/README.md +78 -0
- package/lib/components/display/kanban/kanban.stories.tsx +133 -0
- package/lib/components/display/list/README.md +109 -0
- package/lib/components/display/list/list.stories.tsx +188 -0
- package/lib/components/display/loading/README.md +25 -0
- package/lib/components/display/loading/loading.stories.tsx +15 -0
- package/lib/components/display/mapView/README.md +99 -0
- package/lib/components/display/mapView/mapView.stories.tsx +225 -0
- package/lib/components/display/modal/README.md +43 -0
- package/lib/components/display/modal/modal.stories.tsx +81 -0
- package/lib/components/display/notification/README.md +43 -0
- package/lib/components/display/notification/notification.stories.tsx +30 -0
- package/lib/components/display/progress/README.md +25 -0
- package/lib/components/display/progress/progress.stories.tsx +15 -0
- package/lib/components/display/stepper/README.md +96 -0
- package/lib/components/display/stepper/stepper.stories.tsx +175 -0
- package/lib/components/display/table/README.md +176 -0
- package/lib/components/display/table/table.stories.tsx +330 -0
- package/lib/components/display/tag/README.md +74 -0
- package/lib/components/display/tag/tag.stories.tsx +79 -0
- package/lib/components/input/address/README.md +132 -0
- package/lib/components/input/address/address.stories.tsx +147 -0
- package/lib/components/input/canvas/README.md +131 -0
- package/lib/components/input/canvas/canvas.stories.tsx +165 -0
- package/lib/components/input/checkbox/README.md +61 -0
- package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
- package/lib/components/input/datePicker/README.md +124 -0
- package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
- package/lib/components/input/form/README.md +55 -0
- package/lib/components/input/form/form.stories.tsx +143 -0
- package/lib/components/input/markdown/README.md +146 -0
- package/lib/components/input/markdown/markdown.stories.tsx +40 -0
- package/lib/components/input/monthYearPicker/README.md +69 -0
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
- package/lib/components/input/netPromoterScore/README.md +52 -0
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
- package/lib/components/input/rating/README.md +51 -0
- package/lib/components/input/rating/rating.stories.tsx +30 -0
- package/lib/components/input/select/README.md +108 -0
- package/lib/components/input/select/select.stories.tsx +286 -0
- package/lib/components/input/signature/README.md +106 -0
- package/lib/components/input/signature/signature.stories.tsx +188 -0
- package/lib/components/input/textArea/README.md +55 -0
- package/lib/components/input/textArea/textArea.stories.tsx +30 -0
- package/lib/components/input/textInput/README.md +81 -0
- package/lib/components/input/textInput/textinput.stories.tsx +231 -0
- package/lib/components/input/uploadInput/README.md +134 -0
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
- package/lib/components/navigation/bars/README.md +40 -0
- package/lib/components/navigation/bars/bars.stories.tsx +85 -0
- package/lib/components/navigation/bottomTab/README.md +53 -0
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
- package/lib/components/navigation/breadcrumb/README.md +48 -0
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
- package/lib/components/navigation/header/README.md +149 -0
- package/lib/components/navigation/header/header.stories.tsx +107 -0
- package/lib/components/navigation/leftNav/README.md +91 -0
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
- package/lib/components/navigation/tabs/README.md +75 -0
- package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
- package/lib/components/structure/column/README.md +40 -0
- package/lib/components/structure/column/column.stories.tsx +26 -0
- package/lib/components/structure/container/README.md +34 -0
- package/lib/components/structure/container/container.stories.tsx +19 -0
- package/lib/components/structure/link/README.md +55 -0
- package/lib/components/structure/link/link.stories.tsx +30 -0
- package/lib/components/structure/text/README.md +42 -0
- package/lib/components/structure/text/text.stories.tsx +39 -0
- package/lib/components/template/authPage/authPage.stories.tsx +68 -0
- package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
- package/lib/components/template/productListing/productListing.stories.tsx +297 -0
- package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
- package/lib/mcp/server.d.ts +2 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +33 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
- package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getBackendComponent.js +119 -0
- package/lib/mcp/tools/getBackendComponent.js.map +1 -0
- package/lib/mcp/tools/getComponent.d.ts +17 -0
- package/lib/mcp/tools/getComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getComponent.js +118 -0
- package/lib/mcp/tools/getComponent.js.map +1 -0
- package/lib/mcp/tools/listComponents.d.ts +13 -0
- package/lib/mcp/tools/listComponents.d.ts.map +1 -0
- package/lib/mcp/tools/listComponents.js +113 -0
- package/lib/mcp/tools/listComponents.js.map +1 -0
- package/lib/mcp/tools/listTemplates.d.ts +13 -0
- package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
- package/lib/mcp/tools/listTemplates.js +68 -0
- package/lib/mcp/tools/listTemplates.js.map +1 -0
- package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
- package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
- package/lib/mcp/tools/suggestTemplate.js +212 -0
- package/lib/mcp/tools/suggestTemplate.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Radar Chart
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A radar chart component for displaying analytics data in radar chart chart. e.g: Analytics of performance
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { RadarChart } from "blixify-ui-web/lib";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
return (
|
|
19
|
+
<RadarChart
|
|
20
|
+
title={"Test Chart"}
|
|
21
|
+
darkMode={false}
|
|
22
|
+
data={[
|
|
23
|
+
{
|
|
24
|
+
name: "Seedlings",
|
|
25
|
+
data: [80, 50, 30, 40, 100, 20],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "Target",
|
|
29
|
+
data: [20, 30, 40, 80, 20, 80],
|
|
30
|
+
},
|
|
31
|
+
]}
|
|
32
|
+
labels={["NTR", "SRR", "SBR", "CWR", "CER", "STR"]}
|
|
33
|
+
colors={[colors.neutral[400], "#f5222d"]}
|
|
34
|
+
showLegend
|
|
35
|
+
legendPosition="right"
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
##### Required props
|
|
41
|
+
|
|
42
|
+
| Name | Type | Description |
|
|
43
|
+
| ---------- | ---------------------------------- | ------------------ |
|
|
44
|
+
| `series` | `{ name: string, data: number[] }` | Value of each data |
|
|
45
|
+
| `labels` | `string[]` | Name of each data |
|
|
46
|
+
| `title` | `string` | Title of the chart |
|
|
47
|
+
| `darkMode` | `boolean` | Dark mode |
|
|
48
|
+
|
|
49
|
+
##### Optional props
|
|
50
|
+
|
|
51
|
+
| Name | Type | Default | Description |
|
|
52
|
+
| ----------------- | --------- | ------- | -------------------------------- |
|
|
53
|
+
| `fillOpacity` | `number` | "" | |
|
|
54
|
+
| `legendPosition` | `string` | "" | "top", "right", "bottom", "left" |
|
|
55
|
+
| `showLegend` | `boolean` | `false` | Show Legend |
|
|
56
|
+
| `showDataLabels` | `boolean` | `false` | Show Data Labels |
|
|
57
|
+
| `showYaxisLabels` | `boolean` | `false` | Show Y Axis Labels |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { RadarChart } from ".";
|
|
4
|
+
import README from "./README.md";
|
|
5
|
+
|
|
6
|
+
const stories = storiesOf("Chart", module);
|
|
7
|
+
|
|
8
|
+
stories.addParameters({
|
|
9
|
+
readme: {
|
|
10
|
+
content: README,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
stories.add("Radar Chart", () => {
|
|
15
|
+
return (
|
|
16
|
+
<RadarChart
|
|
17
|
+
title={"Test Chart"}
|
|
18
|
+
darkMode={true}
|
|
19
|
+
data={[
|
|
20
|
+
{
|
|
21
|
+
name: "Seedlings",
|
|
22
|
+
data: [80, 50, 30, 40, 100, 20],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "Target",
|
|
26
|
+
data: [20, 30, 40, 80, 20, 80],
|
|
27
|
+
},
|
|
28
|
+
]}
|
|
29
|
+
labels={["NTR", "SRR", "SBR", "CWR", "CER", "STR"]}
|
|
30
|
+
showLegend
|
|
31
|
+
legendPosition="right"
|
|
32
|
+
dateRangeVisible
|
|
33
|
+
onChangeDate={() => {}}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Radial Chart
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A radial chart component for displaying analytics data in radial bar. e.g: Sales of the products
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { RadialBar } from "blixify-ui-web/lib";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const [seriesData, setSeriesData] = useState<number[]>([]);
|
|
19
|
+
const [labelData, setLabelData] = useState<string[]>([]);
|
|
20
|
+
|
|
21
|
+
const chartDummyData = useMemo(() => {
|
|
22
|
+
const customCurrentDate = new Date();
|
|
23
|
+
const twentyEightDaysAgo = new Date();
|
|
24
|
+
const sevenDaysAgo = new Date();
|
|
25
|
+
const oneDaysAgo = new Date();
|
|
26
|
+
sevenDaysAgo.setDate(customCurrentDate.getDate() - 7);
|
|
27
|
+
oneDaysAgo.setDate(customCurrentDate.getDate() - 1);
|
|
28
|
+
twentyEightDaysAgo.setDate(customCurrentDate.getDate() - 28);
|
|
29
|
+
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
label: "Apple",
|
|
33
|
+
value: 10,
|
|
34
|
+
createdAt: sevenDaysAgo,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "Mango",
|
|
38
|
+
value: 20,
|
|
39
|
+
createdAt: sevenDaysAgo,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Orange",
|
|
43
|
+
value: 5,
|
|
44
|
+
createdAt: oneDaysAgo,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Watermelon",
|
|
48
|
+
value: 15,
|
|
49
|
+
createdAt: oneDaysAgo,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Banana",
|
|
53
|
+
value: 55,
|
|
54
|
+
createdAt: twentyEightDaysAgo,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const handleSetData = useCallback(
|
|
60
|
+
(startDate?: Date, endDate?: Date) => {
|
|
61
|
+
let dummySeriesData: number[] = [];
|
|
62
|
+
let dummyLabelData: string[] = [];
|
|
63
|
+
|
|
64
|
+
chartDummyData.map((eachData) => {
|
|
65
|
+
if (startDate && endDate) {
|
|
66
|
+
if (
|
|
67
|
+
eachData.createdAt >= startDate &&
|
|
68
|
+
eachData.createdAt <= endDate
|
|
69
|
+
) {
|
|
70
|
+
dummySeriesData.push(eachData.value);
|
|
71
|
+
dummyLabelData.push(eachData.label);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
dummySeriesData.push(eachData.value);
|
|
75
|
+
dummyLabelData.push(eachData.label);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return null;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
setSeriesData(dummySeriesData);
|
|
82
|
+
setLabelData(dummyLabelData);
|
|
83
|
+
},
|
|
84
|
+
[chartDummyData]
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
handleSetData();
|
|
89
|
+
}, [handleSetData]);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div className="grid grid-col-1 md:grid-cols-2 gap-4">
|
|
93
|
+
<RadialBar
|
|
94
|
+
title="Sales"
|
|
95
|
+
description="Radial bar chart with dark mode"
|
|
96
|
+
labels={labelData}
|
|
97
|
+
series={seriesData}
|
|
98
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
99
|
+
dateRangeVisible={true}
|
|
100
|
+
onChangeDate={handleSetData}
|
|
101
|
+
darkMode
|
|
102
|
+
darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
103
|
+
/>
|
|
104
|
+
<RadialBar
|
|
105
|
+
title="Sales"
|
|
106
|
+
description="With custom bar colors"
|
|
107
|
+
labels={labelData}
|
|
108
|
+
series={seriesData}
|
|
109
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
110
|
+
dateRangeVisible={true}
|
|
111
|
+
onChangeDate={handleSetData}
|
|
112
|
+
barColors={[
|
|
113
|
+
colors.pink[300],
|
|
114
|
+
colors.purple[300],
|
|
115
|
+
colors.indigo[300],
|
|
116
|
+
colors.lime[300],
|
|
117
|
+
colors.yellow[300],
|
|
118
|
+
]}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
##### Required props
|
|
125
|
+
|
|
126
|
+
| Name | Type | Description |
|
|
127
|
+
| -------- | ---------- | ------------------------- |
|
|
128
|
+
| `title` | `string` | Title of the chart |
|
|
129
|
+
| `labels` | `string[]` | Labels for the chart data |
|
|
130
|
+
| `series` | `number[]` | Series data values |
|
|
131
|
+
|
|
132
|
+
##### Optional props
|
|
133
|
+
|
|
134
|
+
| Name | Type | Default | Description |
|
|
135
|
+
| ------------------ | ---------------- | ----------- | -------------------------------------- |
|
|
136
|
+
| `description` | `string` | `undefined` | Description below title |
|
|
137
|
+
| `showToolbar` | `boolean` | `false` | Show toolbar controls |
|
|
138
|
+
| `tool` | `React Element` | `undefined` | Custom tool element |
|
|
139
|
+
| `chartSize` | `number` | `300` | Height of the chart |
|
|
140
|
+
| `containerStyle` | `string` | `undefined` | Additional CSS classes for container |
|
|
141
|
+
| `dateRangeVisible` | `boolean` | `false` | Show date range picker |
|
|
142
|
+
| `customDate` | `RangeInterface` | `undefined` | Custom date range |
|
|
143
|
+
| `chartOnly` | `boolean` | `false` | Show only the chart without container |
|
|
144
|
+
| `dataUnit` | `string` | `""` | Unit for data values (e.g., "%", "px") |
|
|
145
|
+
| `decimals` | `number` | `2` | Number of decimal places to round to |
|
|
146
|
+
| `barColors` | `string[]` | `undefined` | Custom colors for the bars |
|
|
147
|
+
| `trackColors` | `string[]` | `undefined` | Custom colors for the track background |
|
|
148
|
+
| `hollowPercent` | `number` | `undefined` | Percentage for hollow center (0-100) |
|
|
149
|
+
| `roundedStroke` | `boolean` | `false` | Enable rounded ends on the bars |
|
|
150
|
+
| `onChangeDate` | `function` | `undefined` | Callback when date range changes |
|
|
151
|
+
| `darkMode` | `boolean` | `false` | Enable dark mode styling |
|
|
152
|
+
| `darkModeBg` | `string` | `undefined` | Custom background color for dark mode |
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { PencilIcon } from "@heroicons/react/24/outline";
|
|
2
|
+
import { storiesOf } from "@storybook/react";
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { RadialBar } from ".";
|
|
5
|
+
import { RangeInterface } from "../DateRange";
|
|
6
|
+
import README from "./README.md";
|
|
7
|
+
import colors from "tailwindcss/colors";
|
|
8
|
+
|
|
9
|
+
const stories = storiesOf("Chart", module);
|
|
10
|
+
|
|
11
|
+
stories.addParameters({
|
|
12
|
+
readme: {
|
|
13
|
+
content: README,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
stories.add("Radial Chart", () => {
|
|
18
|
+
const [seriesData, setSeriesData] = useState<number[]>([]);
|
|
19
|
+
const [labelData, setLabelData] = useState<string[]>([]);
|
|
20
|
+
|
|
21
|
+
const chartDummyData = useMemo(() => {
|
|
22
|
+
const customCurrentDate = new Date();
|
|
23
|
+
const twentyEightDaysAgo = new Date();
|
|
24
|
+
const sevenDaysAgo = new Date();
|
|
25
|
+
const oneDaysAgo = new Date();
|
|
26
|
+
sevenDaysAgo.setDate(customCurrentDate.getDate() - 7);
|
|
27
|
+
oneDaysAgo.setDate(customCurrentDate.getDate() - 1);
|
|
28
|
+
twentyEightDaysAgo.setDate(customCurrentDate.getDate() - 28);
|
|
29
|
+
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
label: "Apple",
|
|
33
|
+
value: 10,
|
|
34
|
+
createdAt: sevenDaysAgo,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "Mango",
|
|
38
|
+
value: 20,
|
|
39
|
+
createdAt: sevenDaysAgo,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Orange",
|
|
43
|
+
value: 5,
|
|
44
|
+
createdAt: oneDaysAgo,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Watermelon",
|
|
48
|
+
value: 15,
|
|
49
|
+
createdAt: oneDaysAgo,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Banana",
|
|
53
|
+
value: 55,
|
|
54
|
+
createdAt: twentyEightDaysAgo,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const handleSetData = useCallback(
|
|
60
|
+
(customDate?: RangeInterface) => {
|
|
61
|
+
let dummySeriesData: number[] = [];
|
|
62
|
+
let dummyLabelData: string[] = [];
|
|
63
|
+
|
|
64
|
+
chartDummyData.map((eachData) => {
|
|
65
|
+
if (customDate?.isDuration) {
|
|
66
|
+
if (
|
|
67
|
+
eachData.createdAt >= customDate.startDate &&
|
|
68
|
+
eachData.createdAt <= customDate.endDate
|
|
69
|
+
) {
|
|
70
|
+
dummySeriesData.push(eachData.value);
|
|
71
|
+
dummyLabelData.push(eachData.label);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
if (customDate?.endDate && eachData.createdAt <= customDate.endDate) {
|
|
75
|
+
dummySeriesData.push(eachData.value);
|
|
76
|
+
dummyLabelData.push(eachData.label);
|
|
77
|
+
} else {
|
|
78
|
+
dummySeriesData.push(eachData.value);
|
|
79
|
+
dummyLabelData.push(eachData.label);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
setSeriesData(dummySeriesData);
|
|
87
|
+
setLabelData(dummyLabelData);
|
|
88
|
+
},
|
|
89
|
+
[chartDummyData]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
handleSetData();
|
|
94
|
+
}, [handleSetData]);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div className="grid grid-col-1 md:grid-cols-2 gap-4">
|
|
98
|
+
<RadialBar
|
|
99
|
+
title="Sales"
|
|
100
|
+
description="Radial bar chart with dark mode"
|
|
101
|
+
labels={labelData}
|
|
102
|
+
series={seriesData}
|
|
103
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
104
|
+
dateRangeVisible={true}
|
|
105
|
+
onChangeDate={handleSetData}
|
|
106
|
+
/>
|
|
107
|
+
<RadialBar
|
|
108
|
+
title="Sales"
|
|
109
|
+
description="Custom bar colors, track colors, hollow percentage"
|
|
110
|
+
labels={labelData}
|
|
111
|
+
series={seriesData}
|
|
112
|
+
tool={<PencilIcon className="h-4 w-4 text-primary-600" />}
|
|
113
|
+
dateRangeVisible={true}
|
|
114
|
+
onChangeDate={handleSetData}
|
|
115
|
+
hollowPercent={35}
|
|
116
|
+
barColors={[
|
|
117
|
+
colors.indigo[500],
|
|
118
|
+
colors.purple[500],
|
|
119
|
+
colors.fuchsia[500],
|
|
120
|
+
colors.pink[500],
|
|
121
|
+
colors.red[500],
|
|
122
|
+
]}
|
|
123
|
+
roundedStroke
|
|
124
|
+
trackColors={[
|
|
125
|
+
colors.indigo[100],
|
|
126
|
+
colors.purple[100],
|
|
127
|
+
colors.fuchsia[100],
|
|
128
|
+
colors.pink[100],
|
|
129
|
+
colors.red[100],
|
|
130
|
+
]}
|
|
131
|
+
// darkMode
|
|
132
|
+
// darkModeBg="bg-gradient-to-r from-slate-700 to-gray-900"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
});
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Range Bar Chart
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
A range bar chart (Gantt-style timeline chart) component for displaying time ranges. Perfect for showing schedules, timelines, or any data that spans between two time points. e.g: Project timelines, sleep schedules, activity schedules. The chart displays time on the X-axis and categories on the Y-axis, allowing the same category to appear multiple times with different time ranges.
|
|
8
|
+
|
|
9
|
+
##### Import
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { RangeBarChart } from "blixify-ui-web/lib";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
const today = new Date();
|
|
19
|
+
today.setHours(0, 0, 0, 0);
|
|
20
|
+
|
|
21
|
+
const sleepStart = new Date(today);
|
|
22
|
+
sleepStart.setHours(23, 0, 0, 0);
|
|
23
|
+
const sleepEnd = new Date(today);
|
|
24
|
+
sleepEnd.setDate(today.getDate() + 1);
|
|
25
|
+
sleepEnd.setHours(7, 0, 0, 0);
|
|
26
|
+
|
|
27
|
+
const awakeStart = new Date(today);
|
|
28
|
+
awakeStart.setHours(7, 0, 0, 0);
|
|
29
|
+
const awakeEnd = new Date(today);
|
|
30
|
+
awakeEnd.setHours(23, 0, 0, 0);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<RangeBarChart
|
|
34
|
+
title="Daily Sleep Schedule"
|
|
35
|
+
seriesName="Status"
|
|
36
|
+
data={[
|
|
37
|
+
{
|
|
38
|
+
category: "Sleep",
|
|
39
|
+
value: [sleepStart, sleepEnd],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
category: "Awake",
|
|
43
|
+
value: [awakeStart, awakeEnd],
|
|
44
|
+
},
|
|
45
|
+
]}
|
|
46
|
+
customColors={["#6366F1", "#10B981"]}
|
|
47
|
+
showDataLabel={false}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
##### Required props
|
|
53
|
+
|
|
54
|
+
| Name | Type | Description |
|
|
55
|
+
| ------- | -------- | ------------------ |
|
|
56
|
+
| `title` | `string` | Title of the chart |
|
|
57
|
+
|
|
58
|
+
##### Optional props
|
|
59
|
+
|
|
60
|
+
| Name | Type | Default | Description |
|
|
61
|
+
| ------------------ | ----------------- | ----------- | ----------------------------------------------------------------------------------------- |
|
|
62
|
+
| `data` | `RangeData[]` | `[]` | Array of range data with category and Date range value |
|
|
63
|
+
| `seriesName` | `string` | `"Range"` | Series name displayed in tooltip |
|
|
64
|
+
| `showToolbar` | `boolean` | `false` | Show/hide chart toolbar |
|
|
65
|
+
| `showDataLabel` | `boolean` | `true` | Show/hide data labels on bars |
|
|
66
|
+
| `newTabUrl` | `string` | `""` | Set URL for create hyperlinks |
|
|
67
|
+
| `xAxisLabels` | `AxisLabelConfig` | `undefined` | Customize X-axis labels (rotation, styling, formatting) |
|
|
68
|
+
| `yAxisLabels` | `AxisLabelConfig` | `undefined` | Customize Y-axis labels (rotation, styling, formatting) |
|
|
69
|
+
| `xAxisTitle` | `AxisTitleConfig` | `undefined` | Add and customize X-axis title |
|
|
70
|
+
| `yAxisTitle` | `AxisTitleConfig` | `undefined` | Add and customize Y-axis title |
|
|
71
|
+
| `customBackground` | `string` | `undefined` | Custom background color or gradient |
|
|
72
|
+
| `customColors` | `string[]` | `undefined` | Custom color palette for bars (enables distributed mode) |
|
|
73
|
+
| `hideGrid` | `boolean` | `false` | Hide chart grid lines |
|
|
74
|
+
| `hideAxes` | `boolean` | `false` | Hide chart axes |
|
|
75
|
+
| `roundedBars` | `boolean` | `false` | Apply rounded corners to bars |
|
|
76
|
+
| `disableZoom` | `boolean` | `false` | Disable chart zoom functionality |
|
|
77
|
+
| `disableTooltip` | `boolean` | `false` | Disable hover tooltips |
|
|
78
|
+
| `customAnimation` | `AnimationConfig` | `undefined` | Custom animation settings |
|
|
79
|
+
| `onClick` | `function` | `undefined` | Callback function when a bar is clicked (receives category, startTimestamp, endTimestamp) |
|
|
80
|
+
|
|
81
|
+
##### Range Data props
|
|
82
|
+
|
|
83
|
+
| Name | Type | Description |
|
|
84
|
+
| ---------- | -------------- | ----------------------------------------------- |
|
|
85
|
+
| `category` | `string` | Category name (displayed on Y-axis, can repeat) |
|
|
86
|
+
| `value` | `[Date, Date]` | Time range as array `[startDate, endDate]` |
|
|
87
|
+
|
|
88
|
+
##### Animation Config props
|
|
89
|
+
|
|
90
|
+
| Name | Type | Description |
|
|
91
|
+
| --------- | --------- | ------------------------- |
|
|
92
|
+
| `enabled` | `boolean` | Enable/disable animations |
|
|
93
|
+
| `easing` | `string` | Animation easing function |
|
|
94
|
+
| `speed` | `number` | Animation duration in ms |
|
|
95
|
+
|
|
96
|
+
##### Label Customization Props
|
|
97
|
+
|
|
98
|
+
| Name | Type | Description |
|
|
99
|
+
| ----------------------- | -------------------- | --------------------------------------------------------------- |
|
|
100
|
+
| `show` | `boolean` | Show/hide labels |
|
|
101
|
+
| `rotate` | `number` | Rotation angle in degrees |
|
|
102
|
+
| `rotateAlways` | `boolean` | Always rotate labels |
|
|
103
|
+
| `hideOverlappingLabels` | `boolean` | Hide overlapping labels |
|
|
104
|
+
| `trim` | `boolean` | Trim long labels |
|
|
105
|
+
| `maxHeight` | `number` | Maximum height for labels |
|
|
106
|
+
| `style` | `AxisLabelStyle` | CSS styling (fontSize, fontFamily, fontWeight, color, cssClass) |
|
|
107
|
+
| `formatter` | `AxisLabelFormatter` | Custom formatter function |
|
|
108
|
+
| `offsetX` | `number` | Horizontal offset |
|
|
109
|
+
| `offsetY` | `number` | Vertical offset |
|
|
110
|
+
|
|
111
|
+
##### Advanced Examples
|
|
112
|
+
|
|
113
|
+
```jsx
|
|
114
|
+
// Activity schedule with multiple colors
|
|
115
|
+
const today = new Date();
|
|
116
|
+
today.setHours(0, 0, 0, 0);
|
|
117
|
+
|
|
118
|
+
<RangeBarChart
|
|
119
|
+
title="Activity Schedule"
|
|
120
|
+
seriesName="Activities"
|
|
121
|
+
data={[
|
|
122
|
+
{
|
|
123
|
+
category: "Sleep",
|
|
124
|
+
value: [
|
|
125
|
+
new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 0, 0),
|
|
126
|
+
new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, 7, 0, 0),
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
category: "Work",
|
|
131
|
+
value: [
|
|
132
|
+
new Date(today.getFullYear(), today.getMonth(), today.getDate(), 9, 0, 0),
|
|
133
|
+
new Date(today.getFullYear(), today.getMonth(), today.getDate(), 17, 0, 0),
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
category: "Exercise",
|
|
138
|
+
value: [
|
|
139
|
+
new Date(today.getFullYear(), today.getMonth(), today.getDate(), 7, 0, 0),
|
|
140
|
+
new Date(today.getFullYear(), today.getMonth(), today.getDate(), 9, 0, 0),
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
]}
|
|
144
|
+
customColors={["#6366F1", "#10B981", "#F59E0B"]}
|
|
145
|
+
/>
|
|
146
|
+
|
|
147
|
+
// Project timeline with same category appearing multiple times
|
|
148
|
+
<RangeBarChart
|
|
149
|
+
title="Project Timeline"
|
|
150
|
+
data={[
|
|
151
|
+
{
|
|
152
|
+
category: "Project A",
|
|
153
|
+
value: [
|
|
154
|
+
new Date(2024, 0, 1, 9, 0, 0),
|
|
155
|
+
new Date(2024, 0, 15, 17, 0, 0),
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
category: "Project A",
|
|
160
|
+
value: [
|
|
161
|
+
new Date(2024, 1, 1, 9, 0, 0),
|
|
162
|
+
new Date(2024, 1, 10, 17, 0, 0),
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
category: "Project B",
|
|
167
|
+
value: [
|
|
168
|
+
new Date(2024, 0, 16, 10, 0, 0),
|
|
169
|
+
new Date(2024, 0, 30, 16, 0, 0),
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
]}
|
|
173
|
+
customBackground="linear-gradient(180deg, #4A3AFF 0%, #6959FF 100%)"
|
|
174
|
+
customColors={["#FFFFFF", "#F5F3FF", "#E0E7FF"]}
|
|
175
|
+
roundedBars={true}
|
|
176
|
+
hideGrid={true}
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
// Meeting schedule with click handler
|
|
180
|
+
<RangeBarChart
|
|
181
|
+
title="Daily Meetings"
|
|
182
|
+
data={[
|
|
183
|
+
{
|
|
184
|
+
category: "Team Meeting",
|
|
185
|
+
value: [
|
|
186
|
+
new Date(2024, 0, 15, 9, 0, 0),
|
|
187
|
+
new Date(2024, 0, 15, 10, 0, 0),
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
category: "Client Call",
|
|
192
|
+
value: [
|
|
193
|
+
new Date(2024, 0, 15, 14, 0, 0),
|
|
194
|
+
new Date(2024, 0, 15, 15, 30, 0),
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
]}
|
|
198
|
+
onClick={(category, startTimestamp, endTimestamp) => {
|
|
199
|
+
console.log(`${category}: ${new Date(startTimestamp).toLocaleString()} - ${new Date(endTimestamp).toLocaleString()}`);
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
// Disabled interactions for presentations
|
|
204
|
+
<RangeBarChart
|
|
205
|
+
title="Static Timeline"
|
|
206
|
+
data={[
|
|
207
|
+
{
|
|
208
|
+
category: "Phase 1",
|
|
209
|
+
value: [
|
|
210
|
+
new Date(2024, 0, 1),
|
|
211
|
+
new Date(2024, 0, 15),
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
category: "Phase 2",
|
|
216
|
+
value: [
|
|
217
|
+
new Date(2024, 0, 16),
|
|
218
|
+
new Date(2024, 0, 30),
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
]}
|
|
222
|
+
disableZoom={true}
|
|
223
|
+
disableTooltip={true}
|
|
224
|
+
showDataLabel={false}
|
|
225
|
+
/>
|
|
226
|
+
|
|
227
|
+
// Custom animation settings
|
|
228
|
+
<RangeBarChart
|
|
229
|
+
title="Animated Timeline"
|
|
230
|
+
data={[
|
|
231
|
+
{
|
|
232
|
+
category: "Task A",
|
|
233
|
+
value: [
|
|
234
|
+
new Date(2024, 0, 1),
|
|
235
|
+
new Date(2024, 0, 10),
|
|
236
|
+
],
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
category: "Task B",
|
|
240
|
+
value: [
|
|
241
|
+
new Date(2024, 0, 11),
|
|
242
|
+
new Date(2024, 0, 20),
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
]}
|
|
246
|
+
customAnimation={{
|
|
247
|
+
enabled: true,
|
|
248
|
+
easing: "easeout",
|
|
249
|
+
speed: 1200,
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
##### Label Customization Examples
|
|
255
|
+
|
|
256
|
+
```jsx
|
|
257
|
+
// Custom X-axis (time) labels with formatting
|
|
258
|
+
<RangeBarChart
|
|
259
|
+
title="Project Timeline"
|
|
260
|
+
data={[
|
|
261
|
+
{
|
|
262
|
+
category: "Project Alpha",
|
|
263
|
+
value: [
|
|
264
|
+
new Date(2024, 0, 1),
|
|
265
|
+
new Date(2024, 0, 15),
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
category: "Project Beta",
|
|
270
|
+
value: [
|
|
271
|
+
new Date(2024, 0, 16),
|
|
272
|
+
new Date(2024, 0, 30),
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
]}
|
|
276
|
+
xAxisLabels={{
|
|
277
|
+
style: {
|
|
278
|
+
fontSize: "12px",
|
|
279
|
+
fontWeight: "bold",
|
|
280
|
+
color: "#374151",
|
|
281
|
+
},
|
|
282
|
+
formatter: (value) => {
|
|
283
|
+
const date = new Date(value);
|
|
284
|
+
return date.toLocaleDateString();
|
|
285
|
+
},
|
|
286
|
+
}}
|
|
287
|
+
/>
|
|
288
|
+
|
|
289
|
+
// Y-axis (categories) with custom styling
|
|
290
|
+
<RangeBarChart
|
|
291
|
+
title="Activity Timeline"
|
|
292
|
+
data={[
|
|
293
|
+
{
|
|
294
|
+
category: "Morning Routine",
|
|
295
|
+
value: [
|
|
296
|
+
new Date(2024, 0, 1, 7, 0, 0),
|
|
297
|
+
new Date(2024, 0, 1, 9, 0, 0),
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
category: "Work Session",
|
|
302
|
+
value: [
|
|
303
|
+
new Date(2024, 0, 1, 9, 0, 0),
|
|
304
|
+
new Date(2024, 0, 1, 17, 0, 0),
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
]}
|
|
308
|
+
yAxisLabels={{
|
|
309
|
+
style: {
|
|
310
|
+
fontSize: "11px",
|
|
311
|
+
color: "#059669",
|
|
312
|
+
},
|
|
313
|
+
}}
|
|
314
|
+
yAxisTitle={{
|
|
315
|
+
text: "Activities",
|
|
316
|
+
style: {
|
|
317
|
+
fontSize: "13px",
|
|
318
|
+
fontWeight: "bold",
|
|
319
|
+
color: "#1F2937",
|
|
320
|
+
},
|
|
321
|
+
}}
|
|
322
|
+
/>
|
|
323
|
+
```
|