Skip to content
CHARTS · COMPLETE

LineChart

Show trends over time with several series and a clickable legend.

Show trends over time with several series, optional smoothing and area fill, and a clickable legend that hides or shows each series.

Why it helps

  • Several series
  • Smooth and area options
  • Clickable legend

Where it fits

  • Traffic and revenue trends
  • Sensor data
  • KPIs over time

Example

<Stack Direction="StackDirection.Column" Spacing="3">
    <Stack Spacing="6">
        <Switch @bind-Value="_smooth" Label="Smooth" />
        <Switch @bind-Value="_area" Label="Area" />
    </Stack>
    <LineChart Label="Visitors per month" Series="_series" Categories="_months" Smooth="_smooth" Area="_area" />
</Stack>

@code {
    private bool _smooth;
    private bool _area;
    private readonly string[] _months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

    private readonly ChartSeries[] _series =
    [
        new("Website", [1200, 1350, 1280, 1600, 1900, 2100, 2000, 2300, 2150, 2500, 2700, 3100]),
        new("Mobile app", [400, 520, 610, 700, 950, 1100, 1300, 1250, 1500, 1700, 1650, 2000])
    ];
}

A short fragment. Add @using RayCraft.Blazor.Components to your page and use an interactive render mode.

Part of RayCraft Complete.

All controls ยท Documentation