Charts
Every chart type has its own page with live examples, their code and the API reference. The charts scale with their container, follow the active theme, and can be used with the keyboard and a screen reader.
A Dashboard Row
Three charts side by side, as on an admin dashboard. Each chart measures its own width, not the screen's: in a third of a desktop page it is already narrower than 576px, so the pie puts its legend below (LegendPosition Auto, the default) and the date axes thin their labels. On a phone the three stack. A tap on a day or a slice pins its tooltip until a tap outside or Escape.
New and returning users, November 2026.
2 series, 30 categories, values from 8 to 194
| Label | New users | Returning users |
|---|---|---|
| Nov 1 | 40 | 155 |
| Nov 2 | 46 | 156 |
| Nov 3 | 51 | 155 |
| Nov 4 | 55 | 153 |
| Nov 5 | 57 | 150 |
| Nov 6 | 43 | 146 |
| Nov 7 | 41 | 142 |
| Nov 8 | 53 | 136 |
| Nov 9 | 48 | 131 |
| Nov 10 | 43 | 126 |
| Nov 11 | 37 | 120 |
| Nov 12 | 31 | 116 |
| Nov 13 | 11 | 112 |
| Nov 14 | 8 | 110 |
| Nov 15 | 22 | 108 |
| Nov 16 | 23 | 108 |
| Nov 17 | 25 | 109 |
| Nov 18 | 30 | 112 |
| Nov 19 | 35 | 116 |
| Nov 20 | 26 | 121 |
| Nov 21 | 32 | 127 |
| Nov 22 | 52 | 134 |
| Nov 23 | 56 | 142 |
| Nov 24 | 58 | 151 |
| Nov 25 | 58 | 159 |
| Nov 26 | 56 | 167 |
| Nov 27 | 37 | 175 |
| Nov 28 | 32 | 183 |
| Nov 29 | 42 | 189 |
| Nov 30 | 36 | 194 |
Free (63.9%) | |
Pro (25.9%) | |
Team (10.1%) |
3 values, from 97 to 612
| Label | Value |
|---|---|
| Free | 612 |
| Pro | 248 |
| Team | 97 |
Show Code
Charts.razor
<div class="row g-3">
<div class="col-12 col-md-4">
<DwsChartLine Name="ChartsDemo_DashboardUsers" Title="Users per day" SeriesData="@_users" ShowValueLabels="false" WithLegend="false"
Caption="New and returning users, November 2026." Height="220" />
</div>
<div class="col-12 col-md-4">
<DwsChartBar Name="ChartsDemo_DashboardTransfer" Title="Data transfer" SeriesData="@_transfer" Stacked="true"
ValueFormat="DwsChartValueFormatPreset.Bytes" ShowValueLabels="false" WithLegend="false" Height="220" />
</div>
<div class="col-12 col-md-4">
@* LegendPosition Auto (the default): beside the pie in a chart of 576px and more, below it here *@
<DwsChartPie Name="ChartsDemo_DashboardPlans" Title="Plans" ChartData="@_plans" Height="180" />
</div>
</div>Charts.razor.cs
List<DateTime> days = [.. Enumerable.Range(0, 30).Select(day => new DateTime(2026, 11, 1).AddDays(day))];
private readonly DwsChartSeriesData _users = new DwsChartSeriesData { CategoryDates = days }
.AddSeries("New users", newUsersPerDay)
.AddSeries("Returning users", returningUsersPerDay);
private readonly DwsChartSeriesData _transfer = new DwsChartSeriesData { CategoryDates = days }
.AddSeries("Downloads", downloadBytesPerDay) // bytes: ValueFormat Bytes writes "2.35 GB"
.AddSeries("Uploads", uploadBytesPerDay);
private readonly DwsChartPieData _plans = new()
{
DataElements =
[
new DwsChartPieDataElement("Free", 612, "var(--primary)"),
new DwsChartPieDataElement("Pro", 248, "var(--accent)"),
new DwsChartPieDataElement("Team", 97, "var(--success)"),
],
};Values by category
Parts of a whole
- Pie Chart Slices with percentages, concentric rings, labels beside the pie
- Doughnut Chart A ring with the total in its hole, drill-down
- Polar Area Chart Equal slices whose radius shows the value
- Radial Bar Chart Progress rings measured against a goal
- Funnel Chart How a quantity shrinks from stage to stage
- Treemap Chart Nested rectangles, each as large as its value
