@spteck/fluentui-react-charts 0.1.8
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/LICENSE +21 -0
- package/README.md +462 -0
- package/dist/charts/BarChart/BarChart.d.ts +16 -0
- package/dist/charts/BarChart/index.d.ts +1 -0
- package/dist/charts/ComboChart/ComboChart.d.ts +16 -0
- package/dist/charts/ComboChart/index.d.ts +1 -0
- package/dist/charts/Doughnut/DoughnutChart.d.ts +14 -0
- package/dist/charts/Doughnut/index.d.ts +1 -0
- package/dist/charts/PieChart/PieChart.d.ts +14 -0
- package/dist/charts/PieChart/index.d.ts +1 -0
- package/dist/charts/areaChart/AreaChart.d.ts +15 -0
- package/dist/charts/areaChart/index.d.ts +1 -0
- package/dist/charts/barHorizontalChart/BarHotizontalChart.d.ts +15 -0
- package/dist/charts/barHorizontalChart/index.d.ts +1 -0
- package/dist/charts/bubbleChart/BubbleChart.d.ts +15 -0
- package/dist/charts/bubbleChart/index.d.ts +1 -0
- package/dist/charts/floatBarChart/FloatBarChart.d.ts +14 -0
- package/dist/charts/floatBarChart/index.d.ts +1 -0
- package/dist/charts/lineChart/LineChart.d.ts +14 -0
- package/dist/charts/lineChart/index.d.ts +1 -0
- package/dist/charts/polarChart/PolarChart.d.ts +14 -0
- package/dist/charts/polarChart/index.d.ts +1 -0
- package/dist/charts/radarChart/RadarChart.d.ts +14 -0
- package/dist/charts/radarChart/index.d.ts +1 -0
- package/dist/charts/scatterChart/ScatterChart.d.ts +14 -0
- package/dist/charts/scatterChart/index.d.ts +1 -0
- package/dist/charts/stackedLineChart/StackedLineChart.d.ts +14 -0
- package/dist/charts/stackedLineChart/index.d.ts +1 -0
- package/dist/charts/steamChart/SteamChart.d.ts +14 -0
- package/dist/charts/steamChart/index.d.ts +1 -0
- package/dist/components/DashBoard.d.ts +3 -0
- package/dist/components/RenderLegend/RenderLegend.d.ts +11 -0
- package/dist/components/RenderTooltip/RenderTooltip.d.ts +14 -0
- package/dist/components/buttonMenu/ButtonMenu.d.ts +3 -0
- package/dist/components/buttonMenu/IButtonMenuOption.d.ts +10 -0
- package/dist/components/buttonMenu/IButtonMenuProps.d.ts +37 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/legendContainer/LegendContainer.d.ts +16 -0
- package/dist/components/legendeButton/LegendButton.d.ts +11 -0
- package/dist/components/renderSliceLegend/RenderSliceLegend.d.ts +9 -0
- package/dist/components/renderValueLegend/RenderValueLegend.d.ts +13 -0
- package/dist/components/stack/IStackProps.d.ts +76 -0
- package/dist/components/stack/Stack.d.ts +8 -0
- package/dist/components/themeProvider/ThemeProvider.d.ts +15 -0
- package/dist/constants/Constants.d.ts +1 -0
- package/dist/fluentui-react-charts.cjs.development.js +2916 -0
- package/dist/fluentui-react-charts.cjs.development.js.map +1 -0
- package/dist/fluentui-react-charts.cjs.production.min.js +2 -0
- package/dist/fluentui-react-charts.cjs.production.min.js.map +1 -0
- package/dist/fluentui-react-charts.esm.js +2905 -0
- package/dist/fluentui-react-charts.esm.js.map +1 -0
- package/dist/graphGlobalStyles/useGraphGlobalStyles.d.ts +5 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useGraphUtils.d.ts +38 -0
- package/dist/hooks/useResponsiveLegend.d.ts +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8 -0
- package/dist/models/IChart.d.ts +25 -0
- package/dist/models/index.d.ts +1 -0
- package/package.json +66 -0
- package/src/assets/sample1.png +0 -0
- package/src/assets/sample2.png +0 -0
- package/src/assets/sample3.png +0 -0
- package/src/charts/BarChart/BarChart.tsx +227 -0
- package/src/charts/BarChart/README.MD +335 -0
- package/src/charts/BarChart/index.ts +1 -0
- package/src/charts/ComboChart/ComboChart.tsx +209 -0
- package/src/charts/ComboChart/README.MD +347 -0
- package/src/charts/ComboChart/index.ts +1 -0
- package/src/charts/Doughnut/DoughnutChart.tsx +152 -0
- package/src/charts/Doughnut/README.MD +296 -0
- package/src/charts/Doughnut/index.ts +1 -0
- package/src/charts/PieChart/PieChart.tsx +148 -0
- package/src/charts/PieChart/README.MD +315 -0
- package/src/charts/PieChart/index.ts +1 -0
- package/src/charts/areaChart/AreaChart.tsx +195 -0
- package/src/charts/areaChart/README.MD +236 -0
- package/src/charts/areaChart/index.ts +1 -0
- package/src/charts/barHorizontalChart/BarHotizontalChart.tsx +200 -0
- package/src/charts/barHorizontalChart/README.MD +278 -0
- package/src/charts/barHorizontalChart/index.ts +2 -0
- package/src/charts/bubbleChart/BubbleChart.tsx +184 -0
- package/src/charts/bubbleChart/README.MD +275 -0
- package/src/charts/bubbleChart/index.ts +1 -0
- package/src/charts/floatBarChart/FloatBarChart.tsx +178 -0
- package/src/charts/floatBarChart/README.MD +354 -0
- package/src/charts/floatBarChart/index.ts +1 -0
- package/src/charts/lineChart/LineChart.tsx +200 -0
- package/src/charts/lineChart/README.MD +354 -0
- package/src/charts/lineChart/index.ts +1 -0
- package/src/charts/polarChart/PolarChart.tsx +161 -0
- package/src/charts/polarChart/README.MD +336 -0
- package/src/charts/polarChart/index.ts +1 -0
- package/src/charts/radarChart/README.MD +388 -0
- package/src/charts/radarChart/RadarChart.tsx +173 -0
- package/src/charts/radarChart/index.ts +1 -0
- package/src/charts/scatterChart/README.MD +335 -0
- package/src/charts/scatterChart/ScatterChart.tsx +155 -0
- package/src/charts/scatterChart/index.ts +1 -0
- package/src/charts/stackedLineChart/README.MD +396 -0
- package/src/charts/stackedLineChart/StackedLineChart.tsx +188 -0
- package/src/charts/stackedLineChart/index.ts +1 -0
- package/src/charts/steamChart/README.MD +414 -0
- package/src/charts/steamChart/SteamChart.tsx +236 -0
- package/src/charts/steamChart/index.ts +1 -0
- package/src/components/DashBoard.tsx +409 -0
- package/src/components/RenderLegend/RenderLegend.tsx +40 -0
- package/src/components/RenderTooltip/RenderTooltip.tsx +111 -0
- package/src/components/buttonMenu/ButtonMenu.tsx +186 -0
- package/src/components/buttonMenu/IButtonMenuOption.ts +9 -0
- package/src/components/buttonMenu/IButtonMenuProps.tsx +40 -0
- package/src/components/index.ts +15 -0
- package/src/components/legendContainer/LegendContainer.tsx +118 -0
- package/src/components/legendeButton/LegendButton.tsx +57 -0
- package/src/components/renderSliceLegend/RenderSliceLegend.tsx +46 -0
- package/src/components/renderValueLegend/RenderValueLegend.tsx +43 -0
- package/src/components/stack/IStackProps.tsx +94 -0
- package/src/components/stack/Stack.tsx +103 -0
- package/src/components/themeProvider/ThemeProvider.tsx +48 -0
- package/src/constants/Constants.tsx +23 -0
- package/src/graphGlobalStyles/useGraphGlobalStyles.ts +28 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useGraphUtils.tsx +314 -0
- package/src/hooks/useResponsiveLegend.ts +35 -0
- package/src/index.tsx +4 -0
- package/src/models/IChart.ts +50 -0
- package/src/models/index.ts +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 João Mendes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
# Fluent UI React Charts
|
|
2
|
+
|
|
3
|
+
A comprehensive collection of interactive chart components built with Chart.js and Fluent UI React. This library provides a complete set of data visualization components that seamlessly integrate with Microsoft's Fluent UI design system.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **Complete Chart Collection**: 13+ chart types including Bar, Line, Pie, Area, and more
|
|
8
|
+
- **Fluent UI Integration**: Native support for Fluent UI themes and design tokens
|
|
9
|
+
- **TypeScript Support**: Full TypeScript support with generic types for type-safe data handling
|
|
10
|
+
- **Interactive Components**: Built-in legends, tooltips, and data interaction capabilities
|
|
11
|
+
- **Responsive Design**: Charts automatically adapt to container dimensions
|
|
12
|
+
- **Performance Optimized**: Efficient rendering and updates for large datasets
|
|
13
|
+
- **Accessibility**: ARIA compliance and keyboard navigation support
|
|
14
|
+
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @spteck/fluentui-react-charts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 🎯 Quick Start
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { BarChart } from '@spteck/fluentui-react-charts';
|
|
26
|
+
import { webLightTheme } from '@fluentui/react-components';
|
|
27
|
+
|
|
28
|
+
const data = [
|
|
29
|
+
{ month: 'Jan', sales: 10000 },
|
|
30
|
+
{ month: 'Feb', sales: 15000 },
|
|
31
|
+
{ month: 'Mar', sales: 12000 },
|
|
32
|
+
{ month: 'Apr', sales: 18000 },
|
|
33
|
+
{ month: 'May', sales: 16000 },
|
|
34
|
+
{ month: 'Jun', sales: 22000 },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
function App() {
|
|
38
|
+
return (
|
|
39
|
+
<div style={{ width: '800px', height: '400px' }}>
|
|
40
|
+
<BarChart
|
|
41
|
+
data={[{ label: 'Monthly Sales', data }]}
|
|
42
|
+
getPrimary={(d) => d.month}
|
|
43
|
+
getSecondary={(d) => d.sales}
|
|
44
|
+
title="Sales Performance"
|
|
45
|
+
theme={webLightTheme}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 📊 Available Charts
|
|
53
|
+
|
|
54
|
+
### Bar Charts
|
|
55
|
+
|
|
56
|
+
#### BarChart
|
|
57
|
+
|
|
58
|
+
Perfect for comparing categories of data with vertical bars.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { BarChart } from '@spteck/fluentui-react-charts';
|
|
62
|
+
|
|
63
|
+
const salesData = [
|
|
64
|
+
{ category: 'Electronics', value: 125000 },
|
|
65
|
+
{ category: 'Clothing', value: 89000 },
|
|
66
|
+
{ category: 'Books', value: 45000 },
|
|
67
|
+
{ category: 'Home & Garden', value: 67000 },
|
|
68
|
+
{ category: 'Sports', value: 78000 },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
<BarChart
|
|
72
|
+
data={[{ label: 'Sales', data: salesData }]}
|
|
73
|
+
getPrimary={(d) => d.category}
|
|
74
|
+
getSecondary={(d) => d.value}
|
|
75
|
+
title="Sales by Category"
|
|
76
|
+
theme={webLightTheme}
|
|
77
|
+
/>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### BarHorizontalChart
|
|
81
|
+
|
|
82
|
+
Horizontal orientation for better label readability with long category names.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { BarHorizontalChart } from '@spteck/fluentui-react-charts';
|
|
86
|
+
|
|
87
|
+
const revenueData = [
|
|
88
|
+
{ department: 'Engineering & Development', revenue: 450000 },
|
|
89
|
+
{ department: 'Sales & Marketing', revenue: 380000 },
|
|
90
|
+
{ department: 'Customer Support', revenue: 180000 },
|
|
91
|
+
{ department: 'Human Resources', revenue: 120000 },
|
|
92
|
+
{ department: 'Operations', revenue: 250000 },
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
<BarHorizontalChart
|
|
96
|
+
data={[{ label: 'Revenue', data: revenueData }]}
|
|
97
|
+
getPrimary={(d) => d.department}
|
|
98
|
+
getSecondary={(d) => d.revenue}
|
|
99
|
+
title="Revenue by Department"
|
|
100
|
+
theme={webLightTheme}
|
|
101
|
+
/>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### FloatingBarChart
|
|
105
|
+
|
|
106
|
+
Displays ranges with floating bars showing min-max values.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { FloatingBarChart } from '@spteck/fluentui-react-charts';
|
|
110
|
+
|
|
111
|
+
const tempData = [
|
|
112
|
+
{ month: 'January', minTemp: 25, maxTemp: 45 },
|
|
113
|
+
{ month: 'February', minTemp: 30, maxTemp: 50 },
|
|
114
|
+
{ month: 'March', minTemp: 40, maxTemp: 65 },
|
|
115
|
+
{ month: 'April', minTemp: 50, maxTemp: 75 },
|
|
116
|
+
{ month: 'May', minTemp: 60, maxTemp: 85 },
|
|
117
|
+
{ month: 'June', minTemp: 70, maxTemp: 95 },
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
<FloatingBarChart
|
|
121
|
+
data={[{ label: 'Temperature Range', data: tempData }]}
|
|
122
|
+
getPrimary={(d) => d.month}
|
|
123
|
+
getRange={(d) => [d.minTemp, d.maxTemp]}
|
|
124
|
+
title="Monthly Temperature Range"
|
|
125
|
+
theme={webLightTheme}
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Line Charts
|
|
130
|
+
|
|
131
|
+
#### LineChart
|
|
132
|
+
|
|
133
|
+
Ideal for showing trends and changes over time.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { LineChart } from '@spteck/fluentui-react-charts';
|
|
137
|
+
|
|
138
|
+
const growthData = [
|
|
139
|
+
{ quarter: 'Q1 2023', growth: 12.5 },
|
|
140
|
+
{ quarter: 'Q2 2023', growth: 15.8 },
|
|
141
|
+
{ quarter: 'Q3 2023', growth: 18.2 },
|
|
142
|
+
{ quarter: 'Q4 2023', growth: 22.1 },
|
|
143
|
+
{ quarter: 'Q1 2024', growth: 25.7 },
|
|
144
|
+
{ quarter: 'Q2 2024', growth: 28.3 },
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
<LineChart
|
|
148
|
+
data={[{ label: 'Growth', data: growthData }]}
|
|
149
|
+
getPrimary={(d) => d.quarter}
|
|
150
|
+
getSecondary={(d) => d.growth}
|
|
151
|
+
title="Quarterly Growth"
|
|
152
|
+
theme={webLightTheme}
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### StackedLineChart
|
|
157
|
+
|
|
158
|
+
Multiple line series with stacking capability for cumulative data.
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { StackedLineChart } from '@spteck/fluentui-react-charts';
|
|
162
|
+
|
|
163
|
+
const productAData = [
|
|
164
|
+
{ month: 'Jan', sales: 25000 },
|
|
165
|
+
{ month: 'Feb', sales: 28000 },
|
|
166
|
+
{ month: 'Mar', sales: 32000 },
|
|
167
|
+
{ month: 'Apr', sales: 35000 },
|
|
168
|
+
{ month: 'May', sales: 38000 },
|
|
169
|
+
{ month: 'Jun', sales: 42000 },
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
const productBData = [
|
|
173
|
+
{ month: 'Jan', sales: 18000 },
|
|
174
|
+
{ month: 'Feb', sales: 22000 },
|
|
175
|
+
{ month: 'Mar', sales: 26000 },
|
|
176
|
+
{ month: 'Apr', sales: 24000 },
|
|
177
|
+
{ month: 'May', sales: 28000 },
|
|
178
|
+
{ month: 'Jun', sales: 31000 },
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
<StackedLineChart
|
|
182
|
+
data={[
|
|
183
|
+
{ label: 'Product A', data: productAData },
|
|
184
|
+
{ label: 'Product B', data: productBData }
|
|
185
|
+
]}
|
|
186
|
+
getPrimary={(d) => d.month}
|
|
187
|
+
getSecondary={(d) => d.sales}
|
|
188
|
+
title="Product Sales Comparison"
|
|
189
|
+
theme={webLightTheme}
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Area Charts
|
|
194
|
+
|
|
195
|
+
#### AreaChart
|
|
196
|
+
|
|
197
|
+
Shows trends with filled areas, perfect for volume data.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { AreaChart } from '@spteck/fluentui-react-charts';
|
|
201
|
+
|
|
202
|
+
const trafficData = [
|
|
203
|
+
{ hour: '00:00', visitors: 120 },
|
|
204
|
+
{ hour: '04:00', visitors: 85 },
|
|
205
|
+
{ hour: '08:00', visitors: 450 },
|
|
206
|
+
{ hour: '12:00', visitors: 680 },
|
|
207
|
+
{ hour: '16:00', visitors: 520 },
|
|
208
|
+
{ hour: '20:00', visitors: 340 },
|
|
209
|
+
];
|
|
210
|
+
|
|
211
|
+
<AreaChart
|
|
212
|
+
data={[{ label: 'Traffic', data: trafficData }]}
|
|
213
|
+
getPrimary={(d) => d.hour}
|
|
214
|
+
getSecondary={(d) => d.visitors}
|
|
215
|
+
title="Website Traffic"
|
|
216
|
+
theme={webLightTheme}
|
|
217
|
+
/>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Circular Charts
|
|
221
|
+
|
|
222
|
+
#### PieChart
|
|
223
|
+
|
|
224
|
+
Classic pie chart for showing proportional data.
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { PieChart } from '@spteck/fluentui-react-charts';
|
|
228
|
+
|
|
229
|
+
const marketData = [
|
|
230
|
+
{ company: 'Company A', share: 35.2 },
|
|
231
|
+
{ company: 'Company B', share: 28.7 },
|
|
232
|
+
{ company: 'Company C', share: 18.5 },
|
|
233
|
+
{ company: 'Company D', share: 12.1 },
|
|
234
|
+
{ company: 'Others', share: 5.5 },
|
|
235
|
+
];
|
|
236
|
+
|
|
237
|
+
<PieChart
|
|
238
|
+
data={[{ label: 'Market Share', data: marketData }]}
|
|
239
|
+
getLabel={(d) => d.company}
|
|
240
|
+
getValue={(d) => d.share}
|
|
241
|
+
title="Market Share Distribution"
|
|
242
|
+
theme={webLightTheme}
|
|
243
|
+
/>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### DoughnutChart
|
|
247
|
+
|
|
248
|
+
Doughnut variation with center space for additional information.
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
import { DoughnutChart } from '@spteck/fluentui-react-charts';
|
|
252
|
+
|
|
253
|
+
const expenseData = [
|
|
254
|
+
{ category: 'Personnel', amount: 450000 },
|
|
255
|
+
{ category: 'Infrastructure', amount: 180000 },
|
|
256
|
+
{ category: 'Marketing', amount: 120000 },
|
|
257
|
+
{ category: 'Operations', amount: 95000 },
|
|
258
|
+
{ category: 'Research', amount: 85000 },
|
|
259
|
+
];
|
|
260
|
+
|
|
261
|
+
<DoughnutChart
|
|
262
|
+
data={[{ label: 'Expenses', data: expenseData }]}
|
|
263
|
+
getLabel={(d) => d.category}
|
|
264
|
+
getValue={(d) => d.amount}
|
|
265
|
+
title="Expense Breakdown"
|
|
266
|
+
theme={webLightTheme}
|
|
267
|
+
/>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Specialized Charts
|
|
271
|
+
|
|
272
|
+
#### ComboChart
|
|
273
|
+
|
|
274
|
+
Combines multiple chart types (bar + line) in a single visualization.
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import { ComboChart } from '@spteck/fluentui-react-charts';
|
|
278
|
+
|
|
279
|
+
const salesData = [
|
|
280
|
+
{ month: 'Jan', value: 45000 },
|
|
281
|
+
{ month: 'Feb', value: 52000 },
|
|
282
|
+
{ month: 'Mar', value: 48000 },
|
|
283
|
+
{ month: 'Apr', value: 61000 },
|
|
284
|
+
{ month: 'May', value: 58000 },
|
|
285
|
+
{ month: 'Jun', value: 67000 },
|
|
286
|
+
];
|
|
287
|
+
|
|
288
|
+
const targetData = [
|
|
289
|
+
{ month: 'Jan', value: 50000 },
|
|
290
|
+
{ month: 'Feb', value: 55000 },
|
|
291
|
+
{ month: 'Mar', value: 53000 },
|
|
292
|
+
{ month: 'Apr', value: 58000 },
|
|
293
|
+
{ month: 'May', value: 60000 },
|
|
294
|
+
{ month: 'Jun', value: 65000 },
|
|
295
|
+
];
|
|
296
|
+
|
|
297
|
+
<ComboChart
|
|
298
|
+
data={[
|
|
299
|
+
{ label: 'Sales', data: salesData, type: 'bar' },
|
|
300
|
+
{ label: 'Target', data: targetData, type: 'line' }
|
|
301
|
+
]}
|
|
302
|
+
getPrimary={(d) => d.month}
|
|
303
|
+
getSecondary={(d) => d.value}
|
|
304
|
+
title="Sales vs Target"
|
|
305
|
+
theme={webLightTheme}
|
|
306
|
+
/>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
#### BubbleChart
|
|
310
|
+
|
|
311
|
+
Three-dimensional data visualization with x, y, and size dimensions.
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
import { BubbleChart } from '@spteck/fluentui-react-charts';
|
|
315
|
+
|
|
316
|
+
const performanceData = [
|
|
317
|
+
{ efficiency: 85, satisfaction: 88, teamSize: 12, team: 'Frontend' },
|
|
318
|
+
{ efficiency: 78, satisfaction: 82, teamSize: 8, team: 'Backend' },
|
|
319
|
+
{ efficiency: 92, satisfaction: 94, teamSize: 6, team: 'DevOps' },
|
|
320
|
+
{ efficiency: 88, satisfaction: 86, teamSize: 10, team: 'QA' },
|
|
321
|
+
{ efficiency: 75, satisfaction: 79, teamSize: 15, team: 'Support' },
|
|
322
|
+
];
|
|
323
|
+
|
|
324
|
+
<BubbleChart
|
|
325
|
+
data={[{ label: 'Performance', data: performanceData }]}
|
|
326
|
+
getX={(d) => d.efficiency}
|
|
327
|
+
getY={(d) => d.satisfaction}
|
|
328
|
+
getSize={(d) => d.teamSize}
|
|
329
|
+
title="Team Performance Analysis"
|
|
330
|
+
theme={webLightTheme}
|
|
331
|
+
/>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### ScatterChart
|
|
335
|
+
|
|
336
|
+
Shows correlations between two variables.
|
|
337
|
+
|
|
338
|
+
```tsx
|
|
339
|
+
import { ScatterChart } from '@spteck/fluentui-react-charts';
|
|
340
|
+
|
|
341
|
+
const correlationData = [
|
|
342
|
+
{ experience: 2, salary: 55000 },
|
|
343
|
+
{ experience: 5, salary: 72000 },
|
|
344
|
+
{ experience: 8, salary: 89000 },
|
|
345
|
+
{ experience: 12, salary: 105000 },
|
|
346
|
+
{ experience: 15, salary: 125000 },
|
|
347
|
+
{ experience: 18, salary: 142000 },
|
|
348
|
+
{ experience: 22, salary: 165000 },
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
<ScatterChart
|
|
352
|
+
data={[{ label: 'Correlation', data: correlationData }]}
|
|
353
|
+
getX={(d) => d.experience}
|
|
354
|
+
getY={(d) => d.salary}
|
|
355
|
+
title="Experience vs Salary"
|
|
356
|
+
theme={webLightTheme}
|
|
357
|
+
/>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### RadarChart
|
|
361
|
+
|
|
362
|
+
Multi-dimensional data comparison in a circular format.
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
import { RadarChart } from '@spteck/fluentui-react-charts';
|
|
366
|
+
|
|
367
|
+
const skillsData = [
|
|
368
|
+
{ skill: 'Communication', level: 85 },
|
|
369
|
+
{ skill: 'Technical Skills', level: 92 },
|
|
370
|
+
{ skill: 'Leadership', level: 78 },
|
|
371
|
+
{ skill: 'Problem Solving', level: 88 },
|
|
372
|
+
{ skill: 'Teamwork', level: 90 },
|
|
373
|
+
{ skill: 'Creativity', level: 82 },
|
|
374
|
+
];
|
|
375
|
+
|
|
376
|
+
<RadarChart
|
|
377
|
+
data={[{ label: 'Skills', data: skillsData }]}
|
|
378
|
+
getLabel={(d) => d.skill}
|
|
379
|
+
getValue={(d) => d.level)
|
|
380
|
+
title="Skill Assessment"
|
|
381
|
+
theme={webLightTheme}
|
|
382
|
+
/>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### PolarChart
|
|
386
|
+
|
|
387
|
+
Circular chart with radial and angular dimensions.
|
|
388
|
+
|
|
389
|
+
```tsx
|
|
390
|
+
import { PolarChart } from '@spteck/fluentui-react-charts';
|
|
391
|
+
|
|
392
|
+
const metricsData = [
|
|
393
|
+
{ category: 'Speed', value: 85 },
|
|
394
|
+
{ category: 'Reliability', value: 92 },
|
|
395
|
+
{ category: 'Usability', value: 78 },
|
|
396
|
+
{ category: 'Security', value: 88 },
|
|
397
|
+
{ category: 'Scalability', value: 75 },
|
|
398
|
+
{ category: 'Maintainability', value: 82 },
|
|
399
|
+
];
|
|
400
|
+
|
|
401
|
+
<PolarChart
|
|
402
|
+
data={[{ label: 'Metrics', data: metricsData }]}
|
|
403
|
+
getLabel={(d) => d.category}
|
|
404
|
+
getValue={(d) => d.value}
|
|
405
|
+
title="Performance Metrics"
|
|
406
|
+
theme={webLightTheme}
|
|
407
|
+
/>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
*Interactive chart components with Fluent UI design system
|
|
411
|
+
|
|
412
|
+
## 🎨 Theming
|
|
413
|
+
|
|
414
|
+
All charts support Fluent UI themes for consistent styling:
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
import { webLightTheme, webDarkTheme, teamsLightTheme } from '@fluentui/react-components';
|
|
418
|
+
|
|
419
|
+
// Light theme
|
|
420
|
+
<BarChart theme={webLightTheme} {...props} />
|
|
421
|
+
|
|
422
|
+
// Dark theme
|
|
423
|
+
<BarChart theme={webDarkTheme} {...props} />
|
|
424
|
+
|
|
425
|
+
// Teams theme
|
|
426
|
+
<BarChart theme={teamsLightTheme} {...props} />
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## 📱 Responsive Design
|
|
430
|
+
|
|
431
|
+
Charts automatically adapt to their container:
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
<div style={{ width: '100%', height: '400px' }}>
|
|
435
|
+
<BarChart {...props} />
|
|
436
|
+
</div>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## 🔧 Common Props
|
|
440
|
+
|
|
441
|
+
Most charts share these common properties:
|
|
442
|
+
|
|
443
|
+
| Prop | Type | Description |
|
|
444
|
+
|------|------|-------------|
|
|
445
|
+
| `data` | `IChart<T>[]` | Array of data series |
|
|
446
|
+
| `title` | `string` | Chart title |
|
|
447
|
+
| `theme` | `Theme` | Fluent UI theme |
|
|
448
|
+
| `showDataLabels` | `boolean` | Show values on chart elements |
|
|
449
|
+
| `showLegend` | `boolean` | Display interactive legend |
|
|
450
|
+
| `height` | `number` | Chart height in pixels |
|
|
451
|
+
| `width` | `number` | Chart width in pixels |
|
|
452
|
+
|
|
453
|
+
## 💼 Custom Features & Source Code
|
|
454
|
+
|
|
455
|
+
This is a private project. If you need additional features or access to the source code, please contact me directly .
|
|
456
|
+
|
|
457
|
+
## 📞 Contact
|
|
458
|
+
|
|
459
|
+
For any questions, issues, or feature requests, please reach out:
|
|
460
|
+
|
|
461
|
+
- **Email**: [joao..j.mendes@spteck.com](mailto:joao.j.mendes@spteck.com)
|
|
462
|
+
- **LinkedIn**: [João Mendes](https://www.linkedin.com/in/joaojmendes/)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface BarProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
type?: 'bar' | 'line';
|
|
8
|
+
}[];
|
|
9
|
+
getPrimary: (datum: T) => string | number;
|
|
10
|
+
getSecondary: (datum: T) => number;
|
|
11
|
+
stacked?: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
showDatalabels?: boolean;
|
|
14
|
+
theme: Theme;
|
|
15
|
+
}
|
|
16
|
+
export default function BarChart<T extends object>({ data, getPrimary, getSecondary, title, showDatalabels, stacked, theme, }: BarProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BarChart';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface ComboChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
type: 'bar' | 'line';
|
|
7
|
+
data: T[];
|
|
8
|
+
yAxisID?: string;
|
|
9
|
+
}[];
|
|
10
|
+
getPrimary: (datum: T) => string | number;
|
|
11
|
+
getSecondary: (datum: T) => number;
|
|
12
|
+
title?: string;
|
|
13
|
+
showDataLabels?: boolean;
|
|
14
|
+
theme?: Theme;
|
|
15
|
+
}
|
|
16
|
+
export default function ComboChart<T extends object>({ data, getPrimary, getSecondary, title, showDataLabels, theme, }: ComboChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ComboChart';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface DoughnutChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getLabel: (datum: T) => string;
|
|
9
|
+
getValue: (datum: T) => number;
|
|
10
|
+
title?: string;
|
|
11
|
+
showDataLabels?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
}
|
|
14
|
+
export default function DoughnutChart<T extends object>({ data, getLabel, getValue, title, showDataLabels, theme, }: DoughnutChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DoughnutChart';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface PieChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getLabel: (datum: T) => string;
|
|
9
|
+
getValue: (datum: T) => number;
|
|
10
|
+
title?: string;
|
|
11
|
+
showDataLabels?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
}
|
|
14
|
+
export default function PieChart<T extends object>({ data, getLabel, getValue, title, showDataLabels, theme, }: PieChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PieChart';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface AreaChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getPrimary: (datum: T) => string | number;
|
|
9
|
+
getSecondary: (datum: T) => number;
|
|
10
|
+
stacked?: boolean;
|
|
11
|
+
title?: string;
|
|
12
|
+
showDatalabels?: boolean;
|
|
13
|
+
theme?: Theme;
|
|
14
|
+
}
|
|
15
|
+
export default function AreaChart<T extends object>({ data, getPrimary, getSecondary, title, showDatalabels, theme, stacked, }: AreaChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AreaChart';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-theme';
|
|
3
|
+
export interface BarHorizontalProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getPrimary: (datum: T) => string | number;
|
|
9
|
+
getSecondary: (datum: T) => number;
|
|
10
|
+
stacked?: boolean;
|
|
11
|
+
title?: string;
|
|
12
|
+
showDatalabels?: boolean;
|
|
13
|
+
theme: Theme;
|
|
14
|
+
}
|
|
15
|
+
export default function BarHorizontalChart<T extends object>({ data, getPrimary, getSecondary, stacked, showDatalabels, title, theme }: BarHorizontalProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BarHotizontalChart';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface BubbleChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getPrimary: (datum: T) => string | number | Date;
|
|
9
|
+
getSecondary: (datum: T) => number;
|
|
10
|
+
getRadius: (datum: T) => number;
|
|
11
|
+
title?: string;
|
|
12
|
+
showDataLabels?: boolean;
|
|
13
|
+
theme?: Theme;
|
|
14
|
+
}
|
|
15
|
+
export default function BubbleChart<T extends object>({ data, getPrimary, getSecondary, getRadius, showDataLabels, title, theme, }: BubbleChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BubbleChart';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface FloatingBarChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getPrimary: (datum: T) => string | number;
|
|
9
|
+
getRange: (datum: T) => [number, number];
|
|
10
|
+
title?: string;
|
|
11
|
+
showDataLabels?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
}
|
|
14
|
+
export default function FloatingBarChart<T extends object>({ data, getPrimary, getRange, title, showDataLabels, theme, }: FloatingBarChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FloatBarChart';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface LineChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getPrimary: (datum: T) => string | number;
|
|
9
|
+
getSecondary: (datum: T) => number;
|
|
10
|
+
title?: string;
|
|
11
|
+
showDataLabels?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
}
|
|
14
|
+
export default function LineChart<T extends object>({ data, getPrimary, getSecondary, title, showDataLabels, theme, }: LineChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LineChart';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface PolarChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getLabel: (datum: T) => string;
|
|
9
|
+
getValue: (datum: T) => number;
|
|
10
|
+
title?: string;
|
|
11
|
+
showDataLabels?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
}
|
|
14
|
+
export default function PolarChart<T extends object>({ data, getLabel, getValue, title, showDataLabels, theme, }: PolarChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PolarChart';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@fluentui/react-components';
|
|
3
|
+
export interface RadarChartProps<T> {
|
|
4
|
+
data: {
|
|
5
|
+
label: string;
|
|
6
|
+
data: T[];
|
|
7
|
+
}[];
|
|
8
|
+
getLabel: (datum: T) => string;
|
|
9
|
+
getValue: (datum: T) => number;
|
|
10
|
+
title?: string;
|
|
11
|
+
showDataLabels?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
}
|
|
14
|
+
export default function RadarChart<T extends object>({ data, getLabel, getValue, title, showDataLabels, theme, }: RadarChartProps<T>): React.JSX.Element;
|