Skip to content

[dev-v5] Add Charts package (Donut, Funnel, Horizontal bar and Horizontal bar with Axis)#4691

Open
vnbaaij wants to merge 58 commits into
dev-v5from
charts
Open

[dev-v5] Add Charts package (Donut, Funnel, Horizontal bar and Horizontal bar with Axis)#4691
vnbaaij wants to merge 58 commits into
dev-v5from
charts

Conversation

@vnbaaij
Copy link
Copy Markdown
Collaborator

@vnbaaij vnbaaij commented Apr 13, 2026

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-chart and and fluent-horizontal-bar-chart components 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 our FluentDonutChart and FluentHorizontalBarChart wrapper components. For now we've extendd the set with the fluent-horizontal-bar-chart-with-axis web component and it's corresponding FluentHorizontalBarChartWithAxis Blazor 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.Charts namespace. Configuration, referencing scripts, etc, is all done automatically. The core library will detect the charts being there.

DonutChart

image

HorizontalBarChart

image image

HorizontalBarChartWithAxis

image

FunnelChart

image

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)

Copilot AI review requested due to automatic review settings April 13, 2026 20:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-components and 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.

Comment thread src/Core/Components/Charts/FluentHorizontalBarChart.razor.cs Outdated
Comment thread src/Core/Components/Charts/FluentHorizontalBarChart.razor.cs Outdated
Comment thread src/Charts/Charts/HorizontalBarChart/FluentHorizontalBarChart.razor
Comment thread src/Core/Components/Charts/FluentDonutChart.razor Outdated
Comment thread src/Core/Components/Charts/FluentHorizontalBarChart.razor.cs Outdated
Comment thread src/Core/Enums/HorizontalBarChartVariant.cs Outdated
Comment thread src/Core/Enums/HorizontalBarChartVariant.cs Outdated
@vnbaaij vnbaaij marked this pull request as ready for review May 11, 2026 19:20
@vnbaaij vnbaaij requested a review from dvoituron as a code owner May 11, 2026 19:20
@vnbaaij vnbaaij changed the title [dev-v5][Charts] Add DonutChart and HorizontalBarChart [dev-v5][Charts] Add Charts package (DonutChart HorizontalBarChart and HorizontalBarChartWithAxis) May 11, 2026
@vnbaaij vnbaaij added this to the v5.0-RC3 milestone May 11, 2026
@vnbaaij vnbaaij changed the title [dev-v5][Charts] Add Charts package (DonutChart HorizontalBarChart and HorizontalBarChartWithAxis) [dev-v5] Add Charts package (DonutChart HorizontalBarChart and HorizontalBarChartWithAxis) May 11, 2026
@vnbaaij
Copy link
Copy Markdown
Collaborator Author

vnbaaij commented May 12, 2026

Do I need to change something in my config?

There were some issues with the package-lock.json and where the packages were getting installed from. Those have been solved now. Cloning and compiling should be enough to get it going.

@MarvinKlein1508
Copy link
Copy Markdown
Collaborator

Great work @vnbaaij ! Looks very promising!

I only got one question regarding the examples. Why are you doing Style="width: 100%;" here in most of the cases? Should the charts be a block level element which have 100% by default? And if not why not use Width and Height parameters like in some examples. Is there a difference in using Style for setting the width over the parameter?

@vnbaaij
Copy link
Copy Markdown
Collaborator Author

vnbaaij commented May 13, 2026

I'm converting the charts to be block level elements (they were inline-block). Samples will be updated too.

vnbaaij added 11 commits May 13, 2026 22:12
- Add DataVizPalette enum for colors used in charts (needs to be implemented for the other chart types still
- Add arrow key navigation to legend
- Introduced `selected` observable for persistent legend selection.
- Updated legend styles for improved visibility with adjusted opacity.
- Enhanced event handling for legend focus to differentiate between mouse and keyboard interactions.
- Adjusted chart layout and styles for better user experience.
@vnbaaij vnbaaij changed the title [dev-v5] Add Charts package (DonutChart HorizontalBarChart and HorizontalBarChartWithAxis) [dev-v5] Add Charts package (Donut, Funnel, Horizontal bar and Horizontal bar with Axis) May 19, 2026
vnbaaij and others added 8 commits May 19, 2026 13:09
- Add GanttChart TS code (no Blazor mapping yet)
- Refactored ChartBase TS to have a CartesianChartBase (not processed in Blazor yet)
Introduce a new Gantt chart with support for both numeric and date/time x-axes, using flexible `ChartAxisValue` serialization. Add `GanttChartDataPoint` and `GanttChartXRange` models, and source-generated JSON contexts. Replace `HorizontalBarChartWithAxisCategoryOrder` with unified `ChartCategoryOrder` for y-axis sorting. Enhance Blazor and web components with explicit tick values, tick formatting, stroke width, x-axis label tooltips, and date localization options. Refactor axis ordering and tick logic across charts. Add extensive documentation and new demo examples for all features. Update project guidelines and API docs accordingly.

Add more parameters (+ examples) FluentCartesianhartBase

Sync files with web component work done in chart web components project
- Add d3-time-format package
- Use D3 time format
Comment thread .editorconfig
Comment thread src/Core.Scripts/.npmrc
Comment thread src/Charts.Scripts/package.json
Comment thread src/Charts.Scripts/esbuild.config.mjs
Comment thread src/Charts/DataVizPaletteExtensions.cs
Comment thread src/Charts/DataVizPaletteExtensions.cs
Comment thread src/Charts/Models/HorizontalBarChartModels.cs
Comment thread src/Charts/Charts/GanttChart/FluentGanttChart.razor.cs
Comment thread src/Charts/Charts/GanttChart/FluentGanttChart.razor.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants