DeepWorks Studios Blazor Component Library

Demo user Administrator ยท Blazor Server Library 20261206222504-6e8ff32.dirty

DwsChartBar

Compares values across categories as vertical columns or horizontal bars; several series are drawn side by side, stacked or stacked to 100 %, with value and category axes.

API Reference

Vertical Bar Chart

Vertical bar chart without legend.

Category A Category B Category C

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart03" ChartData="@_barChartData" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};

Vertical Bar Chart with Legend

Vertical bar chart with legend enabled.

Category A Category B Category C
Category A
Category B
Category C

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart04" ChartData="@_barChartData" Height="200" WithLegend="true"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};

Horizontal Bar Chart

Horizontal bar chart without legend.

Category A Category B Category C

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart05" ChartData="@_barChartData" Orientation="DwsLayoutOrientation.Horizontal" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};

Horizontal Bar Chart with Legend

Horizontal bar chart with legend enabled.

Category A Category B Category C
Category A
Category B
Category C

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart06" ChartData="@_barChartData" Orientation="DwsLayoutOrientation.Horizontal" Height="200" WithLegend="true"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};

Chart Title

Title renders a heading above the chart.

Sales by Category
Category A Category B Category C

3 values, from 20 to 50

Sales by Category
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart06b" ChartData="@_barChartData" Title="Sales by Category" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};

Grid Line Count

ShowGrid draws grid lines behind the bars; GridLineCount sets how many, here 8.

Category A Category B Category C

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="BarChartDemo_ChartGrid" ChartData="@_barChartData" ShowGrid="true" GridLineCount="8" ShowTooltip="false" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};

Legend Metadata

The Metadata of a data element is listed in its legend row and tooltip.

Category A Category B Category C
Category A
Units sold: 300, Region: North
Category B
Units sold: 500, Region: South
Category C
Units sold: 200, Region: East

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="BarChartDemo_ChartMetadata" ChartData="@_barChartDataWithMetadata" Height="200" WithLegend="true"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartDataWithMetadata = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384") { Metadata = new() { ["Units sold"] = "300", ["Region"] = "North" } },
        new DwsChartBarDataElement("Category B", 50, "#36A2EB") { Metadata = new() { ["Units sold"] = "500", ["Region"] = "South" } },
        new DwsChartBarDataElement("Category C", 20, "#FFCE56") { Metadata = new() { ["Units sold"] = "200", ["Region"] = "East" } }
    ]
};

Color Selector

A ColorSelector delegate picks the color of each bar and legend row, here alternating between two theme colors.

Category A Category B Category C
Category A
Category B
Category C

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="BarChartDemo_ChartColorSelector" ChartData="@_barChartData" ColorSelector="@_barColorSelector" Height="200" WithLegend="true"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384"),
        new DwsChartBarDataElement("Category B", 50, "#36A2EB"),
        new DwsChartBarDataElement("Category C", 20, "#FFCE56")
    ]
};
private readonly Func<DwsChartBarDataElement, int, string> _barColorSelector =
    (_, index) => index % 2 == 0 ? "var(--primary)" : "var(--accent)";

No Data

Placeholder shown when ChartData has no elements.

No data available

No values

Chart
LabelValue
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart06d" ChartData="@_emptyBarChartData" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _emptyBarChartData = new();

Custom Legend Metadata Formatter

LegendMetadataFormatter overrides how an element's Metadata is rendered in the legend.

Category A Category B Category C
Category A
(2 details) Units sold = 300 | Region = North
Category B
(2 details) Units sold = 500 | Region = South
Category C
(2 details) Units sold = 200 | Region = East

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart06e" ChartData="@_barChartDataWithMetadata" LegendMetadataFormatter="@FormatLegendMetadata" Height="200" WithLegend="true"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _barChartDataWithMetadata = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Category A", 30, "#FF6384") { Metadata = new() { ["Units sold"] = "300", ["Region"] = "North" } },
        new DwsChartBarDataElement("Category B", 50, "#36A2EB") { Metadata = new() { ["Units sold"] = "500", ["Region"] = "South" } },
        new DwsChartBarDataElement("Category C", 20, "#FFCE56") { Metadata = new() { ["Units sold"] = "200", ["Region"] = "East" } }
    ]
};
// A method group: the chart gets the same delegate on every render.
private string? FormatLegendMetadata(DwsChartBarDataElement element) =>
    element.Metadata is { Count: > 0 }
        ? $"({element.Metadata.Count} details) " + string.Join(" | ", element.Metadata.Select(kv => $"{kv.Key} = {kv.Value}"))
        : null;

Many Categories

Ten categories in one vertical bar chart, showing the category-band geometry spacing bars evenly as the count grows.

Mon Tue Wed Thu Fri Sat Sun Wk+1 Mon Wk+1 Tue Wk+1 Wed

10 values, from 22 to 74

Chart
LabelValue
Mon42
Tue55
Wed38
Thu61
Fri74
Sat30
Sun22
Wk+1 Mon48
Wk+1 Tue57
Wk+1 Wed45
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart06f" ChartData="@_manyCategoryBarChartData" ShowGrid="true" GridLineCount="4" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _manyCategoryBarChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Mon", 42, "#5B8FF9"),
        new DwsChartBarDataElement("Tue", 55, "#5B8FF9"),
        new DwsChartBarDataElement("Wed", 38, "#5B8FF9"),
        new DwsChartBarDataElement("Thu", 61, "#5B8FF9"),
        new DwsChartBarDataElement("Fri", 74, "#5B8FF9"),
        new DwsChartBarDataElement("Sat", 30, "#5B8FF9"),
        new DwsChartBarDataElement("Sun", 22, "#5B8FF9"),
        new DwsChartBarDataElement("Wk+1 Mon", 48, "#5B8FF9"),
        new DwsChartBarDataElement("Wk+1 Tue", 57, "#5B8FF9"),
        new DwsChartBarDataElement("Wk+1 Wed", 45, "#5B8FF9")
    ]
};

Sparse Grid, No Tooltip

A single grid line and the tooltip disabled, for a quieter presentation-style chart.

Plan A Plan B Plan C

3 values, from 45 to 70

Chart
LabelValue
Plan A45
Plan B70
Plan C55
Show Code
BarChart.razor
<DwsChartBar Name="ChartDemo_Chart06h" ChartData="@_sparseBarChartData" ShowGrid="true" GridLineCount="1" ShowTooltip="false" Height="200" WithLegend="false"></DwsChartBar>
BarChart.razor.cs
private readonly DwsChartBarData _sparseBarChartData = new()
{
    DataElements =
    [
        new DwsChartBarDataElement("Plan A", 45, "#5B8FF9"),
        new DwsChartBarDataElement("Plan B", 70, "#61DDAA"),
        new DwsChartBarDataElement("Plan C", 55, "#F6BD16")
    ]
};

Axis Number Format

AxisValueFormatter (DwsChartBar, DwsChartLine, DwsChartArea) writes the tick labels of the value axis in the application's own format instead of compact numbers ("1.2K"); it receives the tick's value. Pass a method or a delegate kept in a field: a lambda written in the markup is new with every render and makes the chart work its drawing out again.

Revenue 2025 vs 2026
Revenue 2025, Jan Revenue 2025, Feb Revenue 2025, Mar Revenue 2025, Apr Revenue 2025, May Revenue 2025, Jun Revenue 2025, Jul Revenue 2025, Aug Revenue 2025, Sep Revenue 2025, Oct Revenue 2025, Nov Revenue 2025, Dec Revenue 2026, Jan Revenue 2026, Feb Revenue 2026, Mar Revenue 2026, Apr Revenue 2026, May Revenue 2026, Jun Revenue 2026, Jul Revenue 2026, Aug Revenue 2026, Sep
Revenue 2025
Revenue 2026

2 series, 12 categories, values from 42 to 80

Revenue 2025 vs 2026
LabelRevenue 2025Revenue 2026
Jan4250
Feb4554
Mar5149
Apr4860
May5666
Jun6171
Jul5869
Aug5574
Sep6379
Oct68–
Nov72–
Dec80–
Revenue 2025 vs 2026
Revenue 2025, JanRevenue 2025, FebRevenue 2025, MarRevenue 2025, AprRevenue 2025, MayRevenue 2025, JunRevenue 2025, JulRevenue 2025, AugRevenue 2025, SepRevenue 2025, OctRevenue 2025, NovRevenue 2025, DecRevenue 2026, JanRevenue 2026, FebRevenue 2026, MarRevenue 2026, AprRevenue 2026, MayRevenue 2026, JunRevenue 2026, JulRevenue 2026, AugRevenue 2026, Sep
Revenue 2025
Revenue 2026

2 series, 12 categories, values from 42 to 80

Revenue 2025 vs 2026
LabelRevenue 2025Revenue 2026
Jan4250
Feb4554
Mar5149
Apr4860
May5666
Jun6171
Jul5869
Aug5574
Sep6379
Oct68–
Nov72–
Dec80–
Show Code
BarChart.razor
<DwsSwitch Name="ChartDemo_AxisFormat_Euro" @bind-Value="_axisFormatEuro" Label="AxisValueFormatter (EUR)" />

<DwsChartBar Name="ChartDemo_AxisFormatBar" Title="Revenue 2025 vs 2026" SeriesData="@_revenueSeriesData" AxisValueFormatter="@AxisFormatter" Height="300"></DwsChartBar>
<DwsChartLine Name="ChartDemo_AxisFormatLine" Title="Revenue 2025 vs 2026" SeriesData="@_revenueSeriesData" AxisValueFormatter="@AxisFormatter" Height="300"></DwsChartLine>
BarChart.razor.cs
private static readonly string[] _seriesMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

private readonly DwsChartSeriesData _revenueSeriesData = new DwsChartSeriesData(_seriesMonths)
    .AddSeries("Revenue 2025", [42, 45, 51, 48, 56, 61, 58, 55, 63, 68, 72, 80])
    .AddSeries("Revenue 2026", [50, 54, 49, 60, 66, 71, 69, 74, 79, null, null, null]);
private bool _axisFormatEuro = true;

// A delegate kept in a field: a lambda written in the markup is new with every render.
private static readonly Func<double, string> _euroFormatter = value => value.ToString("N0", CultureInfo.CurrentCulture) + " k€";

private Func<double, string>? AxisFormatter => _axisFormatEuro ? _euroFormatter : null;

Rounded Bars

BarCornerRadius rounds the corners of the bars, in units of the drawing; the browser limits it to half of a bar's shorter side, so thin bars become pills.

Revenue 2025 vs 2026
Revenue 2025, Jan Revenue 2025, Feb Revenue 2025, Mar Revenue 2025, Apr Revenue 2025, May Revenue 2025, Jun Revenue 2025, Jul Revenue 2025, Aug Revenue 2025, Sep Revenue 2025, Oct Revenue 2025, Nov Revenue 2025, Dec Revenue 2026, Jan Revenue 2026, Feb Revenue 2026, Mar Revenue 2026, Apr Revenue 2026, May Revenue 2026, Jun Revenue 2026, Jul Revenue 2026, Aug Revenue 2026, Sep
Revenue 2025
Revenue 2026

2 series, 12 categories, values from 42 to 80

Revenue 2025 vs 2026
LabelRevenue 2025Revenue 2026
Jan4250
Feb4554
Mar5149
Apr4860
May5666
Jun6171
Jul5869
Aug5574
Sep6379
Oct68–
Nov72–
Dec80–
Show Code
BarChart.razor
<DwsSwitch Name="ChartDemo_AxisFormat_Rounded" @bind-Value="_axisFormatRounded" Label="BarCornerRadius 6" />

<DwsChartBar Name="BarChartDemo_CornerRadiusBar" Title="Revenue 2025 vs 2026" SeriesData="@_revenueSeriesData" BarCornerRadius="@CornerRadius" Height="300"></DwsChartBar>
BarChart.razor.cs
private static readonly string[] _seriesMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

private readonly DwsChartSeriesData _revenueSeriesData = new DwsChartSeriesData(_seriesMonths)
    .AddSeries("Revenue 2025", [42, 45, 51, 48, 56, 61, 58, 55, 63, 68, 72, 80])
    .AddSeries("Revenue 2026", [50, 54, 49, 60, 66, 71, 69, 74, 79, null, null, null]);
private bool _axisFormatRounded = true;

private double CornerRadius => _axisFormatRounded ? 6 : 0;

Data Transfer per Day (ValueFormat Bytes)

Values in bytes with ValueFormat Bytes: axis, value labels and a pinned tooltip write the value in B, KB, MB or GB (steps of 1024, "954 MB", "2.35 GB"), in the current language's number format. Stacked turns the two series into one bar per day, so the 30 days fit a phone without scrolling.

Data transfer per day
Downloads, Sunday, November 1, 2026 Downloads, Monday, November 2, 2026 Downloads, Tuesday, November 3, 2026 Downloads, Wednesday, November 4, 2026 Downloads, Thursday, November 5, 2026 Downloads, Friday, November 6, 2026 Downloads, Saturday, November 7, 2026 Downloads, Sunday, November 8, 2026 Downloads, Monday, November 9, 2026 Downloads, Tuesday, November 10, 2026 Downloads, Wednesday, November 11, 2026 Downloads, Thursday, November 12, 2026 Downloads, Friday, November 13, 2026 Downloads, Saturday, November 14, 2026 Downloads, Sunday, November 15, 2026 Downloads, Monday, November 16, 2026 Downloads, Tuesday, November 17, 2026 Downloads, Wednesday, November 18, 2026 Downloads, Thursday, November 19, 2026 Downloads, Friday, November 20, 2026 Downloads, Saturday, November 21, 2026 Downloads, Sunday, November 22, 2026 Downloads, Monday, November 23, 2026 Downloads, Tuesday, November 24, 2026 Downloads, Wednesday, November 25, 2026 Downloads, Thursday, November 26, 2026 Downloads, Friday, November 27, 2026 Downloads, Saturday, November 28, 2026 Downloads, Sunday, November 29, 2026 Downloads, Monday, November 30, 2026 Uploads, Sunday, November 1, 2026 Uploads, Monday, November 2, 2026 Uploads, Tuesday, November 3, 2026 Uploads, Wednesday, November 4, 2026 Uploads, Thursday, November 5, 2026 Uploads, Friday, November 6, 2026 Uploads, Saturday, November 7, 2026 Uploads, Sunday, November 8, 2026 Uploads, Monday, November 9, 2026 Uploads, Tuesday, November 10, 2026 Uploads, Wednesday, November 11, 2026 Uploads, Thursday, November 12, 2026 Uploads, Friday, November 13, 2026 Uploads, Saturday, November 14, 2026 Uploads, Sunday, November 15, 2026 Uploads, Monday, November 16, 2026 Uploads, Tuesday, November 17, 2026 Uploads, Wednesday, November 18, 2026 Uploads, Thursday, November 19, 2026 Uploads, Friday, November 20, 2026 Uploads, Saturday, November 21, 2026 Uploads, Sunday, November 22, 2026 Uploads, Monday, November 23, 2026 Uploads, Tuesday, November 24, 2026 Uploads, Wednesday, November 25, 2026 Uploads, Thursday, November 26, 2026 Uploads, Friday, November 27, 2026 Uploads, Saturday, November 28, 2026 Uploads, Sunday, November 29, 2026 Uploads, Monday, November 30, 2026
Downloads
Uploads

Downloads and uploads per day, November 2026.

2 series, 30 categories, values from 161,061,274 to 2,574,515,044

Data transfer per day
LabelDownloadsUploads
Nov 1858,993,459161,061,274
Nov 22,372,094,226577,413,531
Nov 32,491,870,761561,748,315
Nov 42,561,914,653541,198,339
Nov 52,574,515,044517,041,302
Nov 62,528,284,804490,779,170
Nov 7858,993,459161,061,274
Nov 8858,993,459161,061,274
Nov 92,115,872,693415,734,192
Nov 101,937,799,070397,161,680
Nov 111,770,988,399383,937,609
Nov 121,633,804,220376,884,186
Nov 131,541,348,603376,439,960
Nov 14858,993,459161,061,274
Nov 15858,993,459161,061,274
Nov 161,603,456,573412,999,371
Nov 171,729,691,648435,285,541
Nov 181,890,099,412460,549,794
Nov 192,067,021,199487,221,321
Nov 202,240,980,378513,641,816
Nov 21858,993,459161,061,274
Nov 22858,993,459161,061,274
Nov 232,567,589,317575,653,652
Nov 242,571,267,130586,281,320
Nov 252,516,471,863590,498,885
Nov 262,409,235,714588,044,119
Nov 272,261,363,893579,069,647
Nov 28858,993,459161,061,274
Nov 29858,993,459161,061,274
Nov 301,748,040,356520,403,505
Show Code
BarChart.razor
<DwsChartBar Name="BarChartDemo_BytesChart" Title="Data transfer per day" SeriesData="@_transfer" Stacked="true"
             ValueFormat="DwsChartValueFormatPreset.Bytes" ShowValueLabels="false"
             Caption="Downloads and uploads per day, November 2026." Height="300"></DwsChartBar>
BarChart.razor.cs
List<DateTime> days = [.. Enumerable.Range(0, 30).Select(day => new DateTime(2026, 11, 1).AddDays(day))];

// Values in bytes: ValueFormat Bytes writes "954 MB" or "2.35 GB" (steps of 1024).
private readonly DwsChartSeriesData _transfer = new DwsChartSeriesData { CategoryDates = days }
    .AddSeries("Downloads", downloadBytesPerDay)
    .AddSeries("Uploads", uploadBytesPerDay);

Long Labels, Percent Format, Empty Content

Horizontal bars with long category names (cut with an ellipsis, the full name in the tooltip) and ValueFormat Percent ("41.5%"). A value label that would leave the chart moves inside its bar. The second chart has no data and shows its EmptyContent.

Answers by model
Share of answers, claude-opus-reasoning-large-2026-11 Share of answers, gpt-large-preview-with-tools Share of answers, local-llama-instruct-70b-q4 Share of answers, mistral-medium-latest Share of answers, small-router

1 series, 5 categories, values from 5 to 41.5

Answers by model
LabelShare of answers
claude-opus-reasoning-large-2026-1141.5
gpt-large-preview-with-tools27.25
local-llama-instruct-70b-q416.8
mistral-medium-latest9.45
small-router5
No answers in this period. Pick a longer period above.

No values

Chart
LabelValue
Show Code
BarChart.razor
<DwsChartBar Name="BarChartDemo_LongLabelsChart" Title="Answers by model" SeriesData="@_models"
             Orientation="DwsLayoutOrientation.Horizontal" ValueFormat="DwsChartValueFormatPreset.Percent"
             WithLegend="false" Height="300"></DwsChartBar>

<DwsChartBar Name="BarChartDemo_EmptyChart" ChartData="@_empty" WithLegend="false" Height="300">
    <EmptyContent>
        <span>No answers in this period. Pick a longer period above.</span>
    </EmptyContent>
</DwsChartBar>
BarChart.razor.cs
private readonly DwsChartSeriesData _models = new DwsChartSeriesData(["claude-opus-reasoning-large-2026-11", "gpt-large-preview-with-tools", "local-llama-instruct-70b-q4", "mistral-medium-latest", "small-router"])
    .AddSeries("Share of answers", [41.5, 27.25, 16.8, 9.45, 5]); // percent values: ValueFormat Percent

private readonly DwsChartBarData _empty = new();

Fill a Wide Card (Fill, LegendPosition)

A dashboard card is wide and short. With Fill the vertical bars take the card's width and Height instead of a square drawing in its middle; a bar stays at most 56 px wide, and the month labels thin out by the measured width. LegendPosition Auto puts a legend of up to eight entries in one row below the plot instead of the table beside it. A phone-sized chart keeps its usual layout.

Findings per month
Blocked, June 2026 Blocked, July 2026 Blocked, August 2026 Blocked, September 2026 Blocked, October 2026 Blocked, November 2026 Flagged, June 2026 Flagged, July 2026 Flagged, August 2026 Flagged, September 2026 Flagged, October 2026 Flagged, November 2026
Blocked
Flagged

2 series, 6 categories, values from 38 to 171

Findings per month
LabelBlockedFlagged
Jun 202642118
Jul57131
Aug3896
Sep71152
Oct64140
Nov89171
Show Code
BarChart.razor
<DwsChartBar Name="BarChartDemo_FillChart" Title="Findings per month" SeriesData="@_findings"
             Fill="true" LegendPosition="DwsChartLegendPosition.Auto" Height="260"></DwsChartBar>
BarChart.razor.cs
private static readonly List<DateTime> months = [.. Enumerable.Range(0, 6).Select(m => new DateTime(2026, 6, 1).AddMonths(m))];

private readonly DwsChartSeriesData _findings = new DwsChartSeriesData { CategoryDates = months }
    .AddSeries("Blocked", [42, 57, 38, 71, 64, 89])
    .AddSeries("Flagged", [118, 131, 96, 152, 140, 171]);

Interface-Description

Name Typ Parameters Description
ExportSvgAsync Task<string?> All six charts (also DwsChartDoughnut and DwsChartPolarArea). A picture of the chart as it is on screen, as SVG markup: the drawing with the theme's colours and the fonts written into it, the title, the legend and the HTML texts drawn in where they stand, on a rectangle in the colour of the surface the chart lies on. Its size is the chart's size on screen in CSS pixels. Null when there is no picture (not interactive, no data, hidden). Not exported: a tooltip that happens to be open is left out; a label cut off with an ellipsis on screen is written in full; CSS transforms on marks (a hover effect) are not carried over.
DownloadSvgAsync Task string? fileName All six charts. Downloads the picture of ExportSvgAsync() as an .svg file. Null names the file after the chart's title, else its Name.
DownloadPngAsync Task string? fileName, double scale All six charts. Downloads the picture as a .png file, scale times the chart's size on screen (2 is sharp on a high-density screen and in print; at most 8). Null names the file after the chart's title, else its Name. Text is drawn in the fonts installed on the device: a web font of the page is not available to the picture.
Name Typ Default Description
Width int? null Chart width in pixels. If null, component width is determined by layout/container.
Height int? null Chart height in pixels. If null, component height is determined by layout/container.
WithLegend bool true When true, chart legend is rendered.
ShowDataTable bool false Shows the chart data as a table under the drawing. The same table, a one-line summary and an accessible name for the drawing are always rendered for screen readers (Pie, Bar, Line, Area, Radar, RadialBar).
ChartData DwsChartPieData? / DwsChartBarData? / DwsChartLineData? / DwsChartAreaData? / DwsChartRadarData? / DwsChartRadialBarData? null Strongly typed data source for each chart component (pie/bar/line/area/radar/radialbar).
Orientation DwsLayoutOrientation DwsLayoutOrientation.Vertical Available on DwsChartBar only. Controls vertical or horizontal bar rendering.
Title string? null DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar/DwsChartRadialBar only. Optional title rendered above the chart.
ShowGrid bool false (pie) / true (bar/line/area/radar) DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar only. Renders a grid: lines behind bar/line/area charts, rings behind a radar and over a pie's slices.
GridLineCount int 3 (pie) / 4 (bar/line/area/radar) DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar only. Number of grid rings/lines rendered when ShowGrid is true.
ShowTooltip bool true DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar/DwsChartRadialBar only. Shows a floating tooltip while hovering a slice/bar/point/ring.
ShowValueLabels bool true DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar/DwsChartRadialBar only. Shows each bar's/point's/ring's raw value or percentage as a label. A radial bar chart with a single ring shows its percentage large in the middle.
ColorSelector Func<TDataElement, int, string>? null DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar/DwsChartRadialBar only. Per-element color override for slices/bars/points/rings/legend; falls back to the element's Color when not set.
LegendMetadataFormatter Func<TDataElement, string?>? null DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar/DwsChartRadialBar only. Formats an element's Metadata for display in the legend/tooltip; defaults to joining "key: value" pairs.
SeriesData DwsChartSeriesData? null All six charts. Categories with one or more named series (DwsChartSeries: Name, Color / CustomColor, Values by position or ValuesByCategory). When it holds a series it is drawn instead of ChartData: one line (DwsChartLine), area (DwsChartArea), group or stack of bars (DwsChartBar) or polygon (DwsChartRadar) per series on shared axes; a ring per series, outermost first (DwsChartPie); a group of rings per category (DwsChartRadialBar). A null / NaN value is no value. The flat ChartData list keeps working and renders as before.
AllowSeriesToggle bool true With SeriesData: the legend entries are toggle buttons that show or hide their series (click, Enter, Space); the axis follows the visible series.
ConstantSizeLabels bool? null (on) All six charts. Draws value, percentage, axis and category labels as HTML over the drawing, at one readable size at any chart width, instead of SVG text that scales with the drawing. Null: on with SeriesData, off for a flat ChartData list (whose SVG labels keep the classes dws-chart-value-label / dws-chart-percentage-label).
Stacked bool false DwsChartArea/DwsChartBar with SeriesData. Stacks the series on each other instead of drawing the areas over each other / the bars side by side.
StackedPercent bool false DwsChartArea/DwsChartBar with SeriesData. Stacks the series as shares of each category's total (0 to 100 %). Implies Stacked.
ShowAxes bool? null DwsChartLine/DwsChartArea/DwsChartBar. Shows the value axis (round tick labels) and the category axis (labels that turn or thin out when crowded); the grid lines then sit on the ticks. Null: on with SeriesData, off for a flat ChartData list. Switching it on for a flat list does not move its drawing.
ValueAxisTitle / CategoryAxisTitle string? null DwsChartLine/DwsChartArea/DwsChartBar. Titles beside the axes, shown while the axes are shown.
AxisTickCount int 5 DwsChartLine/DwsChartArea/DwsChartBar. About how many values the value axis labels (2 to 20); it picks round steps near it.
AxisMin / AxisMax double? null DwsChartLine/DwsChartArea/DwsChartBar with SeriesData. Fixed ends of the value axis. Null: zero and the data's extremes, widened to a round tick.
CategoryLabelStep int? null DwsChartLine/DwsChartArea/DwsChartBar. Labels every n-th category. Null labels all while they fit and thins them out beyond 24.
Fill bool false DwsChartLine/DwsChartArea/DwsChartBar (vertical). The drawing takes the chart's measured width and Height instead of a square in the middle of a wide card. Bars stretch (at most 56 px wide each, so a single category is no slab); lines and areas get a viewBox of the plot's own ratio, so points stay round and strokes keep their width. Tooltips and HTML labels stay on the marks; category labels thin out by the measured width. A phone-sized chart keeps its usual layout; dense bars that scroll sideways do not fill. Horizontal bars always fill.
LegendPosition DwsChartLegendPosition DwsChartLegendPosition.Right DwsChartLine/DwsChartArea/DwsChartBar. Right / Left: the bordered table beside the drawing. Bottom / Top: a compact row of entries below / above it, without a border. Auto: the row below for up to 8 entries, the table beside for more. A phone-sized chart always puts the legend below as a grid.
AxisValueFormatter Func<double, string>? null DwsChartBar/DwsChartLine/DwsChartArea. Writes the tick labels of the value axis in the application's own format ("1.234,5 €", fixed decimals) instead of compact numbers ("1.2K"). Receives the tick's value; the "%" of a 100 % stacked chart is then not appended. Pass a method or a delegate kept in a field - a lambda written in the markup is new with every render and makes the chart work its drawing out again.
ValueFormat DwsChartValueFormatPreset Compact DwsChartBar/DwsChartLine/DwsChartArea. How values are written on the axis, the value labels (short form) and in the tooltip (full form), in the chart's culture: Compact ("1.2K" / "1,2 Tsd."), Number ("1,234.5"), Bytes (binary steps: "1.5 MB"), Duration (the value in seconds: "450 ms", "3 min 20 s") or Percent (45 = "45%" / "45 %"). AxisValueFormatter still wins for the ticks. The formatter is public for every chart: DwsChartValueFormat.Format(value, preset, culture, full).
Caption string? null DwsChartBar/DwsChartLine/DwsChartArea. A sentence under the chart (p.dws-chart-caption: what it shows, the source, the period); the drawing's aria-describedby names it, so screen readers read it with the chart.
IsLoading bool false DwsChartBar/DwsChartLine/DwsChartArea. The data is still loading: the chart shows its loading state (spinner and "Loading chart...") instead of the drawing or the empty content.
EmptyContent RenderFragment? null DwsChartBar/DwsChartLine/DwsChartArea. Shown instead of the drawing when there is nothing to draw (no data, or fewer than two points of a line or area). Null shows the chart's icon and "No data available".
SeriesData.CategoryDates List<DateTime>? null DwsChartBar/DwsChartLine/DwsChartArea (a property of DwsChartSeriesData). A date axis: one date per category. While Categories is empty the labels are written from the dates in the chart's culture, in the unit they are apart - "14:00" for hours (with the day where it changes), "Mar 9" / "9. März" for days and weeks, "Mar" for months (with the year at the first and at January), "2027" for years - and thinned to the measured width; the tooltip and the accessible names carry the full date.
(touch) DwsChartBar/DwsChartLine/DwsChartArea. A tap anywhere in the plot shows the nearest category's tooltip (every series there) and keeps it; a tap outside the chart, Escape or a second tap on the category closes it. Points and bars take a finger about 24 px wide. On a phone the legend goes under the drawing, value labels that would collide are left out (the highest and lowest of each series stay) and category labels are thinned to the measured width instead of turned. Dense vertical bars that would get thinner than 4 px make the plot scroll sideways inside the chart while the value axis stays. AllowZoom on a touch screen: a range brush with two handles under the plot sets the part shown; a finger on the drawing scrolls the page.
BarCornerRadius double 0 DwsChartBar only. Rounds the corners of the bars, in units of the drawing's viewBox (about pixels at the chart's natural size). The browser limits it to half of a bar's shorter side, so thin bars become pills. Zero or less: square corners and no attribute in the markup.
Name Typ Description
OnItemSelected EventCallback<string> Triggered when a chart segment/bar/point is selected. Returns the selected item key/label.
OnBarClick EventCallback<DwsChartBarItemEventArgs> DwsChartBar only. Triggered when a bar is clicked.
OnBarPointerEnter EventCallback<DwsChartBarItemEventArgs> DwsChartBar only. Triggered when the pointer enters a bar.
OnBarPointerLeave EventCallback<DwsChartBarItemEventArgs> DwsChartBar only. Triggered when the pointer leaves a bar.
OnLegendItemClick EventCallback<DwsChartBarItemEventArgs> / EventCallback<DwsChartPieItemEventArgs> / EventCallback<DwsChartLineItemEventArgs> / EventCallback<DwsChartAreaItemEventArgs> / EventCallback<DwsChartRadarItemEventArgs> / EventCallback<DwsChartRadialBarItemEventArgs> DwsChartPie/DwsChartBar/DwsChartLine/DwsChartArea/DwsChartRadar/DwsChartRadialBar only. Triggered when a legend row is clicked.
OnSeriesToggle EventCallback<DwsChartSeriesToggleEventArgs> With SeriesData: raised after the legend showed or hid a series (SeriesIndex, Series, Visible). The click, pointer and legend events of every chart carry SeriesIndex and SeriesName (0 and null for a flat list).
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.
An error has occurred. This app may no longer respond until reloaded.