Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Crosshair

Since 0.1.0-alpha.22
Lines at the item under the pointer and at its nearest value, with both in badges on the axes, to read values off the axes exactly.

A crosshair

Crosshair draws a line at the item under the pointer and one at the value nearest it, with the item's argument and that value in badges on the axes, so a reader can read a line's value off the axis exactly.

Static

Preview

Temperature and dew point, July 14, 2026
Arrow keys move between values; Escape hides the tooltip.

Code

Crosshair.razor
@* A summer day's temperature and dew point by the hour, read off the axes with a crosshair. *@
<Chart Items="_hours" Argument="h => h.Hour" Title="Temperature and dew point, July 14, 2026" Crosshair>
    <ChartArgumentAxis Format="h tt" />
    <ChartValueAxis Format="0°F" />
    <ChartLineSeries Value="h => h.Temperature" Name="Temperature" EndLabel />
    <ChartLineSeries Value="h => h.DewPoint" Name="Dew point" EndLabel />
</Chart>

@code {
    private record HourReading(DateTime Hour, double Temperature, double DewPoint);

    private static readonly double[] Temperatures = [74, 73, 72, 71, 71, 70, 71, 74, 77, 80, 83, 86, 88, 90, 91, 92, 91, 89, 87, 84, 81, 79, 77, 76];
    private static readonly double[] DewPoints = [66, 66, 65, 65, 65, 64, 65, 66, 67, 67, 68, 68, 67, 67, 66, 66, 66, 67, 67, 68, 68, 67, 67, 66];

    private readonly HourReading[] _hours = Enumerable.Range(0, 24)
        .Select(h => new HourReading(new DateTime(2026, 7, 14, h, 0, 0), Temperatures[h], DewPoints[h]))
        .ToArray();
}

The value line snaps to the series nearest the pointer; from the keyboard it stays on the series it was on.

On a scatter or bubble chart, both lines run through the nearest point. The crosshair goes with the tooltip, so with Tooltip false there's none, and it's left out of downloads.

Connection lost

Rejoining the server…