DeepWorks Studios Blazor Component Library

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

DwsChartPie

Shows the parts of one whole as slices of a circle, with percentage labels, a legend that can hide slices, and concentric rings for several series. For a ring with the total in its hole see the doughnut chart.

API Reference

Pie Chart

Basic pie chart without legend.

First Second Third Fourth Fifth

5 values, from 10 to 200

Chart
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart01' ChartData='@_chartData' Height='200' WithLegend='false'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _chartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "#E07A5F"),
        new DwsChartPieDataElement("Second", 200, "#3D5A80"),
        new DwsChartPieDataElement("Third", 34, "rgb(129 178 154)"),
        new DwsChartPieDataElement("Fourth", 50, "hsl(42 87% 62%)"),
        new DwsChartPieDataElement("Fifth", 100, "#9B5DE5"),
    ]
};

Pie Chart with Legend

Pie chart with legend enabled.

First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Chart
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02' ChartData='@_themeChartData' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _themeChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "var(--primary)"),
        new DwsChartPieDataElement("Second", 200, "var(--accent)"),
        new DwsChartPieDataElement("Third", 34, "var(--success)"),
        new DwsChartPieDataElement("Fourth", 50, "var(--warning)"),
        new DwsChartPieDataElement("Fifth", 100, "var(--error)"),
    ]
};

Pie Chart (Title)

Title renders a heading above the chart.

Distribution
First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Distribution
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02b' ChartData='@_oceanChartData' Title='Distribution' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _oceanChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "#0B3C5D"),
        new DwsChartPieDataElement("Second", 200, "#1D7CBF"),
        new DwsChartPieDataElement("Third", 34, "#3FB8AF"),
        new DwsChartPieDataElement("Fourth", 50, "#7FD1B9"),
        new DwsChartPieDataElement("Fifth", 100, "#C5E99B"),
    ]
};

Pie Chart (Grid Rings)

ShowGrid draws concentric grid rings over the slices; GridLineCount sets how many.

First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Chart
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_PieGrid_Chart' ChartData='@_earthChartData' ShowGrid='true' GridLineCount='4' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _earthChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "#264653"),
        new DwsChartPieDataElement("Second", 200, "#2A9D8F"),
        new DwsChartPieDataElement("Third", 34, "#E9C46A"),
        new DwsChartPieDataElement("Fourth", 50, "#F4A261"),
        new DwsChartPieDataElement("Fifth", 100, "#E76F51"),
    ]
};

Pie Chart (Tooltip)

ShowTooltip shows a floating tooltip with the slice's name and value while the pointer is over it. The percentage labels are switched off here, so the tooltip is the only place the values appear.

First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Chart
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_PieTooltip_Chart' ChartData='@_darkChartData' ShowTooltip='true' ShowPercentageLabels='false' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _darkChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "#1B9E77"),
        new DwsChartPieDataElement("Second", 200, "#D95F02"),
        new DwsChartPieDataElement("Third", 34, "#7570B3"),
        new DwsChartPieDataElement("Fourth", 50, "#E7298A"),
        new DwsChartPieDataElement("Fifth", 100, "#66A61E"),
    ]
};

Pie Chart (Percentage Labels)

ShowPercentageLabels writes each slice's share of the total into the slice.

First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Chart
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_PiePercentage_Chart' ChartData='@_tableauChartData' ShowPercentageLabels='true' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _tableauChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "#4E79A7"),
        new DwsChartPieDataElement("Second", 200, "#F28E2B"),
        new DwsChartPieDataElement("Third", 34, "#E15759"),
        new DwsChartPieDataElement("Fourth", 50, "#76B7B2"),
        new DwsChartPieDataElement("Fifth", 100, "#59A14F"),
    ]
};

Pie Chart (Legend Metadata)

An element's Metadata dictionary is listed in the legend and the tooltip as key/value pairs.

Category A Category B Category C
Category A (30%)
Units sold: 300, Region: North
Category B (50%)
Units sold: 500, Region: South
Category C (20%)
Units sold: 200, Region: East

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_PieMetadata_Chart' ChartData='@_pieChartDataWithMetadata' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _pieChartDataWithMetadata = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("Category A", 30, "#6C5CE7") { Metadata = new() { ["Units sold"] = "300", ["Region"] = "North" } },
        new DwsChartPieDataElement("Category B", 50, "#00B894") { Metadata = new() { ["Units sold"] = "500", ["Region"] = "South" } },
        new DwsChartPieDataElement("Category C", 20, "#FD79A8") { Metadata = new() { ["Units sold"] = "200", ["Region"] = "East" } }
    ]
};

Pie Chart (Color Selector)

A ColorSelector delegate picks each slice's colour from its index, overriding the element's own Color.

First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Chart
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_PieColorSelector_Chart' ChartData='@_chartData' ColorSelector='@_pieColorSelector' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _chartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "#E07A5F"),
        new DwsChartPieDataElement("Second", 200, "#3D5A80"),
        new DwsChartPieDataElement("Third", 34, "rgb(129 178 154)"),
        new DwsChartPieDataElement("Fourth", 50, "hsl(42 87% 62%)"),
        new DwsChartPieDataElement("Fifth", 100, "#9B5DE5"),
    ]
};

// Three colours, not two: with alternating colours a pie's first and last slices - neighbours - would look the same.
private readonly Func<DwsChartPieDataElement, int, string> _pieColorSelector =
    (_, index) => (index % 3) switch { 0 => "var(--primary)", 1 => "var(--accent)", _ => "var(--secondary)" };

Pie Chart (No Data)

Placeholder shown when ChartData has no elements.

No data available

No values

Chart
LabelValue
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02d' ChartData='@_emptyPieChartData' Height='200' WithLegend='false'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _emptyPieChartData = new();

Pie Chart (Custom Legend Metadata Formatter)

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

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

3 values, from 20 to 50

Chart
LabelValue
Category A30
Category B50
Category C20
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02e' ChartData='@_pieChartDataWithMetadata' LegendMetadataFormatter='@_pieLegendMetadataFormatter' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _pieChartDataWithMetadata = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("Category A", 30, "#6C5CE7") { Metadata = new() { ["Units sold"] = "300", ["Region"] = "North" } },
        new DwsChartPieDataElement("Category B", 50, "#00B894") { Metadata = new() { ["Units sold"] = "500", ["Region"] = "South" } },
        new DwsChartPieDataElement("Category C", 20, "#FD79A8") { Metadata = new() { ["Units sold"] = "200", ["Region"] = "East" } }
    ]
};

private readonly Func<DwsChartPieDataElement, string?> _pieLegendMetadataFormatter = element =>
    element.Metadata is { Count: > 0 }
        ? $"({element.Metadata.Count} details) " + string.Join(" | ", element.Metadata.Select(kv => $"{kv.Key} = {kv.Value}"))
        : null;

Pie Chart (Many Categories)

Eight slices with percentage labels; thin slices below the minimum share automatically suppress their label.

Product A Product B Product C Product D Product E Product F Product G Product H
Product A (23.1%)
Product B (17.9%)
Product C (15.4%)
Product D (14.1%)
Product E (11.5%)
Product F (10.3%)
Product G (5.1%)
Product H (2.6%)

8 values, from 2 to 18

Chart
LabelValue
Product A18
Product B14
Product C12
Product D11
Product E9
Product F8
Product G4
Product H2
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02f' ChartData='@_manyCategoryPieChartData' ShowPercentageLabels='true' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _manyCategoryPieChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("Product A", 18, "#FF6384"),
        new DwsChartPieDataElement("Product B", 14, "#36A2EB"),
        new DwsChartPieDataElement("Product C", 12, "#FFCE56"),
        new DwsChartPieDataElement("Product D", 11, "#4BC0C0"),
        new DwsChartPieDataElement("Product E", 9, "#9966FF"),
        new DwsChartPieDataElement("Product F", 8, "#FF9F40"),
        new DwsChartPieDataElement("Product G", 4, "#C9CBCF"),
        new DwsChartPieDataElement("Product H", 2, "#8AC926")
    ]
};

Pie Chart (Outside Labels)

ShowOutsideLabels gives a slice that is too thin for a label inside it its percentage beside the pie, joined by a leader line; labels of neighbouring thin slices are spread apart so none covers another. The pie is drawn smaller to make room, which is why the parameter is off by default. In plots narrower than 200 px the outside labels are hidden.

Chrome Safari Firefox Edge Opera Other
Chrome (64%)
Safari (30.8%)
Firefox (2.4%)
Edge (1.6%)
Opera (0.9%)
Other (0.3%)

6 values, from 3 to 640

Chart
LabelValue
Chrome640
Safari308
Firefox24
Edge16
Opera9
Other3
Show Code
PieChart.razor
<DwsSwitch Name='ChartDemo_Chart02i_Switch' @bind-Value='_pieOutsideLabels' Label='ShowOutsideLabels' Class='mb-3' />
<DwsChartPie Name='ChartDemo_Chart02i' ChartData='@_thinSlicePieChartData' ShowOutsideLabels='@_pieOutsideLabels' Height='260' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private bool _pieOutsideLabels = true;

private readonly DwsChartPieData _thinSlicePieChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("Chrome", 640, "#1976D2"),
        new DwsChartPieDataElement("Safari", 308, "#2E7D32"),
        new DwsChartPieDataElement("Firefox", 24, "#EF6C00"),
        new DwsChartPieDataElement("Edge", 16, "#6A1B9A"),
        new DwsChartPieDataElement("Opera", 9, "#C62828"),
        new DwsChartPieDataElement("Other", 3, "#455A64"),
    ]
};

Pie Chart (Two-Way Split)

A binary Yes/No survey result rendered as a simple two-slice pie without the background grid.

Yes No
Yes (68%)
No (32%)

2 values, from 32 to 68

Chart
LabelValue
Yes68
No32
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02g' ChartData='@_twoWayPieChartData' ShowGrid='false' Height='200' WithLegend='true'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _twoWayPieChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("Yes", 68, "var(--success)"),
        new DwsChartPieDataElement("No", 32, "var(--error)")
    ]
};

Pie Chart (Minimal, Custom Palette)

No grid, no percentage labels and no legend - just the data colors, for embedding as a compact visual.

Awareness Consideration Conversion

3 values, from 25 to 40

Chart
LabelValue
Awareness40
Consideration35
Conversion25
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_Chart02h' ChartData='@_brandPaletteChartData' ShowGrid='false' ShowPercentageLabels='false' Height='200' WithLegend='false'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartPieData _brandPaletteChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("Awareness", 40, "#5B8FF9"),
        new DwsChartPieDataElement("Consideration", 35, "#61DDAA"),
        new DwsChartPieDataElement("Conversion", 25, "#F6BD16")
    ]
};

Series: Pie Chart (Concentric Rings)

Each series is a ring, the first one outermost; a category has the same color in every ring, so the rings compare two compositions. The legend lists the rings (toggle buttons) and then the color key.

Visits by device, 2025 (outer ring) and 2026 (inner ring)
2025, Desktop 2025, Mobile 2025, Tablet 2025, Other 2026, Desktop 2026, Mobile 2026, Tablet 2026, Other
2025
2026
Desktop
Mobile
Tablet
Other

2 series, 4 categories, values from 3 to 51

Visits by device, 2025 (outer ring) and 2026 (inner ring)
Label20252026
Desktop4838
Mobile4051
Tablet98
Other33
Show Code
PieChart.razor
<DwsChartPie Name='ChartDemo_SeriesPie' Title='Visits by device, 2025 (outer ring) and 2026 (inner ring)' SeriesData='@_shareSeriesData' Height='300'></DwsChartPie>
PieChart.razor.cs
private readonly DwsChartSeriesData _shareSeriesData = new DwsChartSeriesData(["Desktop", "Mobile", "Tablet", "Other"])
    .AddSeries("2025", [48, 40, 9, 3])
    .AddSeries("2026", [38, 51, 8, 3]);

Pie Chart: Labels Beside the Pie

LabelPosition Outside writes the percentages beside the pie with leader lines - every slice of a flat pie, the outermost ring of series data - spread apart so none covers another.

Distribution
First Second Third Fourth Fifth
First (2.5%)
Second (50.8%)
Third (8.6%)
Fourth (12.7%)
Fifth (25.4%)

5 values, from 10 to 200

Distribution
LabelValue
First10
Second200
Third34
Fourth50
Fifth100
Visits by device, 2025 (outer ring) and 2026 (inner ring)
2025, Desktop 2025, Mobile 2025, Tablet 2025, Other 2026, Desktop 2026, Mobile 2026, Tablet 2026, Other
2025
2026
Desktop
Mobile
Tablet
Other

2 series, 4 categories, values from 3 to 51

Visits by device, 2025 (outer ring) and 2026 (inner ring)
Label20252026
Desktop4838
Mobile4051
Tablet98
Other33
Show Code
PieChart.razor
<DwsSwitch Name='ChartDemo_PieToggle_Outside' @bind-Value='_pieLabelsOutside' Label='LabelPosition Outside' Class='mb-3' />
<div class='row g-3'>
    <div class='col-12 col-xl-6'>
        <DwsChartPie Name='ChartDemo_PieLabelsFlat' Title='Distribution' ChartData='@_formatsChartData' LabelPosition='@PieLabelPosition' Height='260'></DwsChartPie>
    </div>
    <div class='col-12 col-xl-6'>
        <DwsChartPie Name='ChartDemo_PieLabelsRings' Title='Visits by device, 2025 (outer ring) and 2026 (inner ring)' SeriesData='@_shareSeriesData' LabelPosition='@PieLabelPosition' Height='300'></DwsChartPie>
    </div>
</div>
PieChart.razor.cs
private readonly DwsChartPieData _formatsChartData = new()
{
    DataElements =
    [
        new DwsChartPieDataElement("First", 10, "rgb(239 71 111)"),
        new DwsChartPieDataElement("Second", 200, "hsl(46 100% 60%)"),
        new DwsChartPieDataElement("Third", 34, "#06D6A0"),
        new DwsChartPieDataElement("Fourth", 50, "#118AB2"),
        new DwsChartPieDataElement("Fifth", 100, "#073B4C"),
    ]
};

private readonly DwsChartSeriesData _shareSeriesData = new DwsChartSeriesData(["Desktop", "Mobile", "Tablet", "Other"])
    .AddSeries("2025", [48, 40, 9, 3])
    .AddSeries("2026", [38, 51, 8, 3]);

private bool _pieLabelsOutside = true;

private DwsChartPieLabelPosition PieLabelPosition => _pieLabelsOutside ? DwsChartPieLabelPosition.Outside : DwsChartPieLabelPosition.Inside;

Phone width: caption, loading and empty state

The same chart in a 320px column, as on a phone: the chart measures its own width, keeps every text at least 12px, moves a side legend below the drawing as a compact grid and leaves out labels that have no room (they stay in the tooltip and the legend). A tap on a mark pins its tooltip; a tap elsewhere or Escape dismisses it. Caption writes a sentence under the chart, IsLoading shows the loading state and EmptyContent replaces the empty state.

Product A Product B Product C Product D Product E Product F Product G Product H
Product A (23.1%)
Product B (17.9%)
Product C (15.4%)
Product D (14.1%)
Product E (11.5%)
Product F (10.3%)
Product G (5.1%)
Product H (2.6%)

Source: demo data. The legend moves below the drawing in a chart narrower than 576px.

8 values, from 2 to 18

Chart
LabelValue
Product A18
Product B14
Product C12
Product D11
Product E9
Product F8
Product G4
Product H2

Nothing recorded yet - data appears here after the first import.

No values

Chart
LabelValue
Show Code
PieChart.razor
<DwsChartPie Name='PieChartDemo_PhoneChart' ChartData='@_manyCategoryPieChartData' LegendPosition='DwsChartLegendPosition.Auto' Caption="Source: demo data. The legend moves below the drawing in a chart narrower than 576px." IsLoading='@_phoneLoading' Height='200'></DwsChartPie>

<DwsChartPie Name='PieChartDemo_PhoneEmpty' ChartData='@_phoneEmptyPieData' Height='200'>
                        <EmptyContent>
                            <DwsTypography Name='PieChartDemo_PhoneEmptyText' Typography='DwsTypographyType.Paragraph'>@T('demo_piechart_phone_empty', 'Nothing recorded yet - data appears here after the first import.')</DwsTypography>
                        </EmptyContent>
                    </DwsChartPie>
PieChart.razor.cs
private bool _phoneLoading;
private readonly DwsChartPieData _phoneEmptyPieData = new();

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.
IsSliceVisible bool int index DwsChartPie only. Whether the slice at this position (of the flat list, or the category of SeriesData) is shown, i.e. not hidden through its legend entry.
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).
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.
ShowPercentageLabels bool true DwsChartPie only. Shows each slice's share of the total as a percentage label (suppressed for very thin slices).
ShowOutsideLabels bool false DwsChartPie only. With ShowPercentageLabels: a slice below 3% (too thin for a label inside it) gets its percentage beside the pie with a leader line; neighbouring labels are spread apart, and one that no longer fits beside the pie is left out. The pie is drawn smaller to make room (about two thirds of the width); a pie without a thin slice is not changed. Hidden in plots narrower than 200 px.
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).
AllowSliceToggle bool false DwsChartPie only. Makes the legend entries of the slices (a flat list) or of the categories (SeriesData) toggle buttons with aria-pressed: a click, Enter or Space hides the slice - in every ring - and the percentages of the others are worked out again; the next one shows it again. The last slice that is shown cannot be hidden. OnLegendItemClick is still raised. The ring entries of SeriesData go on toggling their series (AllowSeriesToggle).
LabelPosition DwsChartPieLabelPosition DwsChartPieLabelPosition.Inside DwsChartPie only. Inside: the percentages stand in the slices. Outside: all of them stand beside the pie with leader lines - for a flat list every slice, for SeriesData the slices of the outermost ring (the rings inside it keep their labels inside). Labels on one side are spread apart so none covers another; one that no longer fits, or whose slice is narrower than OutsideLabelMinAngle, is left out and keeps its legend entry, tooltip and accessible name. The pie is drawn smaller to make room. Needs ShowPercentageLabels. ShowOutsideLabels (thin slices only) now applies to the outermost ring of SeriesData too.
OutsideLabelMinAngle double 4 DwsChartPie with LabelPosition Outside. The smallest angle of a slice, in degrees, that still gets a label.
LegendPosition DwsChartLegendPosition DwsChartLegendPosition.Auto DwsChartPie only. Right / Left: beside the pie, and below it on screens narrower than 576px (unless LegendPositionFixed). Top / Bottom: above or below the pie, the entries as a wrapping row. When the legend is stacked, Height is the height of the pie alone, so a long legend does not shrink it.
LegendPositionFixed bool false DwsChartPie only. Keeps a Left or Right legend beside the pie on phones too.
EmptyContent RenderFragment? null DwsChartPie/DwsChartRadar/DwsChartRadialBar. Shown instead of the default "no data" state when there is nothing to draw (not while loading).
IsLoading bool false DwsChartPie/DwsChartRadar/DwsChartRadialBar. Shows the loading state (spinner and message) instead of the drawing, e.g. while the page fetches the data.
Caption string? null DwsChartPie/DwsChartRadar/DwsChartRadialBar. A sentence under the chart (<p class="dws-chart-caption">) - the takeaway or the source; the drawing's aria-describedby points at it.
Name Typ Description
OnItemSelected EventCallback<string> Triggered when a chart segment/bar/point is selected. Returns the selected item key/label.
OnSliceClick EventCallback<DwsChartPieItemEventArgs> DwsChartPie only. Triggered when a slice is clicked.
OnSlicePointerEnter EventCallback<DwsChartPieItemEventArgs> DwsChartPie only. Triggered when the pointer enters a slice.
OnSlicePointerLeave EventCallback<DwsChartPieItemEventArgs> DwsChartPie only. Triggered when the pointer leaves a slice.
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).
OnSliceToggle EventCallback<DwsChartPieSliceToggleEventArgs> DwsChartPie with AllowSliceToggle. Raised after a legend entry showed or hid a slice: Index (position in the flat list, or the category), Element, Visible.
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.