TerraFluent.Chart.Reporting · v2.0.0

Server-side SVG charts, zero JavaScript required

A fluent, dependency-free C# library for 26 chart types — line, bar, pie, financial, flow, and statistical — rendered as self-contained SVG with 18 built-in themes and three render modes for PDF, browser, and live dashboards.

NuGet version NuGet downloads MIT license
dotnet add package TerraFluent.Chart.Reporting
Quick start

A complete chart in one fluent chain

Every method returns the builder, so titles, axes, series, and render mode chain freely — then render straight to an SVG string, a file, or an HTML fragment.

  • Titles, subtitles, and axis labels in the same chain as your data
  • Self-contained SVG output — nothing else to deploy or reference
  • RenderToFile, RenderToHtmlFile, and async variants
using TerraFluent.Chart.Reporting.Builder;

string svg = ChartBuilder.Create()
    .Title("Monthly Website Visitors")
    .Subtitle("Jan – Jun 2025")
    .Size(700, 400)
    .XAxis("Month", "Jan", "Feb", "Mar", "Apr", "May", "Jun")
    .YAxis("Visitors", min: 0)
    .AsAnimated()
    .Series(s => s
        .AddLine("Visitors", new double[]
            { 12400, 14800, 16200, 18500, 21000, 19800 }))
    .RenderToSvg();
Chart types

26 chart types, one fluent API

Line, spline, area, column, bar, and pie for everyday reporting; waterfall, gauge, candlestick, and OHLC for financial dashboards; Sankey, treemap, funnel, and Gantt for flow and hierarchy — every type is a single Add… call inside the same series builder.

  • Standard: Line, Spline, Area, Column, Bar, Pie/Donut, Scatter, Bubble
  • Financial: Waterfall, Candlestick, OHLC, ColumnRange, AreaRange, ErrorBar
  • Flow & hierarchy: Sankey, Treemap, Funnel, Gantt, Stream, Parliament
  • Statistical: BoxPlot, Radar, Heatmap, Dumbbell, DataRing
// Part-of-whole, with a donut hole and centered label:
string svg = ChartBuilder.Create()
    .Title("Browser Share")
    .AsPie()
    .Series(s => s
        .Add("Shares", new double[] { 61, 25, 9, 5 }, cfg => cfg
            .DonutHolePercent(50)
            .DonutCenter("Browsers")))
    .RenderToSvg();
Render modes

Pick the right output for every surface

Static is pure SVG for PDF and email. Animated (the default) adds SMIL animation and CSS hover with no JavaScript — safe for Blazor. Interactive adds embedded JavaScript for tooltips, a legend toggle, and an export menu, browser-only.

  • Static: no CSS hover, no JS — safest for PDF and email clients
  • Animated: SMIL animation + CSS hover, no JS — the default
  • Interactive: hover, legend toggle, export menu — needs a browser
// PDF / email — draws everything immediately, no animation:
chart.AsStatic().RenderToSvg();

// Blazor / browser embedding — SMIL + CSS hover, still no JS:
chart.AsAnimated().RenderToSvg();

// Browser-only dashboard — hover, legend toggle, export menu:
chart.AsInteractive().ShowExportMenu().RenderToSvg();
Themes

18 built-in themes, or build your own

Default, Dark, Pastel, Monochrome, Ocean, Sunset, Forest, Neon, Minimal, Warm, Arctic, Business, Material, TrafficLight, Accessible, Vivid, HighContrast, and Modern ship in the box — every one with ModernStyle on by default: rounded bars, gradient fills, and hollow-ring markers.

  • ChartTheme.Custom(...) for a fully custom palette and font
  • Ad-hoc palettes with .Colors(...) for a one-off chart
  • Fork() deep-copies a builder for light/dark variants
.Theme(ChartTheme.Dark)

.Theme(ChartTheme.Custom(
    backgroundColor: "#1e1e2e",
    plotBackgroundColor: "#2a2a3d",
    textColor: "#cdd6f4",
    fontFamily: "JetBrains Mono",
    colors: new[] { "#89b4fa", "#a6e3a1", "#fab387" }))

// Fork a base chart into a dark variant without mutating it:
var dark = baseChart.Fork().Theme(ChartTheme.Dark);
Data quality

Know before you ship: data-quality warnings

AnalyzeDataQuality() inspects a configured chart for issues — outliers, empty series, mismatched axis counts — before you render it, or opt into ThrowOnDataQualityErrors() to fail fast in a pipeline.

  • Inspect warnings after configuring, before rendering
  • Every fluent method validates arguments and throws early
  • null gaps in a series are a policy choice, not a crash
var report = ChartBuilder.Create()
    .Series(s => s.AddColumn("Sales", data))
    .AnalyzeDataQuality();

foreach (var w in report.Warnings)
    Console.WriteLine($"{w.Severity}: {w.Message}");

// Bridge a gap instead of leaving it:
.AddLine("Sales", data, cfg => cfg.NullGap(GapPolicy.Connect))
Testability

Dependency injection via IChartBuilder

Register ChartBuilder.Create() behind the IChartBuilder interface for decoupled, testable services — the same pattern used across the TerraFluent library family.

  • Each ChartBuilder.Create() is independent and stateful
  • Use a transient or scoped lifetime, never a singleton instance
  • ASP.NET Core minimal APIs and controllers return SVG as image/svg+xml
// Register
services.AddScoped<IChartBuilder>(_ => ChartBuilder.Create());

// Use
public class ReportService(IChartBuilder chart)
{
    public string Build() => chart
        .Title("Revenue")
        .Series(s => s.AddLine("2025", data))
        .RenderToSvg();
}
v2.0.0

What's inside

  • 26 chart types across standard, financial, flow/hierarchy, and statistical families, all through one fluent API.
  • 18 built-in themes plus a ChartTheme.Custom(...) factory for fully custom palettes.
  • Three render modes — Static, Animated, and Interactive — matched to PDF/email, Blazor, and browser dashboards.
  • Zero dependencies — pure Base Class Library, multi-targeted from netstandard2.0 to net10.0.

Full documentation on GitHub →

Documentation

Documented like a product

Seven guides from first chart to the full API reference, plus a visual showcase of every chart type.

FAQ

Frequently asked questions

Does TerraFluent.Chart.Reporting need a browser or JavaScript to render charts?

No. Static and Animated render modes are pure SVG, CSS, and SMIL — no JavaScript, no headless browser, no server-side rendering engine. Interactive mode adds embedded JavaScript only when you opt in, for browser-only hover, tooltips, and an export menu.

Which .NET versions does TerraFluent.Chart.Reporting support?

netstandard2.0, netstandard2.1, net6.0, net8.0, and net10.0 from one codebase — so it runs on .NET Framework 4.6.1+, .NET Core 2.0+, and every modern .NET release on Windows, Linux, and macOS. Async render methods require net6.0 or newer.

Can I embed these charts inside a PDF, HTML, or Word report?

Yes. Render a chart with AsStatic() to get a self-contained SVG, then draw it as vector graphics in TerraFluent.Pdf.Reporting, place it as an image in TerraFluent.Html.Reporting, or embed it in TerraFluent.Docx.Reporting — all four libraries are independent NuGet packages with no shared dependency.

Does it have any third-party dependencies?

No. TerraFluent.Chart.Reporting uses only the .NET base class library — nothing added to your dependency graph, no native binaries, no npm packages.

Can charts be interactive, with hover tooltips and a legend toggle?

Yes, in Interactive mode — AsInteractive() emits embedded JavaScript for hover tooltips, a legend that toggles series, and an optional export menu. Interactive output is browser-only; use AsStatic() for PDF or email instead.

Is TerraFluent.Chart.Reporting free for commercial use?

Yes. MIT licensed — free for personal, commercial, and open-source projects with no chart limits, watermarks, or paid tiers, matching the rest of the TerraFluent library family.

102 live chart examples, hosted right here

Every chart type, theme, and feature rendered as real SVG on one page — no build step, no sample project to clone first.

Charts that drop straight into your reports

Render a Static SVG once and reuse it across every output — vector graphics in TerraFluent.Pdf.Reporting, an image in TerraFluent.Html.Reporting, or an embedded chart in TerraFluent.Docx.Reporting.

Need PDF, HTML, or Word output too? See PDF Reporting, HTML Reporting, or DOCX Reporting.