ShellCharts.Blazor 0.1.0-alpha

This is a prerelease version of ShellCharts.Blazor.
dotnet add package ShellCharts.Blazor --version 0.1.0-alpha
                    
NuGet\Install-Package ShellCharts.Blazor -Version 0.1.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ShellCharts.Blazor" Version="0.1.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ShellCharts.Blazor" Version="0.1.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="ShellCharts.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ShellCharts.Blazor --version 0.1.0-alpha
                    
#r "nuget: ShellCharts.Blazor, 0.1.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ShellCharts.Blazor@0.1.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ShellCharts.Blazor&version=0.1.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ShellCharts.Blazor&version=0.1.0-alpha&prerelease
                    
Install as a Cake Tool

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-5 CSS 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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