Legend
Since 0.1.0-alpha.22A legend above, below or beside the chart whose items hide and show their series, with series that can start hidden.
A legend beside the chart
Legend places the legend: Top, Bottom, Start, End or None. Start and End put it beside the chart, and above or below it under 30rem wide. By default it's above, under the title, with two series or more.
Static
Preview
50K100K150K200K250K
JanFebMarAprMayJunJulAugSepOctNovDec
- Organic search
- Direct
- Paid search
- Other
Jan
Organic search
182K
Direct
96K
Paid search
61K
Other
8K
Feb
Organic search
177K
Direct
95K
Paid search
59K
Other
8K
Mar
Organic search
195K
Direct
101K
Paid search
66K
Other
9K
Apr
Organic search
202K
Direct
104K
Paid search
70K
Other
9K
May
Organic search
210K
Direct
107K
Paid search
73K
Other
9K
Jun
Organic search
198K
Direct
104K
Paid search
69K
Other
9K
Jul
Organic search
192K
Direct
100K
Paid search
65K
Other
9K
Aug
Organic search
204K
Direct
105K
Paid search
72K
Other
9K
Sep
Organic search
219K
Direct
111K
Paid search
78K
Other
10K
Oct
Organic search
226K
Direct
114K
Paid search
82K
Other
10K
Nov
Organic search
242K
Direct
121K
Paid search
95K
Other
10K
Dec
Organic search
236K
Direct
125K
Paid search
98K
Other
11K
Sessions by channel, 2026
| Month | Organic search | Direct | Paid search | Other |
|---|---|---|---|---|
| Jan | 182K | 96K | 61K | 8K |
| Feb | 177K | 95K | 59K | 8K |
| Mar | 195K | 101K | 66K | 9K |
| Apr | 202K | 104K | 70K | 9K |
| May | 210K | 107K | 73K | 9K |
| Jun | 198K | 104K | 69K | 9K |
| Jul | 192K | 100K | 65K | 9K |
| Aug | 204K | 105K | 72K | 9K |
| Sep | 219K | 111K | 78K | 10K |
| Oct | 226K | 114K | 82K | 10K |
| Nov | 242K | 121K | 95K | 10K |
| Dec | 236K | 125K | 98K | 11K |
Code
@* Sessions by channel, the legend beside the chart, and the small "Other" channel starting hidden. *@
<Chart Items="_months" Argument="m => m.Month" Title="Sessions by channel, 2026" Legend="ChartLegend.End">
<ChartValueAxis Format="#,##0,K" />
<ChartLineSeries Value="m => m.Organic" Name="Organic search" />
<ChartLineSeries Value="m => m.Direct" Name="Direct" />
<ChartLineSeries Value="m => m.Paid" Name="Paid search" />
<ChartLineSeries Value="m => m.Other" Name="Other" Hidden />
</Chart>
{
private record ChannelMonth(string Month, int Organic, int Direct, int Paid, int Other);
private readonly ChannelMonth[] _months =
[
new("Jan", 182_400, 96_300, 61_200, 8_100), new("Feb", 176_900, 94_800, 58_700, 7_900),
new("Mar", 195_300, 101_200, 66_400, 8_600), new("Apr", 201_800, 103_900, 70_100, 8_800),
new("May", 209_600, 106_500, 72_800, 9_200), new("Jun", 198_200, 104_100, 69_300, 9_000),
new("Jul", 191_700, 99_800, 64_500, 8_700), new("Aug", 204_300, 105_200, 71_900, 9_100),
new("Sep", 218_900, 110_600, 78_200, 9_600), new("Oct", 226_400, 113_800, 81_500, 9_900),
new("Nov", 241_700, 121_300, 94_600, 10_400), new("Dec", 236_200, 124_900, 98_300, 10_800),
];
}Click a legend item to hide its series, and again to show it. The chart is drawn again without it, so stacks close up and the value axis rescales. To start a series hidden, set Hidden, here the small Other channel, which would flatten the rest.
LegendAlign sets where the legend sits along its edge: Start (the default, lined up with the title), Center or End. Above or below the chart, that's left, center or right; beside it, top, middle or bottom.