A fluent C# library for generating SVG charts server-side — zero JavaScript dependency, zero external NuGet dependencies.
- Zero dependencies — pure Base Class Library, nothing added to your dependency graph.
- Zero JavaScript required — Static and Animated modes are pure SVG, CSS, and SMIL.
- 26 chart types — line, bar, pie, financial, flow, and specialist types, all through one fluent API.
- Three render modes — Static (PDF/email-safe), Animated (SMIL), Interactive (JS, browser-only).
- 18 built-in themes plus a
ChartTheme.Custom(...)factory for fully custom palettes. - Multi-target —
netstandard2.0,netstandard2.1,net6.0,net8.0,net10.0from one codebase.
- Supported Targets
- Installation
- Quick Start
- Documentation
- AI Agent Skill
- Chart Types
- Render Modes
- Themes
- Pie / Donut Chart
- Axis Shortcuts
- Markers
- Tooltip Customisation
- Legend Position Shortcuts
- Fork — Chart Variants
- Dependency Injection
- Async Rendering
- Input Validation
- Building from Source
- License
| Framework | Version |
|---|---|
| .NET Standard | 2.0, 2.1 |
| .NET | 6.0, 8.0, 10.0 |
Via NuGet (once published):
dotnet add package TerraFluent.Chart.ReportingVia project reference (building from source):
<ItemGroup>
<ProjectReference Include="..\src\TerraFluent.Chart.Reporting\TerraFluent.Chart.Reporting.csproj" />
</ItemGroup>string svg = ChartBuilder.Create()
.Title("Monthly Revenue")
.Size(700, 400)
.XAxis("Month", "Jan", "Feb", "Mar", "Apr", "May", "Jun")
.YAxis("Revenue ($)", min: 0)
.Series(s => s.AddLine("2024", new double[] { 120, 145, 110, 190, 170, 210 }))
.RenderToSvg();The full guide lives in docs/:
| Guide | What it covers |
|---|---|
| Getting Started | Install, first chart, ASP.NET Core / Blazor integration |
| Chart Showcase | Live visual gallery of every chart type and feature |
| Chart Types | All 26 chart types with full code + SVG output |
| Themes & Styling | Built-in themes, modern styling, custom themes, colour catalogue |
| Advanced Features | Render modes, output methods, axes, stacking, Fork, DI |
| API Reference | Complete method reference for every builder, enum, and data type |
| Troubleshooting & FAQ | Common issues, exceptions, and integration answers |
skills/terrafluent-chart/ is an Agent Skill that teaches coding agents (Claude Code, GitHub Copilot, and other agents that support SKILL.md) to turn a prompt such as "make a donut chart of revenue by region for our PDF report" into working TerraFluent code, and then check the SVG it produces.
The skill includes:
SKILL.md: the workflow the agent follows: extract a chart spec from the prompt, choose the chart type, choose the render mode, write the code, and verify the result.references/: a guide for mapping prompts to chart types, an API cheatsheet checked against the source, recipes for console, ASP.NET Core, Blazor, HTML report, email, and DI, and a list of common mistakes.scripts/check-svg.cs: a validator with no dependencies (dotnet run --file …, .NET 10 SDK). It checks that the SVG is well-formed, that the chart is not empty, and that the output is safe for the render mode.
To install it, copy the folder into your agent's skills directory:
# Claude Code (this project only, or ~/.claude/skills/ for all projects)
cp -r skills/terrafluent-chart <your-repo>/.claude/skills/
# GitHub Copilot
cp -r skills/terrafluent-chart <your-repo>/.github/skills/For other agents, see their documentation for where skills go. Agents load the skill automatically when a request mentions charts or graphs in a .NET project.
26 chart types are supported. See the Chart Types guide for full examples.
| Type | Method | Type | Method |
|---|---|---|---|
| Line | AddLine |
Bubble | AddBubble |
| Spline | AddSpline |
Heatmap | AddHeatmap |
| Area | AddArea |
ColumnRange | AddColumnRange |
| Column | AddColumn |
AreaRange | AddAreaRange |
| Bar | AddBar |
Funnel | AddFunnel |
| Pie / Donut | AddPie |
Treemap | AddTreemap |
| Scatter | AddScatter |
Radar | AddRadar |
| Waterfall | AddWaterfall |
BoxPlot | AddBoxPlot |
| Gauge | AddGauge |
ErrorBar | AddErrorBar |
| DataRing | AddDataRing |
Candlestick | AddCandlestick |
| Dumbbell | AddDumbbell |
OHLC | AddOhlc |
| Stream | AddStream |
Gantt | AddGantt |
| Sankey | AddSankey |
Parliament | AddParliament |
| Mode | CSS Hover | JS | Safe for |
|---|---|---|---|
Static |
No | No | PDF, email |
Animated (default) |
Yes | No | Browser, Blazor |
Interactive |
Yes | Yes | Browser only |
18 built-in themes are included — Default, Dark, Pastel, Monochrome, Ocean, Sunset, Forest, Neon, Minimal, Warm, Arctic, Business, Material, TrafficLight, Accessible, Vivid, HighContrast, and Modern. See Themes & Styling for the full catalogue.
// Built-in themes
.Theme(ChartTheme.Dark)
.Theme(ChartTheme.Pastel)
.Theme(ChartTheme.Monochrome)
.Theme(ChartTheme.Default)
// Custom theme — all parameters optional
.Theme(ChartTheme.Custom(
backgroundColor: "#1e1e2e",
plotBackgroundColor: "#2a2a3d",
textColor: "#cdd6f4",
fontFamily: "JetBrains Mono",
colors: new[] { "#89b4fa", "#a6e3a1", "#fab387" }))
// Ad-hoc palette
.Colors("#e63946", "#457b9d", "#2a9d8f")Every theme ships with ModernStyle on — rounded bars, gradient fills, hollow-ring markers, and (in Interactive mode) hover bands. Clone a theme and set ModernStyle = false for the classic flat look; see Modern Styling.
string svg = ChartBuilder.Create()
.Title("Browser Share")
.AsPie()
.Labels("Chrome", "Safari", "Edge", "Firefox")
.Series(s => s
.Add("Shares", new double[] { 61, 25, 9, 5 }, cfg =>
{
cfg.DonutHole(0.5); // hole radius as a fraction (0–1)
cfg.DonutCenter.Show().Title("Browsers"); // caption above the auto total
}))
.RenderToSvg();.XAxisFormat("{value} kg") // label format string
.XAxisTickInterval(5) // tick interval in data units (> 0)
.YAxisTickInterval(10).Series(s => s.AddLine("Sales", data, cfg => cfg
.MarkerSize(6) // radius in px (default 4-5)
.MarkerEnabled(false) // hide dots entirely
)).Tooltip(t => t
.HeaderFormat("Week: {label}")
.PointFormat("Value: {value}")).Legend(l => l.TopLeft())
.Legend(l => l.TopCenter())
.Legend(l => l.TopRight())
.Legend(l => l.BottomLeft())
.Legend(l => l.BottomCenter())
.Legend(l => l.BottomRight())Create a deep copy of a builder to produce related charts without mutation:
var baseChart = ChartBuilder.Create()
.Title("Revenue")
.Size(700, 400)
.Series(s => s.AddLine("2024", data));
var darkVariant = baseChart.Fork()
.Theme(ChartTheme.Dark);
string lightSvg = baseChart.RenderToSvg();
string darkSvg = darkVariant.RenderToSvg();// Register
services.AddTransient<IChartBuilder>(_ => ChartBuilder.Create());
// Use
public class ReportService(IChartBuilder chart)
{
public string Build() => chart
.Title("Revenue")
.Series(s => s.AddLine("2024", data))
.RenderToSvg();
}// .NET 6+
await chart.RenderToFileAsync("report.svg");
await chart.RenderToStreamAsync(responseStream);| Scenario | Exception |
|---|---|
Size(0, 400) |
ArgumentOutOfRangeException |
YAxis("Y", min: 100, max: 50) |
ArgumentException |
Animate(0) |
ArgumentOutOfRangeException |
FillOpacity(1.5) |
ArgumentOutOfRangeException |
MarkerSize(0) |
ArgumentOutOfRangeException |
XAxisFormat(" ") |
ArgumentException |
ChartTheme.Custom(colors: []) |
ArgumentException |
RenderToFile with missing directory |
DirectoryNotFoundException |
git clone https://github.com/sahebansari/TerraFluent.Chart.Reporting.git
cd TerraFluent.Chart.Reporting
dotnet build TerraFluent.Chart.Reporting.sln
dotnet test tests/TerraFluent.Chart.Reporting.Tests/TerraFluent.Chart.Reporting.Tests.csprojThe library targets netstandard2.0, netstandard2.1, net6.0, net8.0, and net10.0 from a single project — building it requires the .NET 10 SDK (which includes the earlier runtimes needed to build the older targets).
Released under the MIT License — free for commercial and personal use, modification, and redistribution. See LICENSE for the full text.
Project website: terrafluent.dev/chart