Skip to content
daisyBlazor

BarChart

Vertical or horizontal bars, either flat from Data or grouped from Series (Series wins when both are set). Bars take theme colours unless a point or series sets its own. D3 lays out the bands and the value axis.
Essentials
Cover · <BarChart>

Paid plans keep growing

Bar chart Paid: '21 21, '22 27, '23 33, '24 38, '25 44, '26 48; Free: '21 34, '22 30, '23 27, '24 24, '25 22, '26 21 '21'22'23'24'25'2601020304050Paid · '21: 21Paid · '22: 27Paid · '23: 33Paid · '24: 38Paid · '25: 44Paid · '26: 48Free · '21: 34Free · '22: 30Free · '23: 27Free · '24: 24Free · '25: 22Free · '26: 21
Paid Free

Examples

Flat data

A list of ChartDataPoint, one bar per label.

Accounts by plan, 2026
Accounts by plan, 2026 Free 48,200, Pro 39,900, Team 21,100, Enterprise 8,300 FreeProTeamEnterprise010k20k30k40k50kFree: 48,200Pro: 39,900Team: 21,100Enterprise: 8,300
website/Examples/Charts/BarChartBasicExample.razor Source

Grouped series

Labels name the groups; each ChartSeries adds one bar per group and a legend entry.

Active seats by plan and quarter (thousands)
Active seats by plan and quarter (thousands) Pro: Q1 10.2, Q2 11.8, Q3 12.4, Q4 18.9; Team: Q1 6.1, Q2 5.4, Q3 4.9, Q4 7.2; Enterprise: Q1 9.7, Q2 10.3, Q3 11.1, Q4 12.6 Q1Q2Q3Q405101520Pro · Q1: 10.2Pro · Q2: 11.8Pro · Q3: 12.4Pro · Q4: 18.9Team · Q1: 6.1Team · Q2: 5.4Team · Q3: 4.9Team · Q4: 7.2Enterprise · Q1: 9.7Enterprise · Q2: 10.3Enterprise · Q3: 11.1Enterprise · Q4: 12.6
Pro Team Enterprise
website/Examples/Charts/BarChartGroupedExample.razor Source

Horizontal

Horizontal flips the axes so categories read down the side; the label gutter grows with the names up to 40% of the width, and longer names are cut with an ellipsis.

Traffic by region (k requests per day)
Traffic by region (k requests per day) Europe 1,240, US 980, APAC 760, LatAm 610, Africa 420 02004006008001k1.2k1.4kEuropeUSAPACLatAmAfricaEurope: 1,240US: 980APAC: 760LatAm: 610Africa: 420
website/Examples/Charts/BarChartHorizontalExample.razor Source

Stacked

Stacked puts the series in one bar per label; positive values stack up from zero and negative ones down, so mixed signs diverge. Tooltips keep each series' own value.

Net seat change by plan and quarter
Net seat change by plan and quarter Pro added: Q1 420, Q2 510, Q3 480, Q4 620; Team added: Q1 180, Q2 220, Q3 260, Q4 240; Seats removed: Q1 -140, Q2 -90, Q3 -210, Q4 -160 Q1Q2Q3Q4-400-20002004006008001kPro added · Q1: 420Pro added · Q2: 510Pro added · Q3: 480Pro added · Q4: 620Team added · Q1: 180Team added · Q2: 220Team added · Q3: 260Team added · Q4: 240Seats removed · Q1: -140Seats removed · Q2: -90Seats removed · Q3: -210Seats removed · Q4: -160
Pro added Team added Seats removed
website/Examples/Charts/BarChartStackedExample.razor Source

100% stacked

Percent stacks each bar to 100% of its total, here horizontal; tooltips show the value and the share.

Support tickets by priority, share per team
Support tickets by priority, share per team Low: Billing 120, Platform 64, Identity 38, Storage 90; Normal: Billing 210, Platform 140, Identity 72, Storage 150; High: Billing 40, Platform 85, Identity 30, Storage 26; Urgent: Billing 8, Platform 21, Identity 12, Storage 5 0%20%40%60%80%100%BillingPlatformIdentityStorageLow · Billing: 120 (31.7%)Low · Platform: 64 (20.6%)Low · Identity: 38 (25%)Low · Storage: 90 (33.2%)Normal · Billing: 210 (55.6%)Normal · Platform: 140 (45.2%)Normal · Identity: 72 (47.4%)Normal · Storage: 150 (55.4%)High · Billing: 40 (10.6%)High · Platform: 85 (27.4%)High · Identity: 30 (19.7%)High · Storage: 26 (9.6%)Urgent · Billing: 8 (2.1%)Urgent · Platform: 21 (6.8%)Urgent · Identity: 12 (7.9%)Urgent · Storage: 5 (1.8%)
Low Normal High Urgent
website/Examples/Charts/BarChartPercentExample.razor Source

Side-by-side stacks

Give each ChartSeries a Stack name: series with the same name stack together and the stacks stand side by side in each label.

Active seats by plan, EU and US side by side (thousands)
Active seats by plan, EU and US side by side (thousands) Pro · EU: Q1 6.2, Q2 6.9, Q3 7.4, Q4 8.1; Team · EU: Q1 2.8, Q2 3.1, Q3 3.3, Q4 3.9; Pro · US: Q1 8.4, Q2 9, Q3 9.8, Q4 10.6; Team · US: Q1 3.6, Q2 3.8, Q3 4.4, Q4 4.9 Q1Q2Q3Q405101520Pro · EU · Q1: 6.2Pro · EU · Q2: 6.9Pro · EU · Q3: 7.4Pro · EU · Q4: 8.1Team · EU · Q1: 2.8Team · EU · Q2: 3.1Team · EU · Q3: 3.3Team · EU · Q4: 3.9Pro · US · Q1: 8.4Pro · US · Q2: 9Pro · US · Q3: 9.8Pro · US · Q4: 10.6Team · US · Q1: 3.6Team · US · Q2: 3.8Team · US · Q3: 4.4Team · US · Q4: 4.9
Pro · EU Team · EU Pro · US Team · US
website/Examples/Charts/BarChartStackGroupsExample.razor Source

Per-bar colours

Give a point any CSS colour; ChartPalette.FromColor maps a Color value to its theme token.

Support tickets by type
Support tickets by type Bug 18, Billing 11, How-to 6, Feature request 4 BugBillingHow-toFeature request05101520Bug: 18Billing: 11How-to: 6Feature request: 4
website/Examples/Charts/BarChartColorsExample.razor Source

References draws a line across the bars at a value (a target, a limit) and Bands shades a value range behind them; on a Horizontal chart both run down the plot.

Deployments per team this month
Deployments per team this month Platform 64, Billing 22, Search 41, Mobile 18, Data 35 PlatformBillingSearchMobileData010203040506070Healthy range: 30 to 50Platform: 64Billing: 22Search: 41Mobile: 18Data: 35Target: 40Healthy rangeTarget
website/Examples/Charts/BarChartReferencesExample.razor Source

Trend lines

Trendline fits a dashed trend to each series over the categories and draws it through their centres, also on a Horizontal chart; the same kinds as LineChart, here Linear. Hover it for the equation and R². Ignored when Stacked or Percent.

Support tickets by month
Support tickets by month Opened: Jan 420, Feb 455, Mar 430, Apr 480, May 510, Jun 495, Jul 540, Aug 560; Escalated: Jan 96, Feb 88, Mar 91, Apr 80, May 74, Jun 77, Jul 65, Aug 60 JanFebMarAprMayJunJulAug0100200300400500600Opened · Jan: 420Opened · Feb: 455Opened · Mar: 430Opened · Apr: 480Opened · May: 510Opened · Jun: 495Opened · Jul: 540Opened · Aug: 560Escalated · Jan: 96Escalated · Feb: 88Escalated · Mar: 91Escalated · Apr: 80Escalated · May: 74Escalated · Jun: 77Escalated · Jul: 65Escalated · Aug: 60Opened linear trend: y = 19.4x + 418.3, R² = 0.902 Escalated linear trend: y = -4.94x + 96.17, R² = 0.931
Opened Escalated
website/Examples/Charts/BarChartTrendlineExample.razor Source

Playground

Accounts by plan, 2026
Accounts by plan, 2026 Free 48,200, Pro 39,900, Team 21,100, Enterprise 8,300 FreeProTeamEnterprise010k20k30k40k50kFree: 48,200Pro: 39,900Team: 21,100Enterprise: 8,300
Trendline ChartTrendline
<BarChart Title="Accounts by plan, 2026" Data="@_accounts" />

@code {
    private readonly ChartDataPoint[] _accounts =
    [
        new("Free", 48_200),
        new("Pro", 39_900),
        new("Team", 21_100),
        new("Enterprise", 8_300),
    ];
}

API

<BarChart>

DaisyBlazor.Charts

Parameters

  • Bands IReadOnlyList<ChartBand>
    = null

    Shaded value ranges (plot bands) drawn behind the bars, cut to the plot, each with an optional label in its corner.

  • Data IReadOnlyList<ChartDataPoint>
    = null

    Flat data points; used when no Series are supplied.

  • Height string
    = "16rem"

    CSS height of the SVG plot area.

  • Horizontal bool
    = false

    Render bars horizontally instead of vertically.

  • Labels IReadOnlyList<string>
    = null

    Category labels for grouped Series mode (index-aligned with series values).

  • Markers IReadOnlyList<ChartMarker>
    = null

    Markers on the category axis: a line at a category (the month a pricing change shipped), or with To a shaded span over a run of categories, each with an optional label outside the plot. They run across the chart when it is Horizontal. A marker naming a category the chart does not have is ignored.

  • Percent bool
    = false

    100% stacked bars (implies Stacked): each bar shows the shares of its stack's total (of absolute values) in the category, on a percent axis. Tooltips show the value and the share. Meant for grouped Series; a flat list fills every bar.

  • References IReadOnlyList<ChartReference>
    = null

    Reference lines across the plot at a value (a target, a limit, a break-even point), drawn over the bars with their label inside the plot. The value axis grows to show every line.

  • RowHeight double?
    = null

    Height of each category row in px when the bars lie Horizontal: the chart is then sized by its categories instead of Height, so a long list neither squeezes its rows nor leaves them sparse. Ignored for columns.

  • Series IReadOnlyList<ChartSeries>
    = null

    Grouped series (one bar per series within each category). Takes precedence over Data.

  • ShowGrid bool
    = true

    Draw value gridlines and labels.

  • ShowLegend bool
    = true

    Show a legend when more than one series is present.

  • ShowTitle bool
    = true

    Draw Title as a visible heading above the chart (the default); false keeps it only as the chart's accessible name, for a chart inside a card that already has a heading.

  • Stacked bool
    = false

    Stack the series in one bar per category instead of side by side: positive values stack up from zero and negative ones down, so mixed signs diverge. Series with different Stack names form stacks standing side by side. Tooltips still show each series' own value.

  • Title string
    = null

    Optional heading rendered above the chart.

  • Trendline ChartTrendline
    = ChartTrendline.None

    Fit and draw a dashed trend line per series, over the category index (0, 1, …) on the series' own values, through the category positions (also when Horizontal); a flat Data list is one series; its tooltip gives the equation and R², or the period of a moving average. Ignored when Stacked or Percent is on: a fit of the own values would not follow the stacked bars.

  • TrendlineOrder int
    = 2

    Degree of a Polynomial trend line, from 2 to 6 (other values are clamped).

  • TrendlinePeriod int
    = 3

    Number of points a MovingAverage trend line averages (at least 2).

  • Width string
    = "100%"

    CSS width of the chart wrapper.

  • Class string
    = null

    Extra CSS classes added to the chart wrapper.

  • Style string
    = null

    Inline CSS style appended to the chart wrapper.

Something went wrong while running the docs. Reload