@spteck/fluentui-react-charts 1.0.7 → 1.0.9

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.
Files changed (105) hide show
  1. package/dist/charts/BarChart/BarChart.d.ts +2 -1
  2. package/dist/charts/ComboChart/ComboChart.d.ts +2 -1
  3. package/dist/charts/Doughnut/DoughnutChart.d.ts +2 -1
  4. package/dist/charts/PieChart/PieChart.d.ts +2 -1
  5. package/dist/charts/areaChart/AreaChart.d.ts +2 -1
  6. package/dist/charts/barHorizontalChart/BarHotizontalChart.d.ts +2 -1
  7. package/dist/charts/bubbleChart/BubbleChart.d.ts +2 -1
  8. package/dist/charts/floatBarChart/FloatBarChart.d.ts +2 -1
  9. package/dist/charts/index.d.ts +14 -0
  10. package/dist/charts/lineChart/LineChart.d.ts +2 -1
  11. package/dist/charts/polarChart/PolarChart.d.ts +2 -1
  12. package/dist/charts/radarChart/RadarChart.d.ts +2 -1
  13. package/dist/charts/scatterChart/ScatterChart.d.ts +2 -1
  14. package/dist/charts/stackedLineChart/StackedLineChart.d.ts +2 -1
  15. package/dist/charts/steamChart/SteamChart.d.ts +2 -1
  16. package/dist/components/index.d.ts +0 -14
  17. package/dist/fluentui-react-charts.cjs.development.js +1086 -1072
  18. package/dist/fluentui-react-charts.cjs.development.js.map +1 -1
  19. package/dist/fluentui-react-charts.cjs.production.min.js +1 -1
  20. package/dist/fluentui-react-charts.cjs.production.min.js.map +1 -1
  21. package/dist/fluentui-react-charts.esm.js +1074 -1074
  22. package/dist/fluentui-react-charts.esm.js.map +1 -1
  23. package/dist/index.d.ts +1 -0
  24. package/package.json +5 -5
  25. package/src/assets/sample1.png +0 -0
  26. package/src/assets/sample2.png +0 -0
  27. package/src/assets/sample3.png +0 -0
  28. package/src/charts/BarChart/BarChart.tsx +0 -227
  29. package/src/charts/BarChart/README.MD +0 -335
  30. package/src/charts/BarChart/index.ts +0 -1
  31. package/src/charts/ComboChart/ComboChart.tsx +0 -209
  32. package/src/charts/ComboChart/README.MD +0 -347
  33. package/src/charts/ComboChart/index.ts +0 -1
  34. package/src/charts/Doughnut/DoughnutChart.tsx +0 -152
  35. package/src/charts/Doughnut/README.MD +0 -296
  36. package/src/charts/Doughnut/index.ts +0 -1
  37. package/src/charts/PieChart/PieChart.tsx +0 -148
  38. package/src/charts/PieChart/README.MD +0 -315
  39. package/src/charts/PieChart/index.ts +0 -1
  40. package/src/charts/areaChart/AreaChart.tsx +0 -195
  41. package/src/charts/areaChart/README.MD +0 -236
  42. package/src/charts/areaChart/index.ts +0 -1
  43. package/src/charts/barHorizontalChart/BarHotizontalChart.tsx +0 -200
  44. package/src/charts/barHorizontalChart/README.MD +0 -278
  45. package/src/charts/barHorizontalChart/index.ts +0 -2
  46. package/src/charts/bubbleChart/BubbleChart.tsx +0 -184
  47. package/src/charts/bubbleChart/README.MD +0 -275
  48. package/src/charts/bubbleChart/index.ts +0 -1
  49. package/src/charts/floatBarChart/FloatBarChart.tsx +0 -178
  50. package/src/charts/floatBarChart/README.MD +0 -354
  51. package/src/charts/floatBarChart/index.ts +0 -1
  52. package/src/charts/lineChart/LineChart.tsx +0 -200
  53. package/src/charts/lineChart/README.MD +0 -354
  54. package/src/charts/lineChart/index.ts +0 -1
  55. package/src/charts/polarChart/PolarChart.tsx +0 -161
  56. package/src/charts/polarChart/README.MD +0 -336
  57. package/src/charts/polarChart/index.ts +0 -1
  58. package/src/charts/radarChart/README.MD +0 -388
  59. package/src/charts/radarChart/RadarChart.tsx +0 -173
  60. package/src/charts/radarChart/index.ts +0 -1
  61. package/src/charts/scatterChart/README.MD +0 -335
  62. package/src/charts/scatterChart/ScatterChart.tsx +0 -155
  63. package/src/charts/scatterChart/index.ts +0 -1
  64. package/src/charts/stackedLineChart/README.MD +0 -396
  65. package/src/charts/stackedLineChart/StackedLineChart.tsx +0 -188
  66. package/src/charts/stackedLineChart/index.ts +0 -1
  67. package/src/charts/steamChart/README.MD +0 -414
  68. package/src/charts/steamChart/SteamChart.tsx +0 -236
  69. package/src/charts/steamChart/index.ts +0 -1
  70. package/src/components/RenderLabel/RenderLabel.tsx +0 -39
  71. package/src/components/RenderLabel/index.ts +0 -2
  72. package/src/components/RenderLabel/useRenderLabelStylesStyles.ts +0 -25
  73. package/src/components/RenderLegend/RenderLegend.tsx +0 -40
  74. package/src/components/RenderTooltip/RenderTooltip.tsx +0 -111
  75. package/src/components/buttonMenu/ButtonMenu.tsx +0 -186
  76. package/src/components/buttonMenu/IButtonMenuOption.ts +0 -9
  77. package/src/components/buttonMenu/IButtonMenuProps.tsx +0 -40
  78. package/src/components/dashboard/DashBoard.tsx +0 -314
  79. package/src/components/dashboard/ExampleDashboardUsage.tsx +0 -114
  80. package/src/components/dashboard/IDashboardProps.tsx +0 -11
  81. package/src/components/dashboard/NoDashboards.tsx +0 -26
  82. package/src/components/dashboard/index.ts +0 -3
  83. package/src/components/dashboard/selectZoom/SelectZoom.tsx +0 -184
  84. package/src/components/dashboard/useDashboardStyles.ts +0 -76
  85. package/src/components/index.ts +0 -17
  86. package/src/components/legendContainer/LegendContainer.tsx +0 -118
  87. package/src/components/legendeButton/LegendButton.tsx +0 -57
  88. package/src/components/renderSliceLegend/RenderSliceLegend.tsx +0 -46
  89. package/src/components/renderValueLegend/RenderValueLegend.tsx +0 -43
  90. package/src/components/stack/IStackProps.tsx +0 -94
  91. package/src/components/stack/Stack.tsx +0 -103
  92. package/src/components/svgImages/BusinessReportIcon.tsx +0 -218
  93. package/src/components/themeProvider/ThemeProvider.tsx +0 -48
  94. package/src/constants/Constants.tsx +0 -23
  95. package/src/graphGlobalStyles/useGraphGlobalStyles.ts +0 -28
  96. package/src/hooks/index.ts +0 -1
  97. package/src/hooks/useChartFactory.tsx +0 -136
  98. package/src/hooks/useChartUtils.tsx +0 -187
  99. package/src/hooks/useIndexedDBCache.ts +0 -119
  100. package/src/hooks/useResponsiveLegend.ts +0 -35
  101. package/src/index.tsx +0 -5
  102. package/src/models/ChartDatum.ts +0 -4
  103. package/src/models/ICardChartContainer.tsx +0 -11
  104. package/src/models/IChart.ts +0 -50
  105. package/src/models/index.ts +0 -3
@@ -1,336 +0,0 @@
1
- # PolarChart Component
2
-
3
- A specialized polar area chart component built with Chart.js and Fluent UI React. This component displays data as circular segments with variable radii, making it perfect for visualizing multi-dimensional data where both the angle and radius represent different aspects of the data. It combines the circular nature of pie charts with the radial scaling of radar charts.
4
-
5
- ## Features
6
-
7
- - **Radial Data Visualization**: Display data with both angular and radial dimensions
8
- - **Value Aggregation**: Automatically aggregates values across multiple series for the same labels
9
- - **Interactive Slice Legend**: Toggle segments visibility with click interactions
10
- - **Radial Grid System**: Concentric circles showing value scales
11
- - **Fluent UI Integration**: Seamless integration with Fluent UI themes and design system
12
- - **Data Labels**: Optional display of values directly on chart segments
13
- - **Responsive Design**: Automatically adapts to container dimensions
14
- - **TypeScript Support**: Full TypeScript support with generic types
15
- - **Custom Tooltips**: Rich tooltips showing detailed segment information
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install chart.js react-chartjs-2 chartjs-plugin-datalabels @fluentui/react-components
21
- ```
22
-
23
- ## Basic Usage
24
-
25
- ```tsx
26
- import React from 'react';
27
- import { PolarChart } from './components/polarChart/PolarChart';
28
- import { webLightTheme } from '@fluentui/react-components';
29
-
30
- interface PerformanceData {
31
- metric: string;
32
- score: number;
33
- }
34
-
35
- const performanceData: PerformanceData[] = [
36
- { metric: 'Speed', score: 85 },
37
- { metric: 'Reliability', score: 92 },
38
- { metric: 'Usability', score: 78 },
39
- { metric: 'Security', score: 88 },
40
- { metric: 'Scalability', score: 75 },
41
- ];
42
-
43
- function App() {
44
- return (
45
- <div style={{ width: '600px', height: '500px' }}>
46
- <PolarChart
47
- data={[
48
- { label: 'Performance Metrics', data: performanceData }
49
- ]}
50
- getLabel={(datum) => datum.metric}
51
- getValue={(datum) => datum.score}
52
- title="System Performance Analysis"
53
- theme={webLightTheme}
54
- />
55
- </div>
56
- );
57
- }
58
- ```
59
-
60
- ## Props
61
-
62
- ### PolarChartProps<T>
63
-
64
- | Prop | Type | Required | Default | Description |
65
- |------|------|----------|---------|-------------|
66
- | `data` | `{ label: string; data: T[] }[]` | Yes | - | Array of data series with labels and data points |
67
- | `getLabel` | `(datum: T) => string` | Yes | - | Function to extract the segment label from each data point |
68
- | `getValue` | `(datum: T) => number` | Yes | - | Function to extract the radial value from each data point |
69
- | `title` | `string` | No | - | Chart title displayed at the top |
70
- | `showDataLabels` | `boolean` | No | `true` | Whether to show data values on chart segments |
71
- | `theme` | `Theme` | No | `webLightTheme` | Fluent UI theme object for styling |
72
-
73
- ## Advanced Usage
74
-
75
- ### Multi-dimensional Performance Analysis
76
-
77
- ```tsx
78
- interface TeamPerformance {
79
- skill: string;
80
- currentLevel: number;
81
- targetLevel: number;
82
- importance: number;
83
- }
84
-
85
- const teamSkills: TeamPerformance[] = [
86
- { skill: 'Technical Skills', currentLevel: 85, targetLevel: 90, importance: 95 },
87
- { skill: 'Communication', currentLevel: 78, targetLevel: 85, importance: 88 },
88
- { skill: 'Leadership', currentLevel: 72, targetLevel: 80, importance: 82 },
89
- { skill: 'Problem Solving', currentLevel: 88, targetLevel: 92, importance: 90 },
90
- { skill: 'Teamwork', currentLevel: 82, targetLevel: 88, importance: 85 },
91
- ];
92
-
93
- <PolarChart
94
- data={[
95
- {
96
- label: 'Current Performance',
97
- data: teamSkills.map(s => ({ skill: s.skill, value: s.currentLevel }))
98
- },
99
- {
100
- label: 'Target Performance',
101
- data: teamSkills.map(s => ({ skill: s.skill, value: s.targetLevel }))
102
- }
103
- ]}
104
- getLabel={(datum) => datum.skill}
105
- getValue={(datum) => datum.value}
106
- title="Team Skills Assessment"
107
- showDataLabels={true}
108
- theme={webLightTheme}
109
- />
110
- ```
111
-
112
- ### Product Feature Satisfaction
113
-
114
- ```tsx
115
- interface FeatureSatisfaction {
116
- feature: string;
117
- satisfaction: number;
118
- usage: number;
119
- priority: number;
120
- }
121
-
122
- const featureData: FeatureSatisfaction[] = [
123
- { feature: 'User Interface', satisfaction: 88, usage: 95, priority: 90 },
124
- { feature: 'Performance', satisfaction: 82, usage: 88, priority: 95 },
125
- { feature: 'Security', satisfaction: 90, usage: 75, priority: 88 },
126
- { feature: 'Mobile Support', satisfaction: 75, usage: 85, priority: 82 },
127
- { feature: 'Integration', satisfaction: 78, usage: 70, priority: 75 },
128
- ];
129
-
130
- <PolarChart
131
- data={[{ label: 'Feature Satisfaction', data: featureData }]}
132
- getLabel={(datum) => datum.feature}
133
- getValue={(datum) => datum.satisfaction}
134
- title="Product Feature Satisfaction Scores"
135
- showDataLabels={true}
136
- theme={webLightTheme}
137
- />
138
- ```
139
-
140
- ### Risk Assessment Matrix
141
-
142
- ```tsx
143
- interface RiskFactor {
144
- category: string;
145
- probability: number;
146
- impact: number;
147
- riskScore: number;
148
- }
149
-
150
- const riskData: RiskFactor[] = [
151
- { category: 'Market Risk', probability: 60, impact: 85, riskScore: 75 },
152
- { category: 'Technical Risk', probability: 40, impact: 70, riskScore: 55 },
153
- { category: 'Financial Risk', probability: 30, impact: 90, riskScore: 65 },
154
- { category: 'Operational Risk', probability: 50, impact: 60, riskScore: 55 },
155
- { category: 'Regulatory Risk', probability: 25, impact: 95, riskScore: 70 },
156
- ];
157
-
158
- <PolarChart
159
- data={[{ label: 'Risk Assessment', data: riskData }]}
160
- getLabel={(datum) => datum.category}
161
- getValue={(datum) => datum.riskScore}
162
- title="Project Risk Analysis"
163
- showDataLabels={true}
164
- theme={webLightTheme}
165
- />
166
- ```
167
-
168
- ### Customer Satisfaction by Region
169
-
170
- ```tsx
171
- interface RegionalSatisfaction {
172
- region: string;
173
- satisfaction: number;
174
- customerCount: number;
175
- responseRate: number;
176
- }
177
-
178
- const satisfactionData: RegionalSatisfaction[] = [
179
- { region: 'North America', satisfaction: 88, customerCount: 1500, responseRate: 75 },
180
- { region: 'Europe', satisfaction: 82, customerCount: 1200, responseRate: 68 },
181
- { region: 'Asia Pacific', satisfaction: 85, customerCount: 1800, responseRate: 72 },
182
- { region: 'Latin America', satisfaction: 78, customerCount: 800, responseRate: 65 },
183
- { region: 'Middle East', satisfaction: 80, customerCount: 600, responseRate: 70 },
184
- ];
185
-
186
- <PolarChart
187
- data={[{ label: 'Customer Satisfaction', data: satisfactionData }]}
188
- getLabel={(datum) => datum.region}
189
- getValue={(datum) => datum.satisfaction}
190
- title="Customer Satisfaction by Region"
191
- showDataLabels={true}
192
- theme={webLightTheme}
193
- />
194
- ```
195
-
196
- ## Data Structure
197
-
198
- The component expects data in the following format:
199
-
200
- ```tsx
201
- interface ChartSeries<T> {
202
- label: string; // Series name (for multiple data sources)
203
- data: T[]; // Array of data points
204
- }
205
- ```
206
-
207
- Each data point `T` should contain:
208
-
209
- - A label value (segment name) - string
210
- - A numeric value (radial distance) - number
211
-
212
- ## Polar Area Chart Characteristics
213
-
214
- ### Radial Scaling
215
-
216
- - **Angle**: Represents categories (equally spaced)
217
- - **Radius**: Represents values (proportional to data)
218
- - **Area**: Combination of angle and radius creates segment area
219
-
220
- ### Visual Interpretation
221
-
222
- - Larger values extend further from center
223
- - Equal angles for all categories
224
- - Area represents the magnitude of each category
225
-
226
- ## Use Cases
227
-
228
- Polar area charts are particularly effective for:
229
-
230
- ### Performance Analysis
231
-
232
- - **Skill Assessment**: Multi-dimensional skill evaluation
233
- - **Quality Metrics**: Various quality dimensions
234
- - **System Performance**: Different performance aspects
235
-
236
- ### Comparative Analysis
237
-
238
- - **Feature Comparison**: Product features across different dimensions
239
- - **Regional Analysis**: Performance metrics across different regions
240
- - **Time-based Comparison**: Same metrics at different time periods
241
-
242
- ### Risk and Assessment
243
-
244
- - **Risk Factors**: Different risk categories and their impact
245
- - **Satisfaction Surveys**: Various satisfaction dimensions
246
- - **Audit Results**: Compliance scores across different areas
247
-
248
- ## Interactive Features
249
-
250
- ### Slice Legend
251
-
252
- - Click legend items to show/hide segments
253
- - Visual feedback on hover states
254
- - Maintains proportional relationships when segments are hidden
255
- - Color-coded entries matching chart segments
256
-
257
- ### Segment Interactions
258
-
259
- - Hover effects on polar segments
260
- - Rich tooltips showing detailed information
261
- - Smooth animations and transitions
262
-
263
- ### Radial Grid
264
-
265
- - Concentric circles showing value scales
266
- - Customizable grid lines and labels
267
- - Theme-aware styling
268
-
269
- ## Styling and Theme Integration
270
-
271
- The component uses Fluent UI theme tokens:
272
-
273
- ```tsx
274
- // Segment colors
275
- backgroundColor: Derived from theme palette with lightening
276
- borderWidth: 1
277
-
278
- // Radial scale
279
- tickColor: theme.colorNeutralForeground1
280
- gridColor: theme.colorNeutralStroke2
281
- backdropColor: 'transparent'
282
-
283
- // Typography
284
- fontFamily: theme.fontFamilyBase
285
- fontSize: theme.fontSizeBase200
286
- fontWeight: theme.fontWeightSemibold
287
- color: theme.colorNeutralForeground1
288
- ```
289
-
290
- ## Performance Optimizations
291
-
292
- The component includes several React optimizations:
293
-
294
- ````tsx
295
- // Memoized value aggregation
296
- const valueMap = useMemo(() => {
297
- const map = new Map<string, number>();
298
- data.forEach(series => {
299
- series.data.forEach(d => {
300
- const label = getLabel(d);
301
- const value = getValue(d);
302
- map.set(label, (map.get(label) || 0) + value);
303
- });
304
- });
305
- return map;
306
- }, [data, getLabel, getValue]);
307
-
308
- // Memoized color and data calculations
309
- const { allLabels, colors, filteredLabels, values, visibleColors } = useMemo(() => {
310
- const allLabels = Array.from(valueMap.keys());
311
- const palette = getFluentPalette(theme);
312
- const colors = allLabels.map((_, i) =>
313
- lightenColor(palette[i % palette.length], 0.3)
314
- );
315
-
316
- const filteredLabels = allLabels.filter(
317
- label => !hiddenLabels.includes(label)
318
- );
319
- const values = filteredLabels.map(label => valueMap.get(label) || 0);
320
- const visibleColors = filteredLabels.map(label => {
321
- const idx = allLabels.indexOf(label);
322
- return colors[idx];
323
- });
324
-
325
- return { allLabels, colors, filteredLabels, values, visibleColors };
326
- }, [valueMap, getFluentPalette, lightenColor, theme, hiddenLabels]);
327
-
328
- // Memoized chart data
329
- const chartData = useMemo(() => ({
330
- labels: filteredLabels,
331
- datasets: [{
332
- data: values,
333
- backgroundColor: visibleColors,
334
- borderWidth: 1,
335
- }],
336
- }), [filteredLabels, values, visibleColors]);
@@ -1 +0,0 @@
1
- export * from './PolarChart';