Repository navigation
CmdPal: Render Adaptive Cards gauge, donut, and pie charts natively - #51219
Open
Clint Rutkas (crutkas) wants to merge 1 commit into
Open
Clint Rutkas (crutkas) wants to merge 1 commit into
Clint Rutkas (crutkas) wants to merge 1 commit into
Conversation
🧭 PR intakeVisual evidence: Not needed — The changed files do not indicate a visible UI change. Visual evidence was detected in the PR description. Recommendation
✅ Ready for reviewThis PR passed the automated intake checks and is ready for maintainer review. Automated PR intake; PowerToys maintainers make final decisions. |
This was referenced Oct 12, 2026
4 of 11 tasks
Adds the Chart.Gauge, Chart.Donut, and Chart.Pie elements to the Adaptive Cards polyfills library. The WinUI 3 renderer doesn't support them yet. - A gauge fills its arc up to the value, in the color of the segment that the value falls in, and draws the segments as a thin scale inside it. It can show a needle, min and max labels, and a legend, and its value as a percentage or a fraction. - Donut and pie charts draw a slice for each data point, with a legend of each slice's share. A donut can show a value in its center. - Untitled charts get the accessible name "Gauge", "Donut chart", or "Pie chart", from three new strings in Resources.resw. A gauge uses its sub label first. Layer 10 of 13 in a stack that splits #51125.
Mike Griese (zadjii-msft)
force-pushed
the
crutkas-stack-10-gauge-donut-pie-charts
branch
from
October 15, 2026 11:15
b69e2cc to
aca3fc5
Compare
This branch has not been deployed
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.
Summary of the Pull Request
Layer 10 of 13 in a stack that splits #51125 (native Adaptive Cards charts and redesigned Performance Monitor cards) into reviewable PRs. See #51125 for the full picture. This layer is based on layer 9 (#51218,
crutkas-stack-9-network-card), so the diff shows only this layer.The WinUI 3 Adaptive Cards renderer drops elements it doesn't know, even with a
fallback. This layer adds the schema's last three chart elements to the polyfills library:Chart.Gauge: a value on a half circle, optionally split into colored segments. The redesigned Battery card (layer 11) uses it for the charge level.Chart.DonutandChart.Pie: parts of a whole, with a legend that gives each part's share. The Charts and visuals sample page (layer 13) shows both.With this layer, the polyfills library and its tests match #51125, except for three README changes described below.
PR Checklist
AdaptiveChart_Gauge,AdaptiveChart_DonutChart, andAdaptiveChart_PieChart, in Command Palette'sResources.resw)README.md)Detailed Description of the Pull Request / Additional comments
Elements
Each element follows layer 2's pattern: a model that parses the element JSON leniently (invalid values read as missing and add a warning), and an
AdaptiveVisualControlthat draws it with shapes and text. All three are inAdaptiveCardPolyfills' element list, so they're registered as parsers, renderers, andPatchableElements, and data changes update them in place.GaugeChartModel,GaugeChartControl(Chart.Gauge): readtitle,showTitle(off by default),subLabel,value,min,max,valueFormat,colorSet,showLegend,showMinMax, andshowNeedle(these three are on by default), andsegmentsitems withlegend,size, andcolor.mindefaults to 0.maxdefaults tominplus the segments' total size, or to 100 without segments. Amaxthat isn't greater thanminwarns and usesmin+ 100. Values outside the range draw at its ends.percentage, the default) or asvalue/max(fraction).showMinMaxlabels the ends of the arc, and the legend lists the segments. The arc follows the element's width, from 96 to 220 px.color, or the color set's colors in turn.DonutChartModel,DonutChartControl(Chart.DonutandChart.Pie): readtitle,showTitle(off by default),colorSet,showLegend(on by default), anddataitems withlegend,value, andcolor. Missingdatawarns. A donut'svalueis a label in its center, such as"512 GB"; a pie has no center label.color, or the color set's colors in turn (categorical by default).Docs
The library's
README.mdlists the three elements, and its example of rendering choices made in the control now includes the gauge.Three README changes from #51125 are left out on purpose:
main'sAdaptiveCardsConfig.AdaptiveVisualControl.LineChartControlderives fromUserControl, so layer 2's wording stays.Screenshots
From a local card harness (not in the repo) that renders cards through
IncrementalAdaptiveCardUpdaterwith the polyfills registered,main's host config, and the realCardOverrideStylesfromContentFormControl.xaml, 776 px wide.Gauges: battery-style gauges at 12%, 35%, and 100%, with segments and no legend or min and max labels; a gauge without segments or a needle; a titled gauge with the schema's defaults (a legend and min and max labels); and an untitled
fractiongauge with the diverging color set.Donut and pie charts: a donut with a center label and a
neutralslice; a pie with the categorical color set; an untitled donut with a color for each slice; and an untitled pie with the sequential color set and no legend.The same cards with the Aquatic contrast theme simulated. Charts take the contrast theme's colors, every third and fourth segment or slice is an outline, and gauges with segments draw them at full width while the needle marks the value:
Validation Steps Performed
The 6 new files and
AdaptiveCardPolyfills.csare identical to their versions at #51125's head (8858a9e0a7). The polyfills library and its tests now match #51125, except forREADME.md(the three changes above).Resources.reswdiffers from #51125 only by a string thatmainadded after #51125 branched.ARM64 Debug builds, run from a
substdrive, at this PR's head (common build options:-nologo -m -restore -t:Build -v:minimal -p:Configuration=Debug -p:Platform=ARM64 -p:RuntimeIdentifier=win-arm64 -p:CIBuild=false -p:GeneratePackageLocally=false -p:GenerateAppxPackageOnBuild=false -p:PublishAppxPackage=false -p:SkipLongPathsCheck=true):MSBuild.exe src\modules\cmdpal\Tests\Microsoft.CmdPal.AdaptiveCards.Polyfills.UnitTests\Microsoft.CmdPal.AdaptiveCards.Polyfills.UnitTests.csproj <options>, with-t:Rebuild: exit code 0, no warnings. It builds the library, which runs the trim and AOT analyzers.vstest.console.arm64.exe ARM64\Debug\WinUI3Apps\CmdPal\tests\Microsoft.CmdPal.AdaptiveCards.Polyfills.UnitTests.dll /Platform:ARM64: 128 passed, 0 failed. That's 113 from layers 2 to 4, plus 15 new ones inDonutChartModelTestsandGaugeChartModelTests.MSBuild.exe src\modules\cmdpal\Microsoft.CmdPal.UI\Microsoft.CmdPal.UI.csproj <options>, with-m:4: exit code 0.MSBuild.exe src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.UnitTests\Microsoft.CmdPal.UI.UnitTests.csproj <options>, with-m:4: exit code 0.vstest.console.arm64.exe ARM64\Debug\WinUI3Apps\CmdPal\tests\Microsoft.CmdPal.UI.UnitTests.dll /Platform:ARM64: 715 passed, 0 failed.Card harness under JIT, dark and light, for 8 seconds; it counts the updates that replaced the whole card:
Resources.resw.Not run: a native AOT publish of the harness. The library's trim and AOT analyzers pass, and this branch has the same type-preservation attributes as #51125.