Repository navigation
Add Chart samples - #2261
Merged
Merged
Add Chart samples#2261
Conversation
Builds on dotMorten's "Add charting samples" (user/dotmorten/charts), rebased onto current main. - Fix: BarSeries.Orientation defaults to Horizontal. A horizontal BarSeries sharing a CategoryAxis X axis left its chart blank and stopped other charts on the page from drawing. Every BarSeries now sets Orientation explicitly. - Add App.xaml setup snippet for XamlChartsResources (copyable, like TableView). - Add examples for axis configuration (IsVisible, tick labels/marks, grid lines, brushes), bar orientation and CategoryAxis sorting, series visibility, line dash styles, marker shapes, stroke thickness, data labels/markers with per-point overrides, and DateTimeAxis Minimum/Maximum/IntervalType/LabelFormat. - Replace brushes that were unreadable in dark theme; rely on the control's theme-aware defaults for labels and text. - Add Chart control image and Learn API doc links. - Add ChartSamplesTests (setup snippet, App.xaml order, examples, initial values, API coverage, BarSeries orientation, no ThemeResource on chart properties). - Regenerate catalog/windows-samples.json. Co-authored-by: Morten Nielsen <mn@iter.dk> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Per review feedback, list Chart under Media instead of Collections and regenerate catalog/windows-samples.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Nitin Chaudhary (Nitin-100)
requested a review
from Pranav Gupta (pranav-gupta-msft)
October 7, 2026 11:11
Closed
1 of 3 tasks
Contributor
Author
|
/azp run |
Pranav Gupta (pranav-gupta-msft)
approved these changes
Oct 7, 2026
… snippets - Replace the ResponseTimes array on each update and bind it OneWay; the chart stopped redrawing after ObservableCollection.RemoveAt. - Move the Add sample button to the options pane and top-align the legend toggle. - Declare xmlns:charts on the root of every Chart snippet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Niels Laute (niels9001)
approved these changes
Oct 7, 2026
Niels Laute (niels9001)
enabled auto-merge (squash)
October 7, 2026 11:51
1 of 3 tasks
Niels Laute (niels9001)
disabled auto-merge
October 7, 2026 11:51
Niels Laute (niels9001)
added a commit
that referenced
this pull request
Oct 12, 2026
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> Adds an agent skill at `.github/skills/gallery-control-samples/SKILL.md` that captures how control samples should be designed in the gallery, and links it from the "Designing control samples" section in `AGENTS.md`. The skill covers: - Page structure: a learning progression of small, focused `ControlExample`s. - Minimal description text inside examples (let the header and the UI teach). - Where things go: the control in `Example`, interactive settings and actions in `Options` (top-aligned), and results or status text in `Output`. - Snippet `.txt` format (`--- header` / `--- xaml` / `--- c#`), declaring xmlns prefixes such as `charts:` on the root, `$(Key)` substitutions, and leaving gallery plumbing out of snippets. - Accessibility basics and the validation steps (catalog regeneration, build, tests). ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> Recent sample reviews (for example the Chart samples in #2261) kept repeating the same feedback: long descriptions inside examples, results shown in the example area instead of `Output`, actions outside the options pane, and missing namespaces in snippets. Writing these conventions down lets contributors and coding agents get them right the first time. ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> Documentation only, so no build or tests were run. The conventions were applied to the Chart samples in #2261 and checked in the running app. ## Screenshots (if appropriate): N/A ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a Chart page (Media, experimental) for
Microsoft.UI.Xaml.Controls.Charts, which ships in Windows App SDK 2.5.4-experimental (WinUI 2.3.10-experimental). Credit to Morten Nielsen (@dotMorten): this builds on hisuser/dotmorten/chartscommit ("Add charting samples"), rebased onto currentmain. His commit is preserved as the first commit.The page follows
AGENTS.md: a copyable App.xaml setup snippet first, then one idea per example.Samples,Chart.Data/Axes/Series,CategoryAxis,LinearAxis,LineSeries,ShowLegend,LegendTitleBarSeries.Orientation,CategoryAxis.SortKey,SortOrderLinearAxis.Minimum/Maximum/Spacing,GridLines(None/Major/Minor),Axis.IsVisible,ShowTickLabels,ShowTickMarks,AxisLineBrush,TickBrush,GridLineMajorBrush,GridLineMinorBrushCartesianSeries.IsVisible,Fill,Stroke,StrokeDashStyle,MarkerShapeStrokeDashStyleandMarkerShapevalues,StrokeThickness,ShowDataMarkers,ShowDataLabels,DataLabelOverrides,DataMarkerOverridesDateTimeAxis.Minimum/Maximum/IntervalType/LabelFormatSamples.ItemsSourcebound to anObservableCollection<double>Other changes:
BarSeries.Orientationdefaults toHorizontal. A horizontalBarSeriesthat shares aCategoryAxisX axis with an area or line series leaves its chart blank. It also stops other charts on the same page from drawing (only the legend title renders), even if the affected chart is collapsed. The samples setOrientationexplicitly on everyBarSeries, a test enforces it, and the bar example explains the default. This needs a fix in the control; I can file it with the Charts owners.{ThemeResource}(XamlParseException: Failed to assign to property), and a nestedSolidColorBrush Color="{ThemeResource …}"doesn't follow a later theme switch. The samples rely on the control's theme-aware defaults for text and labels, and use fixed series colors that keep at least 3:1 contrast in both themes. The previous black data label disappeared in dark theme.ControlInfoData.json: newChart.pngcontrol image (it previously usedPlaceholder.png), Learn API doc links, more search tags, and an updated description.catalog/windows-samples.jsonregenerated.Motivation and Context
Chart is the third experimental control in 2.5.x, after TableView (#2250) and InkCanvas/InkToolbar (#2245, #2247), and it has no gallery page yet. This covers the whole public Charts API surface. The list was taken from the 2.3.10-experimental winmd so no member is missed.
How Has This Been Tested?
Windows 11 x64, Debug, .NET SDK 9.0.318 (app) and 10.0.401 (catalog tools).
dotnet build WinUIGallery\WinUIGallery.csproj -c Debug -p:Platform=x64 -p:BuildAllAppFlavors=false -p:AppxBundle=Never: builds with no new warnings.dotnet run --project tools\CatalogExporter -- generate, thencheck: index up to date (126 controls, 349 samples). All seven Chart samples publish well-formed XAML with no unresolved$(…)tokens.dotnet test tests\WinUIGallery.CatalogExporter.Tests: 166/166 pass, including the newChartSamplesTests:App.xamlmergesXamlChartsResourcesafterXamlControlsResources.BarSeriessetsOrientation.{ThemeResource}on chart properties.dotnet format --verify-no-changesis clean on the new page and test files.git diff --checkis clean.AxeScanAllTests): 0 errors. No page-specific exclusion is needed.Screenshots
Captured before the move to Media, so the navigation pane still shows Chart under Collections.
Types of changes