ShellCharts.Blazor
0.1.0-alpha
dotnet add package ShellCharts.Blazor --version 0.1.0-alpha
NuGet\Install-Package ShellCharts.Blazor -Version 0.1.0-alpha
<PackageReference Include="ShellCharts.Blazor" Version="0.1.0-alpha" />
<PackageVersion Include="ShellCharts.Blazor" Version="0.1.0-alpha" />
<PackageReference Include="ShellCharts.Blazor" />
paket add ShellCharts.Blazor --version 0.1.0-alpha
#r "nuget: ShellCharts.Blazor, 0.1.0-alpha"
#:package ShellCharts.Blazor@0.1.0-alpha
#addin nuget:?package=ShellCharts.Blazor&version=0.1.0-alpha&prerelease
#tool nuget:?package=ShellCharts.Blazor&version=0.1.0-alpha&prerelease
ShellCharts
Composable SVG charts for Blazor, in the style of shadcn/ui charts.
- Pure Blazor and SVG. No charting JS library; one small module handles hover and resize.
- Line, area and bar charts, vertical or horizontal, over category, number or time axes.
- Pie, donut, radial bar and radar charts.
- Composable parts, named as in shadcn and Recharts, so their examples carry over.
- Themed by the
--chart-1…--chart-5CSS variables, so a ShellUI or tweakcn theme recolours every chart. - Smooth: lines and areas sweep in, bars grow, pies sweep round, radars open out, data changes glide, and the tooltip follows the pointer with no server round-trip, even on Blazor Server.
- Keyboard and touch: focus a chart and use the arrow keys, or drag across it.
Status
0.1.0-alpha, a prerelease on NuGet. Targets net8.0, net9.0 and net10.0.
- Line, area and bar, each with stacking; monotone, linear and step curves
- Horizontal charts; category, number and time x axes with calendar ticks
- Pie, donut, radial bar and radar, with a centre label
- Axes with round tick values, grids, tooltip, interactive legend
- Value labels and 100% (expanded) stacks
- Replace the ApexCharts components in ShellUI
Quickstart
Install the package. It's a prerelease, so it needs --prerelease:
dotnet add package ShellCharts.Blazor --prerelease
Add the stylesheet to App.razor and @using ShellCharts to _Imports.razor:
<link rel="stylesheet" href="@Assets["_content/ShellCharts.Blazor/shellcharts.css"]" />
Then compose a chart. Charts need an interactive render mode.
<ChartContainer Data="visitors" Height="260">
<CartesianGrid />
<XAxis DataKey="m => m.Month" />
<YAxis />
<Line DataKey="m => m.Desktop" Name="Desktop" />
<Line DataKey="m => m.Mobile" Name="Mobile" />
<ChartTooltip />
<ChartLegend />
</ChartContainer>
Swap Line for Area or Bar, or mix them. Give series the same Stack to stack them, or set Orientation="ChartOrientation.Horizontal" on the container for horizontal bars.
The XAxis key decides the scale: strings and enums are categories, numbers are spaced by value, and DateTime or DateOnly keys get a time axis with calendar ticks. Sort number and time data by its key.
Pie, donut and radial charts give each item its own slice or ring, colour and legend entry:
<ChartContainer Data="browsers" Height="260">
<Donut DataKey="b => b.Visitors" NameKey="b => b.Name" />
<CenterLabel Value="925" Label="Visitors" />
<ChartTooltip />
<ChartLegend />
</ChartContainer>
Radar charts take a spoke per item and a shape per series:
<ChartContainer Data="visitors" Height="260">
<PolarGrid />
<PolarAngleAxis DataKey="m => m.Month" />
<Radar DataKey="m => m.Desktop" Name="Desktop" />
<ChartTooltip />
</ChartContainer>
Polar and cartesian series can't share a chart.
Parts
| Part | Parameters |
|---|---|
ChartContainer |
Data, Height (px; 16:9 without it), Orientation, StackOffset (expand: stacks fill 100%), AriaLabel, Class |
CartesianGrid |
Horizontal, Vertical, StrokeDasharray |
XAxis |
DataKey, TickFormatter, Type (overrides the scale the key implies), Width, TickCount, Hide |
YAxis |
TickFormatter, Width (fits the labels by default), TickCount, Hide |
Line |
DataKey, Name, Color, Stack, Curve, StrokeWidth, StrokeDasharray, Dots, Label, LabelFormatter |
Area |
DataKey, Name, Color, Stack, Curve, StrokeWidth, FillOpacity, Gradient, Label, LabelFormatter |
Bar |
DataKey, Name, Color, Stack, Radius, Label (not on stacked bars), LabelFormatter |
Pie, Donut |
DataKey, NameKey, ColorKey, InnerRadius, OuterRadius, PaddingAngle, StartAngle, EndAngle, Label |
RadialBar |
DataKey, NameKey, ColorKey, InnerRadius, OuterRadius, Thickness, StartAngle, EndAngle, Max, Background |
Radar |
DataKey, Name, Color, FillOpacity, StrokeWidth, Dots |
PolarGrid |
GridType (polygon, circle), RadialLines |
PolarAngleAxis |
DataKey, Hide |
CenterLabel |
Value, Label |
ChartTooltip |
Indicator (dot, line, dashed), HideLabel, HideIndicator, Cursor, LabelFormatter, ValueFormatter |
ChartLegend |
Interactive |
ChartFormat.Compact (1.2k, 3.4M), ChartFormat.Number and ChartFormat.Percent (0.25 → 25%) are there for your own formatters.
Theming
Series colours default to --chart-1 … --chart-5 in order; pass Color for anything else. Pie and radial items take the palette in turn, or ColorKey. Text, grid, cursor and tooltip use --muted-foreground, --border, --muted, --background and --foreground. Every variable has a shadcn default, so charts look right without a theme.
Motion is tuned with --sc-enter (900ms), --sc-tween (500ms) and --sc-ease on .sc-chart, and switched off under prefers-reduced-motion.
How it works
Parts register with the ChartContainer, which measures its plot with a ResizeObserver and lays everything out in .NET: nice ticks and calendar ticks as in d3, band, point and linear scales, stacking, monotone cubic curves and arcs. Each item's tooltip, cursor and highlight are rendered up front along with where it can be hovered (a stretch of x or y, an angle, or a ring), so on hover the browser only picks one and moves the tooltip. Data changes animate through CSS transitions on the SVG geometry (Chromium and Firefox; Safari jumps to the new shape).
Development
dotnet test
dotnet run --project samples/ShellCharts.Demo
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Components.Web (>= 10.0.0)
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.13)
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha | 55 | 11/6/2026 |