Charts

Bar, line, area, pie, donut, radar and radial charts, drawn by the components in the theme's colours.

The charts are drawn by the components themselves (MAUI's GraphicsView, Avalonia's Render), so they need no charting package. They take their colours from the theme, and every chart has a legend, a tooltip under the pointer (or the finger) and a grow-in animation.

Chart Install Shows
Bar Chart bar-chart Bars per category: side by side, stacked or horizontal
Line Chart line-chart A line per series, smooth or straight
Area Chart area-chart Filled lines, overlapping or stacked
Pie Chart pie-chart Slices of a whole; DonutChart adds a hole for a value
Radar Chart radar-chart A shape per series over a ring of categories
Radial Chart radial-chart Rings filling towards a maximum
bash
shellui-native add bar-chart line-chart area-chart pie-chart radar-chart radial-chart

Each chart installs chart, the core they share. The chart colours are theme tokens added with the charts: in a project whose shell came from an older CLI, run shellui-native update shell first.

Data

A chart's children are its series, and Labels names the categories (or a pie's slices). In XAML both are comma-separated lists:

xml
<ui:BarChart x:Name="Downloads" Labels="Jan, Feb, Mar" HeightRequest="260">
    <ui:ChartSeries Name="ShellUI" Values="186, 305, 237" />
    <ui:ChartSeries Name="ShellUI Native" Values="80, 120, 160" />
</ui:BarChart>

From code, set Labels and add to Series:

csharp
Downloads.Labels = new ChartLabels(months);
Downloads.Series.Add(new ChartSeries { Name = "ShellUI", Values = new ChartValues(counts) });

Adding or removing a series, or setting a series' Values, Name or Color, redraws the chart. After changing numbers inside an existing Values list, call Refresh(). PlayAnimation() grows the chart in again.

Give every chart a height: HeightRequest on MAUI, Height on Avalonia. ValueFormat (a .NET number format, #,0.## by default) formats the axis and tooltip values, and Description names the chart for screen readers.

Colours

Series take the theme's Chart1 to Chart5 tokens in order; past the fifth, the colours repeat, fainter. They follow light and dark mode and can be replaced like any other theme token, before the first page loads:

csharp
ShellTheme.Light[ShellToken.Chart1] = Color.FromArgb("#E76E50");
ShellTheme.Dark[ShellToken.Chart1] = Color.FromArgb("#2662D9");

A series' own Color wins over the theme.

Your own chart

Derive from ChartBase and draw in DrawChart with the IChartCanvas it hands you (lines, polygons, text). The legend, tooltip and animation come with the base class, and ChartMath has the geometry the built-in charts use: arcs, sectors, rounded rectangles, smooth curves and axis scales.

What the charts don't do

Zooming and panning, mixing bars and lines in one chart, click events on a bar or slice, and very large data sets (every point is drawn). For those, a charting library such as LiveCharts sits fine next to ShellUI Native: colour it from ShellTheme.Get(ShellToken.Chart1).

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.