Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Annotations

Since 0.1.0-alpha.22
Short notes at a point, and lines at an argument such as a launch day, which move with the chart when the legend rescales it.

Annotations

ChartAnnotation puts a short Text at an Argument and Value, with a line down to the point. A ChartReferenceLine with an Argument in place of a Value draws a line at an argument, here the day of a launch. Hiding a series from the legend rescales the chart, and the marks move with it.

Static

Preview

Daily signups, Q3 2026
Arrow keys move between values; Escape hides the tooltip.Mobile app launch: 8/18/2026; Price change: 7/21/2026, 94

Code

Annotations.razor
@* Daily signups over a quarter, with notes at a price change and a launch. *@
<Chart Items="_days" Argument="d => d.Date" Title="Daily signups, Q3 2026">
    <ChartLineSeries Value="d => d.Signups" Markers="false" />
    <ChartReferenceLine Argument="@(new DateOnly(2026, 8, 18))" Label="Mobile app launch" />
    <ChartAnnotation Argument="@(new DateOnly(2026, 7, 21))" Value="94" Text="Price change" />
</Chart>

@code {
    private record Day(DateOnly Date, int Signups);

    private readonly Day[] _days = Enumerable.Range(0, 92).Select(i =>
    {
        var date = new DateOnly(2026, 7, 1).AddDays(i);
        var weekend = date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday;
        var level = i < 20 ? 140 : i < 48 ? 100 : 175;
        return new Day(date, level + (int)(12 * Math.Sin(i / 2.5)) - (weekend ? 30 : 0));
    }).ToArray();
}

Connection lost

Rejoining the server…