DashboardCharts
A chart of series by category (KlyDashboardChart: bars, lines, areas or a donut) and a list of horizontal bars (KlyDashboardBars) with a funnel variant. The chart is drawn by KlyChart of Klyroo.UI as SVG, without a charting library.
On this page
Examples
Chart with a comparison series
A series with IsComparison is drawn muted (dashed as a line) and is left out of the totals and of a donut. Totals Sum or Average adds a totals row. OnSelect receives a DashboardChartSelection (the category, the key of the series and the value) when the user picks a bar or a point: a click, or Enter or Space on the one the arrow keys are on.
Revenue by month
Click a bar
Jan
2026 31.2K
2025 28.9K
Feb
2026 34.8K
2025 30.1K
Mar
2026 33.1K
2025 31.8K
Apr
2026 39.4K
2025 33K
May
2026 42K
2025 36.2K
Jun
2026 48.5K
2025 40.1K
- 2026
- 2025
| Category | 2026 | 2025 |
|---|---|---|
| Jan | 31.2K | 28.9K |
| Feb | 34.8K | 30.1K |
| Mar | 33.1K | 31.8K |
| Apr | 39.4K | 33K |
| May | 42K | 36.2K |
| Jun | 48.5K | 40.1K |
Nothing selected yet.
<div class="flex w-full flex-col gap-3">
<KlyDashboardGrid>
<KlyDashboardChart Title="Revenue by month" Subtitle="Click a bar" Span="12" Categories="_months" Series="_series"
Format="DashboardFormatPreset.Compact" Totals="DashboardChartTotals.Sum" OnSelect="Pick" />
</KlyDashboardGrid>
<p class="m-0 text-sm text-(--klyroo-text-muted)">@(_picked ?? "Nothing selected yet.")</p>
</div>
@code {
private static readonly IReadOnlyList<string> _months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];
// The comparison series is drawn muted and is left out of the totals.
private static readonly IReadOnlyList<DashboardChartSeries> _series =
[
new("rev26", "2026", [31_200, 34_800, 33_100, 39_400, 42_000, 48_500]),
new("rev25", "2025", [28_900, 30_100, 31_800, 33_000, 36_200, 40_100], IsComparison: true),
];
private string? _picked;
private void Pick(DashboardChartSelection point) =>
_picked = $"{point.Category}, series {point.Series}: {point.Value:N0}";
}Chart types
Type is Bar (the default), Line, Area or Donut. Stacked stacks the series of a bar or area chart, Horizontal draws the bars of a bar chart along the horizontal axis, and ShowLegend and Height change the legend and the drawing. A donut draws the first series that is not a comparison, one slice per category, with the total in the middle.
Line
Jan
Web 12K
Mobile 8.1K
Feb
Web 13.4K
Mobile 9K
Mar
Web 14.1K
Mobile 9.8K
Apr
Web 15.8K
Mobile 11.2K
May
Web 16.9K
Mobile 12.7K
Jun
Web 18.3K
Mobile 14.5K
- Web
- Mobile
| Category | Web | Mobile |
|---|---|---|
| Jan | 12K | 8.1K |
| Feb | 13.4K | 9K |
| Mar | 14.1K | 9.8K |
| Apr | 15.8K | 11.2K |
| May | 16.9K | 12.7K |
| Jun | 18.3K | 14.5K |
Stacked area
Jan
Web 12K
Mobile 8.1K
Feb
Web 13.4K
Mobile 9K
Mar
Web 14.1K
Mobile 9.8K
Apr
Web 15.8K
Mobile 11.2K
May
Web 16.9K
Mobile 12.7K
Jun
Web 18.3K
Mobile 14.5K
- Web
- Mobile
| Category | Web | Mobile |
|---|---|---|
| Jan | 12K | 8.1K |
| Feb | 13.4K | 9K |
| Mar | 14.1K | 9.8K |
| Apr | 15.8K | 11.2K |
| May | 16.9K | 12.7K |
| Jun | 18.3K | 14.5K |
Donut
The first series, one slice per category
Search
Visits 21K (38%)
Direct
Visits 14.3K (26%)
Social
Visits 12.9K (24%)
Visits 6.4K (12%)
- Search21K
- Direct14.3K
- Social12.9K
- Email6.4K
| Category | Visits |
|---|---|
| Search | 21K |
| Direct | 14.3K |
| Social | 12.9K |
| 6.4K |
Horizontal bars
Search
Visits 21K
Direct
Visits 14.3K
Social
Visits 12.9K
Visits 6.4K
| Category | Visits |
|---|---|
| Search | 21K |
| Direct | 14.3K |
| Social | 12.9K |
| 6.4K |
<KlyDashboardGrid>
<KlyDashboardChart Title="Line" Span="6" Height="180" Type="DashboardChartType.Line" Categories="_months" Series="_traffic"
Format="DashboardFormatPreset.Compact" />
<KlyDashboardChart Title="Stacked area" Span="6" Height="180" Type="DashboardChartType.Area" Stacked="true" Categories="_months" Series="_traffic"
Format="DashboardFormatPreset.Compact" />
<KlyDashboardChart Title="Donut" Subtitle="The first series, one slice per category" Span="6" Height="180" Type="DashboardChartType.Donut"
Categories="_channels" Series="_shares" Format="DashboardFormatPreset.Compact" />
<KlyDashboardChart Title="Horizontal bars" Span="6" Height="180" Horizontal="true" ShowLegend="false"
Categories="_channels" Series="_shares" Format="DashboardFormatPreset.Compact" />
</KlyDashboardGrid>
@code {
private static readonly IReadOnlyList<string> _months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];
private static readonly IReadOnlyList<string> _channels = ["Search", "Direct", "Social", "Email"];
private static readonly IReadOnlyList<DashboardChartSeries> _traffic =
[
new("web", "Web", [12_000, 13_400, 14_100, 15_800, 16_900, 18_300]),
new("mobile", "Mobile", [8_100, 9_000, 9_800, 11_200, 12_700, 14_500]),
];
private static readonly IReadOnlyList<DashboardChartSeries> _shares =
[
new("visits", "Visits", [21_000, 14_300, 12_900, 6_400]),
];
}Bars, top N and funnel
A bar can carry a Tag, a Meta text that replaces its formatted value and Selected. With OnSelect every bar is a button (aria-pressed follows Selected), but the block does not keep the selection: the page rebuilds the items. Limit keeps the first bars, Emphasis First colors only the first, and the scale always includes zero. The funnel variant scales every bar to the first one and shows its share of the previous step.
Revenue by region
Pick a bar
Top 3
Emphasis on the first bar, Limit 3
Signup funnel
Selected region: none
<div class="flex w-full flex-col gap-3">
<KlyDashboardGrid>
<KlyDashboardBars Title="Revenue by region" Subtitle="Pick a bar" Span="6" Items="Regions()" Format="DashboardFormatPreset.Compact" OnSelect="Pick" />
<KlyDashboardBars Title="Top 3" Subtitle="Emphasis on the first bar, Limit 3" Span="6" Items="_regions" Limit="3"
Emphasis="DashboardBarsEmphasis.First" Format="DashboardFormatPreset.Compact" />
<KlyDashboardBars Title="Signup funnel" Span="12" Items="_funnel" Variant="DashboardBarsVariant.Funnel" Format="DashboardFormatPreset.Integer" />
</KlyDashboardGrid>
<p class="m-0 text-sm text-(--klyroo-text-muted)">Selected region: @(_selected ?? "none")</p>
</div>
@code {
private static readonly IReadOnlyList<DashboardBarItem> _regions =
[
new("EMEA", 42_300, Tag: "eu"), new("Americas", 36_400, Tag: "us"), new("APAC", 19_600, Meta: "19.6K, growing"), new("LATAM", 7_800),
];
private static readonly IReadOnlyList<DashboardBarItem> _funnel =
[
new("Visitors", 10_000), new("Signups", 2_400), new("Trials", 900), new("Paid", 310),
];
private string? _selected;
// Selected only marks the row: the page owns the selection and rebuilds the items.
private IReadOnlyList<DashboardBarItem> Regions() => [.. _regions.Select(r => r with { Selected = r.Label == _selected })];
private void Pick(DashboardBarItem bar) => _selected = bar.Label;
}API
KlyDashboardChart
A chart over categories without a charting dependency: grouped bars, lines, bars with line series over them, or a donut of the first series, with a legend and optional totals.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
Card |
bool |
true |
Whether the block draws its own surface (border, background and shadow; only the background in a panels grid). Defaults to true . |
Categories |
IReadOnlyList |
The labels of the horizontal axis, one per category, or the slices of a donut. | |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Format |
Dashboard |
Dashboard |
How the values of labels, tooltips, totals and the table view are formatted. Values: Number, Integer, Decimal, Compact, Percent, Ratio, Delta, Points, Signed. |
Freshness |
bool? |
Shows an Updated footer built from Source.UpdatedAt . When null , the value of the enclosing KlyDashboardGrid.Freshness applies, or false outside a grid. | |
Height |
int |
220 |
The height of the drawing in pixels at its natural width of 640. The drawing keeps its proportions and shrinks with the card, so it is shorter in a narrow one. Defaults to 220. |
Horizontal |
bool |
false |
Draws the bars of a bar chart along the horizontal axis, with the categories on the vertical one. |
Menu |
bool? |
Shows the View as table, Download CSV and Expand buttons in the header once the content is displayed. Download CSV saves the block's table as a CSV file named after the title. When null , the value of the enclosing KlyDashboardGrid.Menu applies, or false outside a grid. | |
Series |
IReadOnlyList |
The data series, all drawn (a donut draws the first one that is not a comparison) and all in the table view. Each series takes the next chart color of Klyroo.UI ( --klyroo-chart-1 to --klyroo-chart-6 , then neutral); comparison series are muted. | |
ShowLabels |
bool |
false |
Shows the formatted value above each bar (below a negative one). Lines, areas and donuts show their values in tooltips. It switches the chart to the compact drawing described at Type . |
ShowLegend |
bool |
true |
Shows the legend: the series, or the slices with their value for a donut. Defaults to true . |
Source |
IDashboardSource |
The resource whose state drives the block: a skeleton while it loads, an error message with a retry button, then the content. The block does not read Data from it, so pass the data through the other parameters. Without a source the content renders immediately. | |
Span |
int |
8 |
Width of the block in columns of the grid, clamped between 1 and the Columns of the enclosing KlyDashboardGrid (12 outside a grid). Defaults to 8. |
Stacked |
bool |
false |
Stacks the series of a bar or area chart instead of drawing them side by side or over one another. Comparison series are stacked too, so leave them out of a stacked chart. |
Subtitle |
string |
A secondary line under the title. | |
Title |
string |
The heading of the block. | |
Totals |
Dashboard |
Dashboard |
The totals row: Average shows the average of each series, Sum the sum. Comparison series are left out. None , the default, shows nothing. Values: None, Sum, Average. |
Type |
Dashboard |
Dashboard |
The chart type: Bar (the default) draws one bar per series in each category, side by side; Line draws every series as a line; Area draws every series as a line with the area under it filled; Donut draws the first series that is not a comparison as a ring of slices, one per category, with the total in the middle. The drawing is KlyChart of Klyroo.UI: value and category axes, gridlines, a tooltip that follows the pointer and the arrow keys, a bar or a line that starts at zero (a zero value has no bar, a negative value goes below the axis), and a data table for screen readers. In a bar chart, a series whose Type is Line is drawn as a line over the bars, but KlyChart cannot mix the two, so such a chart (and a chart with ShowLabels ) uses a compact drawing of its own: bars and lines from a zero baseline, without axes or gridlines, and Stacked and Horizontal do not apply. The type also picks the loading skeleton. Values: Bar, Line, Area, Donut. |
Events
| Name | Type | Description |
|---|---|---|
OnSelect |
EventCallback |
Called with the category, the series key and the value when the user picks a data point. In the drawing of KlyChart (every chart except the compact one described at Type ) the bars, points and slices themselves are the choice: a click on one, or Enter or Space on the one the arrow keys are on, with a pointer cursor and the same keyboard hint as KlyChart.OnSelect . A pick is reported for the series it landed on, a comparison series included (its own key and value); from the keyboard, or for a series with no value in that category, it is the first series that is not a comparison and has a value, and a category with nothing to pick is ignored. The compact drawing, which KlyChart cannot draw (a bar chart with a line series, or with ShowLabels ), has no selectable marks, so it shows a group of buttons under the drawing instead, one per category and series (one per slice for a donut, comparison series left out), which works with the keyboard and with a screen reader too. Use it to drill down, for example by setting a filter of the DashboardController . |
KlyDashboardBars
Horizontal bars for a ranking, or a funnel with the conversion rate between steps.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
Card |
bool |
true |
Whether the block draws its own surface (border, background and shadow; only the background in a panels grid). Defaults to true . |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Emphasis |
Dashboard |
Dashboard |
All (the default) colors every bar. First colors the first bar and mutes the others. Values: All, First. |
Format |
Dashboard |
Dashboard |
How the values are formatted, unless an item supplies its own Meta text. Values: Number, Integer, Decimal, Compact, Percent, Ratio, Delta, Points, Signed. |
Freshness |
bool? |
Shows an Updated footer built from Source.UpdatedAt . When null , the value of the enclosing KlyDashboardGrid.Freshness applies, or false outside a grid. | |
Items |
IReadOnlyList |
The bars, in display order. | |
Limit |
int? |
The maximum number of bars shown. The table view and the CSV export hold the same bars. | |
Max |
Double? |
The value that fills a whole bar. Defaults to the largest item. Ignored by the funnel variant. The scale always includes zero: a zero value has no bar and a negative value extends to the left of a zero line. | |
Menu |
bool? |
Shows the View as table, Download CSV and Expand buttons in the header once the content is displayed. Download CSV saves the block's table as a CSV file named after the title. When null , the value of the enclosing KlyDashboardGrid.Menu applies, or false outside a grid. | |
Source |
IDashboardSource |
The resource whose state drives the block: a skeleton while it loads, an error message with a retry button, then the content. The block does not read Data from it, so pass the data through the other parameters. Without a source the content renders immediately. | |
Span |
int |
6 |
Width of the block in columns of the grid, clamped between 1 and the Columns of the enclosing KlyDashboardGrid (12 outside a grid). Defaults to 6. |
Subtitle |
string |
A secondary line under the title. | |
Title |
string |
The heading of the block. | |
Variant |
Dashboard |
Dashboard |
Bars (the default), or Funnel : every bar is scaled to the first one and shows its share of the previous step. Values: Bars, Funnel. |
Events
| Name | Type | Description |
|---|---|---|
OnSelect |
EventCallback |
Called with the bar when the user picks it. Each bar is then a button, so the choice works with the keyboard and with a screen reader, and aria-pressed follows Selected . Use it to drill down, for example by setting a filter of the DashboardController . |