[dev-v5] Add Charts package (DonutChart HorizontalBarChart and HorizontalBarChartWithAxis)#4691
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Blazor wrappers, models, and demo documentation/examples for Fluent UI chart web components (DonutChart and HorizontalBarChart), including script-side registration and JSON source-generation helpers.
Changes:
- Introduces new chart components (
FluentDonutChart,FluentHorizontalBarChart) and their data models/serializer contexts. - Registers
@fluentui/chart-web-componentsand defines chart web components in the scripts package. - Adds demo documentation pages and multiple usage examples for both charts.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj | Minor MSBuild formatting change for temporary .esproj asset fix target. |
| src/Core/Enums/HorizontalBarChartVariant.cs | Adds an enum to control HorizontalBarChart rendering variants. |
| src/Core/Components/Charts/Models/HorizontalBarChartModels.cs | Adds HorizontalBarChart payload models for JSON serialization. |
| src/Core/Components/Charts/Models/HorizontalBarChartDataJsonSerializerContext.cs | Adds source-generated JSON serialization context for HorizontalBarChart models. |
| src/Core/Components/Charts/Models/DonutChartModels.cs | Adds DonutChart payload models for JSON serialization. |
| src/Core/Components/Charts/Models/DonutChartDataJsonSerializerContext.cs | Adds source-generated JSON serialization context for DonutChart models. |
| src/Core/Components/Charts/FluentHorizontalBarChart.razor.cs | Adds Blazor wrapper logic/parameters for HorizontalBarChart. |
| src/Core/Components/Charts/FluentHorizontalBarChart.razor | Adds the Razor markup to render the horizontal bar chart web component. |
| src/Core/Components/Charts/FluentDonutChart.razor.cs | Adds Blazor wrapper logic/parameters for DonutChart. |
| src/Core/Components/Charts/FluentDonutChart.razor | Adds the Razor markup to render the donut chart web component. |
| src/Core/Components/Charts/ChartJson.cs | Adds shared JSON serialization helper methods for chart payloads. |
| src/Core.Scripts/src/FluentUIWebComponents.ts | Registers chart web components in the custom element registry. |
| src/Core.Scripts/package.json | Adds @fluentui/chart-web-components dependency. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Pages/FluentHorizontalBarChartPage.md | Adds docs page for HorizontalBarChart with examples and API sections. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Pages/FluentDonutChartPage.md | Adds docs page for DonutChart with examples and API sections. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/FluentUIChartsPage.md | Adds a Charts landing page listing available chart types. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/HorizontalBarChartSingleDataPoint.razor | Adds demo example for single data point HorizontalBarChart. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/HorizontalBarChartSingleBarNMVariant.razor | Adds demo example for SingleBar “n/M” style scenario. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/HorizontalBarChartSingleBar.razor | Adds demo example for AbsoluteScale SingleBar HorizontalBarChart. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/HorizontalBarChartDefaultRTL.razor | Adds RTL HorizontalBarChart demo example. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/HorizontalBarChartDefault.razor | Adds default HorizontalBarChart demo example. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/HorizontalBarChartBenchmark.razor | Adds benchmark HorizontalBarChart demo example. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/DonutChartDefaultRTL.razor | Adds RTL DonutChart demo example. |
| examples/Demo/FluentUI.Demo.Client/Documentation/Components/Charts/Examples/DonutChartDefault.razor | Adds default DonutChart demo example. |
Files not reviewed (1)
- src/Core.Scripts/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…kage so there isno chart related code in the core scripts anymore.
…b-component package but finished source is copied here. This because we cannot publisch/update the npm package
…os and docs pages
- Organize examples
- Ignore playwright screenshots and chart-comments files
- Fix HBCWA color handling - Fix HBCWA Blazor example
- Update docs
|
@vnbaaij I tried to test this but the project won't compile for me. Do I need to change something in my config? |
…-specific packages
- Re-add Core SDK 9.0.300 build fix
|
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 98.7%
|
There were some issues with the |
|
Great work @vnbaaij ! Looks very promising! I only got one question regarding the examples. Why are you doing |
|
I'm converting the charts to be block level elements (they were inline-block). Samples will be updated too. |
This PR adds the Charts package. The charts are built as web components which integrate tightly with the Design System and the other Fluent UI Web Components. The basis is formed by the
fluent-donut-chartand andfluent-horizontal-bar-chartcomponents that were created by the Fluent UI team about a year ago. These 2 components have been altered and extended by us to make them work perfectly with ourFluentDonutChartandFluentHorizontalBarChartwrapper components. For now we've extendd the set with thefluent-horizontal-bar-chart-with-axisweb component and it's correspondingFluentHorizontalBarChartWithAxisBlazor wrapper.In the future we intend to add more web components and wrappers based on the Fluent UI React charts v9 set.
The Fluent UI Blazor Charts NuGet package needs to be installed separately from the Core components package. All charts are in the
Microsoft.FluentUI.AspNetCore.Components.Chartsnamespace. Configuration, referencing scripts, etc, is all done automatically. The core library will detect the charts being there.DonutChart
HorizontalBarChart
HorizontalBarChartWithAxis
There are no separate unit tests for the charts. All tests and storybook stories are part of the charts web component project (source will be made available)