Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Reference lines

Since 0.1.0-alpha.22
Lines at a target or an average, and shaded ranges of values or arguments such as a season, each labeled in text and said in the chart's description.

Reference lines and bands

To mark a value, such as a target, put a ChartReferenceLine in the chart with its series and set its Value. It's a dashed line with its Label just above it at the left, or where LabelAlign puts it: Start, Center or End.

Static

Preview

Revenue against target, 2026
Arrow keys move between values; Escape hides the tooltip.Target $150K: $150,000; Average: $121,433; Holiday season: Nov to Dec

Code

Reference.razor
@* Monthly revenue against the year's target and its own average, with the holiday season shaded. *@
<Chart Items="_months" Argument="m => m.Month" Title="Revenue against target, 2026">
    <ChartValueAxis Format="C0" />
    <ChartBarSeries Value="m => m.Revenue" Name="Revenue" />
    <ChartReferenceLine Value="150_000" Label="Target $150K" />
    <ChartReferenceLine Statistic="ChartStatistic.Average" Series="Revenue" />
    <ChartReferenceBand ArgumentFrom="@("Nov")" ArgumentTo="@("Dec")" Label="Holiday season" />
</Chart>

@code {
    private record MonthRevenue(string Month, decimal Revenue);

    private readonly MonthRevenue[] _months =
    [
        new("Jan", 84_200), new("Feb", 91_500), new("Mar", 102_300), new("Apr", 98_700),
        new("May", 110_400), new("Jun", 121_900), new("Jul", 117_600), new("Aug", 126_300),
        new("Sep", 133_800), new("Oct", 141_200), new("Nov", 156_900), new("Dec", 172_400),
    ];
}

The value axis always reaches a reference line, so a target above every value still shows. With Statistic and a series' name as Series, the line is that series' Average or Median.

ChartReferenceBand shades a range of values from From to To, or of arguments from ArgumentFrom to ArgumentTo, here November and December.

Connection lost

Rejoining the server…