Nested donut chart
Since 0.1.0-alpha.22Use rings to compare how the same items split two or three totals, such as exports and imports. They show the overall mix, not exact shares. The same share looks bigger on the outer ring. For exact comparisons, use 100% stacked bars.
A ring per measure
Give NestedDonutChart the Items, each slice's name as Argument, and a DonutRing for each measure, with its Value and Name. The first ring is the outer one, and each item keeps its color in every ring.
Static
Preview
Outside: 2025, Inside: 2024
- North America
- Europe
- Asia Pacific
- Latin America
| Region | 2025 | Share, 2025 | 2024 | Share, 2024 |
|---|---|---|---|---|
| North America | $18,400,000 | 43% | $17,900,000 | 45% |
| Europe | $11,200,000 | 26% | $12,600,000 | 31% |
| Asia Pacific | $9,700,000 | 23% | $6,800,000 | 17% |
| Latin America | $3,100,000 | 7.3% | $2,900,000 | 7.2% |
Code
@* A company's revenue by region this year, outside, against last year, inside. *@
<NestedDonutChart Items="_regions" Argument="r => r.Region" Title="Revenue by region" ValueFormat="C0">
<DonutRing Value="r => r.ThisYear" Name="2025" />
<DonutRing Value="r => r.LastYear" Name="2024" />
</NestedDonutChart>
{
private record RegionRevenue(string Region, decimal ThisYear, decimal LastYear);
private readonly RegionRevenue[] _regions =
[
new("North America", 18_400_000, 17_900_000),
new("Europe", 11_200_000, 12_600_000),
new("Asia Pacific", 9_700_000, 6_800_000),
new("Latin America", 3_100_000, 2_900_000),
];
}Add this example to a page with the izzy CLI:
izzy add component NestedDonutChart --at <file>:<line>The line under the title names each ring by its place.
Details
The first ring is the outer one; each item has one color in every ring and one row in the legend. A line under the title says which ring is which.
Rings compare poorly: the same share is a longer arc on the outer ring. To compare how two wholes split, a Chart with 100% stacked bars reads better; use rings for two, at most three.
Parts
Written inside NestedDonutChart. The API page lists their parameters.
DonutRing<TItem>: one ring of aNestedDonutChart<T>: a measure of the chart's items, such as<DonutRing Value="c => c.Exports" Name="Exports" />.
Mode support
| Feature | Static | Interactive |
|---|---|---|
| A ring for each measure, the first outside, with the rings named under the title | Yes | Yes |
| One color and one legend row per item, in every ring | Yes | Yes |
| Legend items that hide and show an item's slices in every ring | Yes | Yes |
| A table of each ring's values and shares in a "Show data" disclosure | Yes | Yes |
| Tooltips on hover and from the keyboard, along a ring and between rings | Yes | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Without JavaScript
Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off.
- Legend items that hide and show an item's slices in every ring: waits for the script
- Tooltips on hover and from the keyboard, along a ring and between rings: waits for the script
Accessibility
- The chart is a figure captioned by
Title, or named by a heading on the page withTitledBy. - The circle is one image named by the caption and described by the line naming the rings.
- The legend is text: each item's name, read in order.
- "Show data" under the chart opens a table of every ring's values and shares (
DataTable). - With script, the circle is one Tab stop: Left and Right move along a ring, Up and Down between rings, and each slice is said with its ring.
Keyboard navigation
On the circle
| Press this key | To do this |
|---|---|
| Right or Left | Show the next or previous slice in the same ring |
| Down or Up | Move to the same item on the ring inside or outside |
| Home or End | Go to the ring's first or last slice |
| Escape | Hide the tooltip |
Parameters
| Prop | Type | Default |
|---|---|---|
ChildContentThe rings, as DonutRing<T> items: the first is the outer one. | RenderFragment? | |
CenterContent in the hole, such as a total. | RenderFragment? | |
ItemsThe items, one slice each (in each ring, on a NestedDonutChart<T>). | IEnumerable<TItem>? | Required |
ArgumentEach slice's name, such as p => p.Plan. | Expression<Func<TItem, object?>>? | |
TitleThe chart's title, such as "Customers by plan", shown above it as its caption. | string? | |
HideTitleHides the title, which still names the chart for screen readers. | bool | false |
DownloadShows a button across from the title that saves the chart as a PNG, named after its title, in the color scheme on screen. | bool | false |
TitleAlignWhere the title sits: at the start, over the chart's first label, by default (the left, in a left-to-right page); ChartAlign.Center or ChartAlign.End. | ChartAlign | ChartAlign.Start |
TitledByThe id of a heading already on the page that titles the chart, such as a card's, in place of Title: the chart takes its name from it and shows no title of its own. | string? | |
StartAngleWhere the first slice starts, in degrees clockwise from the top: 90 starts it at the right, so it runs down that side. | double | 0 |
SweepHow far round the slices go, in degrees: 360 (the default) for a whole circle, 180 for a half. | double | 360 |
SizeThe circle's largest size. | Length? | computed |
ValueFormatA .NET format string for the values, such as C0 or N0. | string? | |
TooltipShows a tooltip with the slice's value and share under the pointer or keyboard focus, with script. | bool | true |
PaletteThe colors in order: Colors (the theme's eight, the default), Shades of one color for slices in an order, Diverging for slices either side of a middle, or your own with Of. | ChartPalette? | |
LegendThe legend: each slice's name by its color, with its value and share on a PieChart<T> (names only on a NestedDonutChart<T>, whose values differ ring by ring). | ChartLegend | ChartLegend.Auto |
LegendAlignWhere the legend sits along its edge: centered on the circle, by default (beside it or under it); ChartAlign.Start for the left above or below (in a left-to-right page) or the top beside it, ChartAlign.End for the right or the bottom. | ChartAlign? | |
DataTableThe values as a table: by default behind a "Show data" button that opens it over the chart; ChartDataTable.Collapsed puts it in a disclosure under the chart. | ChartDataTable | ChartDataTable.Popover |
RefreshHow often the chart reads its data again, at least a second, such as Refresh="TimeSpan.FromSeconds(30)". | TimeSpan? | |
RefreshFromOn a static page with Refresh: a lighter page to fetch than this one, which renders the same chart with the same id. | string? | |
OnRefreshOn an interactive page with Refresh: raised at each interval, to load new data. | EventCallback |
Plus 17 item props and 4 common props.
Full APISee also
- PieChart: shows how one total splits into a few shares, such as customers by plan, each labeled with its share.
- Chart: draws a chart on the server from a list of items, with axes, value labels, reference lines, trends and a table of the values, for every chart type.