microsoft/microsoft-ui-reactor/reactor-charts

Claude Code and agent skill by microsoft/microsoft-ui-reactor

Trust tier 4
  • vendor
Source check pending

Checking that the SKILL.md file is still in the repository.

Reactor charts and data visualization — choosing a chart type (line, bar, area, donut, `TreeChart`, `ForceGraph`), the chart DSL, `LabelView` / `XTickLabelView` / `YTickLabelView` for icon-plus-text and rich labels, and the visualization-best-practices rules. Use when adding charts or designing visualizations.

Install

npx vskill@latest install microsoft/microsoft-ui-reactor/reactor-charts

SKILL.md

The same SKILL.md was published earlier as microsoft/microsoft-ui-reactor/reactor-charts.

Reactor Charts

The chart surface lives in Reactor.D3.Charts (full guide: docs/guide/charting.md). This skill is the AI-agent quick reference — chart-choice rules, the new *View extension points, and the a11y/accuracy rails you should keep on by default.

Choose the right chart first

Most "my chart looks bad" problems are wrong-chart problems, not styling problems. Cleveland & McGill's perceptual ranking (1984) — accuracy of graphical judgment, best to worst:

position on a common scale > position on non-aligned scales > length /
direction / angle > area > volume > shading / color saturation

That ordering is why bars and dots win and why pies lose. Translate it into rules of thumb:

ChartUse whenAvoid when
BarDiscrete categories, time buckets (Q1..Q4), ranked comparison. Default when in doubt.(Use a different chart if the data is continuous, e.g. dense time-series — line is clearer.)
LineContinuous data, many x-values, trends/slopes, autocorrelated series (prices, sensor readings).Few categorical observations — use bar.
AreaCumulative magnitude or parts-of-whole over time.Series cross frequently — overlap occludes; switch to line.
PieParts-of-a-whole and ≤5 slices and large differences and proportions land near recognizable fractions (½, ¼, ⅓).Anything else. Ranking, change-over-time, negative values, precise comparison — use a sorted bar chart.
Donut (PieChart with InnerRadius > 0)Same conditions as pie. The inner hole gives you a place for a center label (total, current selection) — useful when the chart sits inside a dashboard.Same as pie. The hole doesn't fix pie's ranking weakness.
Tree (TreeChart)Hierarchical data: org charts, file/folder structures, taxonomies, decision trees. Visualizes parent→child links.Wide hierarchies (>~30 nodes per level) — the tree gets unreadable; consider a treemap (use the D3.Layout.Treemap primitive — no top-level factory yet).
Force graph (ForceGraph)Relationship networks: dependency graphs, social graphs, knowledge graphs. Shows which nodes cluster.Hierarchical data — use TreeChart (an explicit layout always reads better when one exists). Static print/snapshot output — force layouts converge differently each run.

When the user asks for a pie chart, push back unless all four pie conditions hold. A sorted bar chart usually wins. (Few/Tufte say "almost never pie"; Cairo/Wilke allow the narrow case above. Default to "no" and concede when the conditions are met.)

Charts not yet exposed as top-level factories: Sankey, Treemap, Cluster dendrograms, partition/sunburst, stratified hierarchies. The math primitives exist in src/Reactor.Advanced/Charting/D3/Layout/ (Sankey.cs, Treemap.cs, Cluster.cs, Stratify.cs, TreeLayout.cs) and can be composed with D3Canvas + the d3 shape generators. If a user asks for one of these and isn't comfortable assembling D3 primitives directly, suggest filing a factory request rather than hand-rolling — the resulting chart will lack the shared accessibility surface.

The DSL — quick reference

csharp
LineChart (data, x, y) // continuous line
BarChart (data, x, y) // vertical bars (always anchored at zero — see pitfalls)
AreaChart (data, x, y) // filled area
PieChart (data, value) // slices summing to 100%
PieChart (data, value) // donut variant: chain .InnerRadius(40+)
.InnerRadius(60)
TreeChart (root, children) // hierarchical (org chart, file tree, taxonomy)
ForceGraph(nodes, links) // network graph (dependencies, relationships)

Common fluent knobs (chain-call any subset):

csharp
.Title("Monthly Revenue")
.SeriesName("Revenue")
.Units(xUnits: "months", yUnits: "USD")
.AxisLabel(ChartAxisType.X, "Month")
.AxisLabel(ChartAxisType.Y, "Revenue (USD)")
.Width(600).Height(250)
.Stroke("#0078D4").StrokeWidth(2.5)
.Fill("#50C878") // bars / area / pie slice baseline
.ShowGrid(true).ShowAxes(true)
.DataLabel((point, idx) => $"{point.Revenue:C}") // string label per point
.Palette(ChartPalette.Categorical) // Tier 1 curated palette (a11y-scanned)
.ChartBackground("#1E1E1E") // declare active bg → scopes A11Y_CHART_011

AxisLabel text and Title are reserved for labeling the chart, not labeling individual data points or ticks — for those, see the next two sections.

Make D3 do the work

Charts compose D3-style scales and generators internally. When you reach under the DSL hood (or hand-roll Canvas drawings), follow these:

  • Scales map domain → range — never compute pixel positions by hand. A

LinearScale from [min, max] to [plotLeft, plotRight] is the boundary between "data" and "pixels". Mixing them is the #1 source of "off by 5px" bugs.

  • Pick the right scale type for the data. Linear for quantitative,

log for exponential, time for dates, ordinal/band for categories. Linear- on-exponential hides patterns; log-on-linear inflates them.

  • Always `.nice()` quantitative domains. Axis bounds should round to

human-friendly numbers (0/100/200, not 13.7/187.4). Pair with .ticks(n) as a suggestion, not a hard count — D3 picks readable intervals.

  • Reserve margins. Long y-axis labels and multi-line tick *View

elements need gutter. The Bostock margin convention ({top, right, bottom, left}) is the safe default; if you customize tick labels (next section), measure the longest one and grow the margin.

  • Don't reinvent the axis. The built-in axis generator handles tick

selection, formatting, alignment, label rotation. Custom tick code is where charts go to die.

When string labels aren't enough — *View

Three cases the string-label APIs (DataLabel, AxisLabel, LabelAccessor) can't handle:

  1. The label needs an icon next to or inside the text.
  2. The label needs multi-line text, wrapping, or different colors /

weights per fragment.

  1. The label needs to render a mini sub-tree (badge, sparkline, mini

button, anything Reactor can build).

For these, reach for the *View extensions. They take a render delegate and substitute its returned Element for the built-in TextBlock at the same anchor position:

csharp
// Pie slice: replace text label with arbitrary element rendered at the slice centroid
PieChart(data, d => d.Value)
.LabelView((d, layout) => HStack(
FontIcon(IconForCategory(d.Category)).FontSize(12),
TextBlock($"{layout.Fraction:P0}").FontWeight(FontWeights.SemiBold)));
// Axis tick: replace numeric tick label with arbitrary element
LineChart(data, x, y)
.XTickLabelView(t => VStack(
TextBlock(MonthName((int)t)).FontSize(11),
TextBlock("month").FontSize(8).Foreground(Theme.SecondaryText)))
.YTickLabelView(t => TextBlock($"${t:N0}").FontFamily("Cascadia Mono"));
PieChartElement<T>.LabelView(Func<T, PieSliceLayout, Element>)

The render delegate receives:

  • T data — the slice's source data item.
  • PieSliceLayout layout — a readonly record struct with everything you

need to render a label that knows its slice geometry:

  • Index, Value, Fraction (0..1 of total)
  • CentroidX, CentroidY (absolute canvas coords — already applied via

CenterAt, you don't need to apply them yourself)

  • StartAngle, EndAngle (radians, clockwise from 12 o'clock — d3 semantics)
  • InnerRadius, OuterRadius
  • Color — the resolved D3Color from the chart's palette, so your label

can echo the slice color without a separate lookup.

The returned element is auto-anchored at the centroid via CenterAt. You do not need a known size at construction time; the reconciler recomputes position after layout from ActualWidth/ActualHeight.

ChartElement<T>.XTickLabelView(Func<double, Element>) and YTickLabelView

Same pattern for axis ticks. The delegate receives the tick's domain value (double); X labels are anchored horizontally centered on the tick mark, Y labels right-anchored to the axis edge and vertically centered.

Direct labeling vs legend vs tooltip

A label-placement decision tree (Tufte, Cleveland — direct labeling raises the data-ink ratio and avoids legend ping-pong):

  1. Direct labels first. Label series at the end of each line, label pie

slices on the chart, label bars above the bar. LabelView / *TickLabelView exist precisely so you can do this without re-templating the whole chart. Eyes don't ping-pong from line to legend; print works; screen readers work.

  1. Use a legend only when direct labeling would collide — many series,

tightly-packed lines, repeating palette across small multiples. Treat it as a fallback, not a default.

  1. Use a tooltip for precise values on dense data, in addition to —

never instead of — direct labels or a legend. Tooltips fail print, screen readers, mobile-tap accuracy, and keyboard navigation.

  1. Pie slices: large slices get inside-labels; small slices (<~5%) need

outside leader lines or get rolled into "Other". Don't label tiny slices inline — they overlap.

  1. Backfire cases: dense scatterplots, tightly-packed bars, many

overlapping line endpoints. Label collisions there are worse than a legend; switch to legend.

Anchor primitive (used by *View internally)

The *View methods are built on Canvas's anchor extensions (CanvasExtensions.cs). You'll rarely call them directly, but if you need to position arbitrary content on a Reactor Canvas without knowing its size at build time (overlay markers, custom callouts), use these:

csharp
.Canvas(left, top, anchorX, anchorY) // 0..1 fractions of rendered size
.CenterAt(x, y) // sugar for anchor (0.5, 0.5)

The reconciler subscribes once to Loaded + SizeChanged per anchored element and recomputes Canvas.Left/Top as target − anchor × ActualWidth/Height. Zero-anchor (0, 0) is the legacy fast path with no subscription overhead.

Accessibility — beyond the framework defaults

Charts implement IChartAccessibilityData, which exposes axis ranges, units, point values, and (for pie) slice descriptors via UIA. Don't disable that. Beyond that, your responsibilities:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 3 Oct 2026.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
660
Repository forks
57
7-day trend score
37

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 24 Oct 2026, a month ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill CERTIFIED badge
[![vskill CERTIFIED](https://verified-skill.com/api/v1/skills/microsoft/microsoft-ui-reactor/reactor-charts/badge)](https://verified-skill.com/skills/microsoft/microsoft-ui-reactor/reactor-charts)

Something wrong with this skill or its page? Tell us.