Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Radar chart

Since 0.1.0-alpha.22
Compares a few things across several measures on one scale, such as two phones' review scores.

Use a radar to compare one to three items across a handful of measures, such as two phones' review scores. The overall shape is the message. The shape changes with the order of the spokes, so it's hard to rank from. To compare exactly, use bars side by side.

Series on one scale

Give RadarChart the Items, one per spoke, each one's name as Argument, a RadarSeries for each thing compared, and a Title, here two phones' review scores.

Static

Preview

Review scores, out of 10
  • Phone A
  • Phone B
Arrow keys move between values; Escape hides the tooltip.Scale 0 at the center to 10 at the edge

Code

Usage.razor
@* Two phones' review scores, out of 10, in six qualities. *@
<RadarChart Items="_scores" Argument="s => s.Quality" Max="10" Title="Review scores, out of 10">
    <RadarSeries Value="s => s.PhoneA" Name="Phone A" />
    <RadarSeries Value="s => s.PhoneB" Name="Phone B" />
</RadarChart>

@code {
    private record Score(string Quality, double PhoneA, double PhoneB);

    private readonly Score[] _scores =
    [
        new("Camera", 9.2, 7.6),
        new("Display", 8.8, 8.0),
        new("Speed", 9.0, 7.8),
        new("Build", 8.7, 7.5),
        new("Value", 6.0, 8.9),
        new("Battery", 8.5, 9.1),
    ];
}

Add this example to a page with the izzy CLI:

bash
izzy add component RadarChart --at <file>:<line>

Spokes run clockwise from the top in item order. The shape depends on that order, so put related measures side by side: here camera, display, speed and build together, then value and battery.

Max="10" sets the outer ring to the scores' real top, so an outline's size means something. Without it, the scale ends at the round number at or above the largest value.

Hover a spoke, or Tab to the chart and use the arrow keys: the tooltip lists every series' value there, and a screen reader hears it.

A series per key

When each item holds one value, such as a panel's rating of one candidate in one competency, split them into series with SeriesBy. Each candidate gets an outline, a color and a marker shape, in the order they first appear.

Static

Preview

Panel ratings, senior engineer
  • Ana
  • Ben
  • Chen
Arrow keys move between values; Escape hides the tooltip.Scale 1.0 at the center to 5.0 at the edge

Code

SeriesBy.razor
@* A hiring panel's average ratings, 1 to 5, for three candidates in six competencies. *@
<RadarChart Items="_ratings" Argument="r => r.Competency" Min="1" Max="5" ValueFormat="0.0"
            Title="Panel ratings, senior engineer">
    <RadarSeries Value="r => r.Rating" SeriesBy="r => r.Candidate" />
</RadarChart>

@code {
    private record PanelRating(string Candidate, string Competency, double Rating);

    private static readonly string[] Competencies = ["Problem solving", "Technical depth", "Ownership", "Leadership", "Communication", "Collaboration"];

    private static readonly (string Candidate, double[] Ratings)[] Panel =
    [
        ("Ana", [4.5, 4.7, 4.0, 3.2, 3.8, 4.2]),
        ("Ben", [3.6, 3.4, 3.9, 4.1, 4.6, 4.4]),
        ("Chen", [4.1, 4.4, 4.6, 3.8, 3.5, 3.7]),
    ];

    private readonly PanelRating[] _ratings =
        [.. Panel.SelectMany(p => Competencies.Select((c, i) => new PanelRating(p.Candidate, c, p.Ratings[i])))];
}

The ratings run from 1 to 5, so Min="1" puts 1 at the center and Max="5" at the edge.

Three outlines are about as many as a radar holds. For more, draw a radar per candidate, or compare them in a Chart with bars.

Circular grid and fill

Months around a circle make a year's cycle visible, such as two cities' rainfall. Grid="RadarGrid.Circle" draws the rings as circles, and Fill shades each outline lightly.

Static

Preview

Average rainfall (inches)
  • Seattle
  • Phoenix
Arrow keys move between values; Escape hides the tooltip.Scale 0.0 at the center to 8.0 at the edge

Code

Circle.razor
@* Average rainfall by month, in inches (1991–2020 normals). *@
<RadarChart Items="_months" Argument="m => m.Month" Grid="RadarGrid.Circle" ValueFormat="0.0"
            Title="Average rainfall (inches)">
    <RadarSeries Value="m => m.Seattle" Fill="true" />
    <RadarSeries Value="m => m.Phoenix" Fill="true" />
</RadarChart>

@code {
    private record MonthRain(string Month, double Seattle, double Phoenix);

    private readonly MonthRain[] _months =
    [
        new("Jan", 5.78, 0.87), new("Feb", 3.76, 0.87), new("Mar", 4.17, 0.83), new("Apr", 3.18, 0.25),
        new("May", 1.89, 0.16), new("Jun", 1.49, 0.02), new("Jul", 0.57, 1.05), new("Aug", 0.97, 1.00),
        new("Sep", 1.58, 0.64), new("Oct", 3.86, 0.58), new("Nov", 6.31, 0.65), new("Dec", 5.94, 0.88),
    ];
}

A fill makes differences look larger than they are, since area grows with the square of the values, and fills cover each other. Use it for one or two series. An outline with a missing value has a gap, so it isn't filled.

Details

Spokes keep the order the items first name them in, the first at the top and the rest clockwise (StartAngle turns them): the shape depends on that order, so put related measures side by side. Items can each be a spoke with a value per series, or each hold one value, with SeriesBy splitting them into a series per key. Every spoke shares one scale from Min (0 by default) to a round Max; for measures in different units, scale them to the same range first. A missing value leaves a gap in its outline, never a point at the center. A radar reads best with 4 to 8 spokes and up to three series; for one series, or to compare exact values, a bar chart reads better.

Parts

Written inside RadarChart. The API page lists their parameters.

  • RadarSeries<TItem>: one outline on a RadarChart<T>: a value at each spoke, joined around the circle, with a marker at each.

Mode support

What works in each mode, Radar chart
FeatureStaticInteractive
An outline per series with markers that differ by shape, or a light fillYesYes
One shared scale from 0 to a round maximum, or your own Min and MaxYesYes
Polygon or circular rings, with their values up the first spokeYesYes
Series from separate values or split from rows with SeriesByYesYes
Gaps for missing values, never a point at the centerYesYes
Legend items that hide and show seriesYesYes
A table of the values, spokes by series, in a "Show data" disclosureYesYes
Tooltips with every series' value at a spoke, on hover and from the keyboardYesYes

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 series: waits for the script
  • Tooltips with every series' value at a spoke, on hover and from the keyboard: waits for the script

Accessibility

  • The chart is a figure captioned by Title, or named by a heading on the page with TitledBy.
  • The plot is one image named by the caption, described by its scale.
  • "Show data" under the chart opens a table of every value, spokes by series (DataTable).
  • Outlines differ by marker shape as well as color.
  • With script, the plot is one Tab stop: the arrow keys move from spoke to spoke and say every series' value there.

Keyboard navigation

On the plot

RadarChart keys, On the plot
Press this keyTo do this
Right or DownMove to the next spoke, clockwise
Left or UpMove to the spoke before
Home or EndGo to the first or last spoke
EscapeHide the tooltip

Parameters

RadarChart parameters
PropTypeDefault
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?
ItemsThe items: each a spoke with a value per series, or with SeriesBy one value each.IEnumerable<TItem>?Required
ArgumentEach item's spoke, such as s => s.Quality.Expression<Func<TItem, object?>>Required
TitleThe chart's title, such as "Review scores", shown above it as its caption.string?
HideTitleHides the title, which still names the chart for screen readers.boolfalse
DownloadShows a button across from the title that saves the chart as a PNG, named after its title, in the color scheme on screen.boolfalse
TitleAlignWhere the title sits: at the start by default (the left, in a left-to-right page); ChartAlign.Center or ChartAlign.End.ChartAlignChartAlign.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?
ValueFormatA .NET format string for the values, such as N0 or P0: on the rings, in the tooltips and the table.string?
ArgumentFormatA .NET format string for the spokes' names, when they're numbers or dates.string?
MinThe value at the center: 0 by default, or the round tick at or below the lowest value when that's below 0.double?
MaxThe value at the outer ring: the round number at or above the largest value by default.double?
GridThe rings' shape: RadarGrid.Polygon (the default), straight between spokes as the outlines are, or RadarGrid.Circle.RadarGridRadarGrid.Polygon
StartAngleWhere the first spoke points, in degrees clockwise from the top: 90 points it right.double0
SizeThe circle's largest size.Length?computed
PaletteThe colors in order: Colors (the theme's eight, the default), Shades of one color, or your own with Of.ChartPalette?
LegendWhere the legend goes: above the plot with two or more series by default (ChartLegend.Auto), ChartLegend.Top, ChartLegend.Bottom, beside it with ChartLegend.Start or ChartLegend.End, or ChartLegend.None.ChartLegendChartLegend.Auto
LegendAlignThe legend's place along its edge: the start by default, the center or the end.ChartAlignChartAlign.Start
TooltipThe tooltip for the spoke under the pointer or the keyboard, with every series' value there (with script).bool?
DataTableThe values as a table, spokes by series: by default behind a "Show data" button that opens it over the chart; ChartDataTable.Collapsed puts it in a disclosure under the chart.ChartDataTableChartDataTable.Popover
ChildContentRadarSeries<T>s, and a ChartTooltip<T> for your own tooltip.RenderFragment?
OnRefreshOn an interactive page with Refresh: raised at each interval, to load new data.EventCallback

See also

  • 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.
  • PieChart: shows how one total splits into a few shares, such as customers by plan, each labeled with its share.

Connection lost

Rejoining the server…