Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Line chart

Since 0.1.0-alpha.22
Shows how values change over time as lines, on a date or number scale.

A line chart is the standard way to show change over time. The value axis doesn't have to start at zero, so small changes show. More than four or five lines get hard to follow. Highlight the one that matters, or give each line its own chart.

A few lines over time

ChartLineSeries in a Chart takes each item's Value. To write each line's name where it ends, so the reader doesn't look across to a legend, set EndLabel.

Static

Preview

Weekly active users by app, 2025–2026
Arrow keys move between values; Escape hides the tooltip.

Code

Usage.razor
@* Weekly active users of three apps over two years: a few lines over time, on a date scale, each named where it ends. *@
<Chart Items="_months" Argument="m => m.Month" Title="Weekly active users by app, 2025–2026">
    <ChartValueAxis Format="#,##0,K" />
    <ChartLineSeries Value="m => m.Web" Name="Web" EndLabel />
    <ChartLineSeries Value="m => m.Ios" Name="iOS" EndLabel />
    <ChartLineSeries Value="m => m.Android" Name="Android" EndLabel />
</Chart>

@code {
    private record AppMonth(DateOnly Month, int Web, int Ios, int Android);

    private static readonly int[] WebUsers = [182_000, 186_000, 191_000, 189_000, 194_000, 198_000, 196_000, 201_000, 205_000, 203_000, 207_000, 211_000, 209_000, 212_000, 214_000, 213_000, 216_000, 219_000, 217_000, 220_000, 222_000, 221_000, 224_000, 226_000];
    private static readonly int[] IosUsers = [64_000, 69_000, 75_000, 82_000, 88_000, 96_000, 103_000, 109_000, 118_000, 126_000, 131_000, 139_000, 146_000, 152_000, 160_000, 167_000, 171_000, 178_000, 184_000, 190_000, 194_000, 199_000, 205_000, 211_000];
    private static readonly int[] AndroidUsers = [41_000, 44_000, 46_000, 51_000, 55_000, 58_000, 63_000, 66_000, 72_000, 77_000, 80_000, 86_000, 91_000, 95_000, 101_000, 106_000, 110_000, 117_000, 121_000, 126_000, 133_000, 137_000, 142_000, 149_000];

    private readonly AppMonth[] _months = Enumerable.Range(0, 24)
        .Select(i => new AppMonth(new DateOnly(2025, 1, 1).AddMonths(i), WebUsers[i], IosUsers[i], AndroidUsers[i]))
        .ToArray();
}

Add this example to a page with the izzy CLI:

bash
izzy add component ChartLineSeries --at <file>:<line>

With dates as the Argument, the points sit on a date scale, with a tick per month or year as the width allows.

Keep to a few lines. Each takes the next color and a dash pattern and marker of its own, so they differ by more than color. With every line named, the chart leaves the legend out.

Everything on the Chart page works with every series type.

Daily values and a moving average

Daily numbers swing with the day of the week, which hides where they're heading. Trend="ChartTrend.MovingAverage" with a TrendPeriod of 7 draws the average of each week beside the daily line, so the direction reads at a glance and the days stay in view. With this many points, the line has no markers.

Static

Preview

Daily signups, last 90 days
  • Signups
  • Signups, 7-day average
Arrow keys move between values; Escape hides the tooltip.

Code

Lines.razor
@* Daily signups over 90 days, noisy by weekday, with a 7-day moving average that shows the direction. *@
<Chart Items="_days" Argument="d => d.Date" Title="Daily signups, last 90 days">
    <ChartLineSeries Value="d => d.Signups" Name="Signups" Trend="ChartTrend.MovingAverage" TrendPeriod="7" />
</Chart>

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

    private readonly Day[] _days = Enumerable.Range(0, 90).Select(i =>
    {
        var date = new DateOnly(2026, 8, 6).AddDays(i);
        var weekend = date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday;
        return new Day(date, 140 + i + (int)(18 * Math.Sin(i / 9.0)) + (i * 37 % 23) - (weekend ? 55 : 0));
    }).ToArray();
}

Smooth lines

Curve="ChartCurve.Smooth" draws a curve through the values, which suits a measure that changes continuously between readings, such as temperature. The curve never overshoots a value, so it doesn't invent peaks the data doesn't have. Keep straight lines for counts and totals, where a curve suggests values between the points that were never measured.

Static

Preview

Average high temperature by month (°C)
Arrow keys move between values; Escape hides the tooltip.

Code

LineSmooth.razor
@* Average temperature by month in two cities: a measure that changes continuously between readings, drawn as smooth lines. *@
<Chart Items="_months" Argument="m => m.Month" Title="Average high temperature by month (°C)">
    <ChartValueAxis Format="0'°'" />
    <ChartLineSeries Value="m => m.Chicago" Name="Chicago" Curve="ChartCurve.Smooth" EndLabel />
    <ChartLineSeries Value="m => m.Sydney" Name="Sydney" Curve="ChartCurve.Smooth" EndLabel />
</Chart>

@code {
    private record MonthTemperature(string Month, double Chicago, double Sydney);

    private readonly MonthTemperature[] _months =
    [
        new("Jan", 0, 26), new("Feb", 2, 26), new("Mar", 9, 25), new("Apr", 15, 23),
        new("May", 21, 20), new("Jun", 27, 18), new("Jul", 29, 17), new("Aug", 28, 18),
        new("Sep", 24, 20), new("Oct", 17, 22), new("Nov", 9, 24), new("Dec", 3, 25),
    ];
}

Step lines

Curve="ChartCurve.Step" holds each value flat until the next one's date, then steps: for values that stay put until they change, such as a price, a rate or a plan's tier. Add a last item at today's date so the current value runs to the present.

Static

Preview

Team plan price per seat, 2024–2026
Arrow keys move between values; Escape hides the tooltip.

Code

LineStep.razor
@* A plan's price per seat over three years: it holds until the next change, so it's drawn as steps. *@
<Chart Items="_prices" Argument="p => p.Date" Title="Team plan price per seat, 2024–2026">
    <ChartValueAxis Format="$0" Min="0" />
    <ChartLineSeries Value="p => p.Price" Name="Price per seat" Curve="ChartCurve.Step" />
</Chart>

@code {
    private record PriceChange(DateOnly Date, decimal Price);

    // Each change, and today, so the last price runs to the present.
    private readonly PriceChange[] _prices =
    [
        new(new DateOnly(2024, 1, 1), 8),
        new(new DateOnly(2024, 7, 1), 10),
        new(new DateOnly(2025, 3, 1), 12),
        new(new DateOnly(2025, 9, 15), 11),
        new(new DateOnly(2026, 4, 1), 14),
        new(new DateOnly(2026, 11, 7), 14),
    ];
}

Details

Each line series is one line, and several lines differ by dash as well as by color.

Mode support

What works in each mode, Line chart
FeatureStaticInteractive
Lines over dates, numbers or names, straight, smooth or steppedYesYes
Dashes and marker shapes that tell lines apart besides colorYesYes
Each line's name at its end, nudged apart where lines end close togetherYesYes
Drawn on the server, as wide as its container, with labels that thin out as it narrowsYesYes
A table of the values behind a "Show data" buttonYesYes
Tooltips on hover and from the keyboardYesYes
Legend items that hide and show a seriesYesYes

Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.

Without JavaScript

Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off.

  • Tooltips on hover and from the keyboard: waits for the script
  • Legend items that hide and show a series: waits for the script

Parameters

ChartLineSeries parameters
PropTypeDefault
LineStyleHow the line is drawn.ChartLineStyle?computed
CurveThe line's shape between values.ChartCurveChartCurve.Straight
MarkersWhether each value is marked.bool?computed
ConnectGapsDraws the line straight across a missing value, instead of leaving a gap.boolfalse
EndLabelWrites the series' name just past the plot's end, level with its last value, in its color: the reader names the line where it ends, without looking across to a legend.boolfalse
ValueThe value to draw, such as m => m.Revenue: any number, or null for none.Expression<Func<TItem, object?>>Required
AggregateWith ChartDrillLevel<T>s, how each level adds up its items' values: DataAggregate.Sum (the default), DataAggregate.Avg, DataAggregate.Min, DataAggregate.Max or DataAggregate.Count (the items with a value).DataAggregateDataAggregate.Sum
NameThe series' name, in the legend, the data table and each value's description.string?computed
SeriesBySplits the series into one per value of this, such as p => p.Device: each draws only its own items' values, is named by its value, and takes the next color and marker, in the order the values first appear.Expression<Func<TItem, object?>>?
ColorA CSS color, such as var(--ib-color-danger) or #0f766e.string?computed
LabelsWrites each value beside its bar or point.ChartLabelsChartLabels.None
LabelFormatA .NET format string for this series' labels, such as C0.string?computed
LabelTextWhat each label says in place of its value, such as r => r.Region to name each bubble or point.Expression<Func<TItem, object?>>?
LabelOverlapWhat labels do when they'd overlap others: left out at those widths (ChartLabelOverlap.Hide, the default), or shown anyway (ChartLabelOverlap.Show).ChartLabelOverlapChartLabelOverlap.Hide
TrendDraws a trend through the values: a dashed line in the series' color, named "Revenue trend" (a moving average "Revenue, 7-day average") in the legend, tooltips and data table.ChartTrendChartTrend.None
TrendOrderA polynomial trend's order, 2 (a parabola) to 6.int2
TrendPeriodHow many values a moving average takes in, 2 or more.int3
TrendColorThe trend's CSS color, such as var(--ib-color-danger), used as given.string?computed
ValueAxisThe Name of the value axis the series is read off, for a measure in other units on a second axis at the end side, such as "margin".string?computed
HiddenStarts with the series hidden: the chart is drawn as if it weren't there, and it keeps its place in the legend, to show it again, and in the data table.boolfalse

Connection lost

Rejoining the server…