Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Bar chart

Since 0.1.0-alpha.22
Compares values across names as bars: ranked across, grouped or stacked as columns.

Use bars to compare amounts across names, such as revenue by region. Bars start at zero, so their lengths compare fairly. Sort them when the order matters, as in a ranking. For many dates, use a line chart instead.

Ranked bars across

ChartBarSeries in a Chart draws a bar for each item's Value. Ranked names read best as bars across, longest first: set Orientation to Horizontal.

Static

Preview

Most visited pages, October

Code

Usage.razor
@* The most visited pages, ranked as bars across so their paths have room, each bar labeled with its value. *@
<Chart Items="_pages" Argument="p => p.Path" Title="Most visited pages, October" Orientation="Orientation.Horizontal">
    <ChartValueAxis HideLabels GridLines="false" />
    <ChartBarSeries Value="p => p.Views" Name="Views" Labels="ChartLabels.Auto" LabelFormat="N0" />
</Chart>

@code {
    private record PageViews(string Path, int Views);

    private readonly PageViews[] _pages =
    [
        new("/docs/get-started/install", 48_210),
        new("/docs/components/data-grid", 31_904),
        new("/docs/components/table", 22_470),
        new("/docs/get-started/from-radzen", 17_366),
        new("/docs/components/chart", 12_085),
        new("/pricing", 9_412),
    ];
}

Add this example to a page with the izzy CLI:

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

Long names have room down the side, ending in an ellipsis past a third of the chart's width.

With Labels writing each value at its bar's end, the value axis's labels and grid lines only repeat them. Here HideLabels and GridLines="false" on ChartValueAxis leave them out.

Everything on the Chart page works with every series type.

Grouped columns

Two or more ChartBarSeries stand side by side in each band, to compare the series name by name. To compare this year with last, draw last year first and in gray with Color, so the current year stands out in the chart's first color.

Static

Preview

Revenue by quarter, 2026 against 2025
  • 2025
  • 2026
Arrow keys move between values; Escape hides the tooltip.

Code

Grouped.razor
@* Revenue each quarter, this year beside last year: last year in gray, so this year stands out. *@
<Chart Items="_quarters" Argument="q => q.Quarter" Title="Revenue by quarter, 2026 against 2025">
    <ChartValueAxis Format="$#,##0,K" />
    <ChartBarSeries Value="q => q.LastYear" Name="2025" Color="var(--ib-color-neutral)" />
    <ChartBarSeries Value="q => q.ThisYear" Name="2026" />
</Chart>

@code {
    private record QuarterRevenue(string Quarter, decimal LastYear, decimal ThisYear);

    private readonly QuarterRevenue[] _quarters =
    [
        new("Q1", 412_000, 468_000),
        new("Q2", 438_000, 503_000),
        new("Q3", 455_000, 497_000),
        new("Q4", 521_000, 584_000),
    ];
}

Stacked

Stacking="ChartStacking.Normal" stacks the series, so each column's height is the total and each segment one part of it. The bottom segment reads most exactly, since it alone starts at zero: put the largest or most important part first. Keep to a few parts.

Static

Preview

Sales by region, 2026
  • Americas
  • Europe
  • Asia
Arrow keys move between values; Escape hides the tooltip.

Code

Stacked.razor
@* Sales by region each quarter, stacked so each column's height is the total. *@
<Chart Items="_quarters" Argument="q => q.Quarter" Title="Sales by region, 2026" Stacking="ChartStacking.Normal">
    <ChartValueAxis Format="$#,##0,K" />
    <ChartBarSeries Value="q => q.Americas" />
    <ChartBarSeries Value="q => q.Europe" />
    <ChartBarSeries Value="q => q.Asia" />
</Chart>

@code {
    private record QuarterSales(string Quarter, decimal Americas, decimal Europe, decimal Asia);

    private readonly QuarterSales[] _quarters =
    [
        new("Q1", 120_000, 84_000, 51_000),
        new("Q2", 134_000, 88_000, 63_000),
        new("Q3", 129_000, 97_000, 78_000),
        new("Q4", 151_000, 104_000, 92_000),
    ];
}

Shares of 100%

Stacking="ChartStacking.Percent" draws each stack to 100%, to compare how a whole divides rather than how big it is. As bars across, each runs the full width and the shares read left to right.

Static

Preview

Share of sales by region, 2026
  • Americas
  • Europe
  • Asia
Arrow keys move between values; Escape hides the tooltip.

Code

StackedPercent.razor
@* Each region's share of sales by quarter, as bars across that each run to 100%. *@
<Chart Items="_quarters" Argument="q => q.Quarter" Title="Share of sales by region, 2026" Stacking="ChartStacking.Percent" Orientation="Orientation.Horizontal">
    <ChartBarSeries Value="q => q.Americas" />
    <ChartBarSeries Value="q => q.Europe" />
    <ChartBarSeries Value="q => q.Asia" />
</Chart>

@code {
    private record QuarterSales(string Quarter, decimal Americas, decimal Europe, decimal Asia);

    private readonly QuarterSales[] _quarters =
    [
        new("Q1", 120_000, 84_000, 51_000),
        new("Q2", 134_000, 88_000, 63_000),
        new("Q3", 129_000, 97_000, 78_000),
        new("Q4", 151_000, 104_000, 92_000),
    ];
}

A Pareto chart

A Pareto chart ranks causes by count, with a line of their running share of the total, so the few that make most of it stand out. Sort the items largest first and work out each running share; draw the counts as ChartBarSeries and the share as a ChartLineSeries on a second ChartValueAxis from 0 to 1.

Static

Preview

Support tickets by reason, October
  • Tickets
  • Running share
Arrow keys move between values; Escape hides the tooltip.

Code

Pareto.razor
@* A month's support tickets by reason, most first, with the running share of all tickets on a
   second axis: the first three reasons are four in five of them. *@
<Chart Items="_reasons" Argument="r => r.Reason" Title="Support tickets by reason, October">
    <ChartValueAxis Title="Tickets" />
    <ChartValueAxis Name="share" Title="Share of all tickets" Format="P0" Min="0" Max="1" />
    <ChartBarSeries Value="r => r.Tickets" Name="Tickets" />
    <ChartLineSeries Value="r => r.Cumulative" Name="Running share" ValueAxis="share" Color="var(--ib-color-on-surface)" />
</Chart>

@code {
    private record TicketReason(string Reason, int Tickets, double Cumulative);

    private static readonly (string Reason, int Tickets)[] Counts =
    [
        ("Can't sign in", 182), ("Billing", 121), ("Late delivery", 87), ("Damaged item", 41),
        ("Wrong item", 28), ("Return label", 19), ("Other", 12),
    ];

    // Sorted largest first, each with the share of all tickets up to and including it.
    private readonly TicketReason[] _reasons = RunningShares(Counts);

    private static TicketReason[] RunningShares((string Reason, int Tickets)[] counts)
    {
        var total = (double)counts.Sum(c => c.Tickets);
        var sum = 0;
        return [.. counts.OrderByDescending(c => c.Tickets).Select(c => new TicketReason(c.Reason, c.Tickets, (sum += c.Tickets) / total))];
    }
}

Bars with targets

Target on ChartBarSeries draws a tick across each bar at the item's target, such as a team's quota, and names it in the tooltip and the data table. The value axis takes in every target, so one past every bar still shows.

Static

Preview

Bookings against quota by team, Q3 2026
Arrow keys move between values; Escape hides the tooltip.

Code

Target.razor
@* Each sales team's bookings against its quota: the tick across each bar is the team's quota. *@
<Chart Items="_teams" Argument="t => t.Team" Title="Bookings against quota by team, Q3 2026" Orientation="Orientation.Horizontal">
    <ChartValueAxis Format="$#,##0,,.00M" />
    <ChartBarSeries Value="t => t.Bookings" Target="t => t.Quota" Name="Bookings" />
</Chart>

@code {
    private record TeamBookings(string Team, decimal Bookings, decimal Quota);

    private readonly TeamBookings[] _teams =
    [
        new("Enterprise East", 1_240_000, 1_100_000),
        new("Enterprise West", 1_085_000, 1_200_000),
        new("Mid-market", 812_000, 750_000),
        new("Public sector", 596_000, 700_000),
        new("Partners", 431_000, 400_000),
        new("Small business", 288_000, 350_000),
    ];
}

Targets go on bars side by side; with Stacking they're an error.

For one measure against its target with qualitative ranges behind it (poor, satisfactory, good), use a Bullet chart.

Details

Bars stand upright, or lie across with the chart's Orientation="Orientation.Horizontal", which suits long names and rankings. Several bar series sit side by side, or stack with the chart's Stacking.

Mode support

What works in each mode, Bar chart
FeatureStaticInteractive
Bars across, or upright columnsYesYes
Grouped side by side, stacked, or stacked to 100%YesYes
A target tick across each bar, such as a quotaYesYes
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

ChartBarSeries parameters
PropTypeDefault
TargetEach item's target, such as r => r.Quota: a tick across its bar in the text color, named in the tooltip and data table ("$1.2M, target $1.5M").Expression<Func<TItem, object?>>?
OpacityHow solid the bars are, from 0 (the surface's color) to 1 (the series color).double?computed
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…