Spline Chart in C#
Render smooth spline curves in C# with AddSpline — true Bézier interpolation, self-contained SVG, zero dependencies. Part of TerraFluent.Chart.Reporting.
Spline Chart
Smooth spline curves — temperature trends for three cities.
True Spline (Bézier)
Catmull-Rom cubic Bézier curves.
When to use a spline chart
Reach for it when
- Data that genuinely varies continuously between samples — temperature, pressure, a physical signal.
- Presentation charts where the eye should follow one overall shape rather than each segment.
- Smoothed or modelled output, where the curve is already an interpolation and drawing it as one is honest.
Use something else when
- Discrete measurements. A spline invents values between your points and can overshoot past the real maximum, which reads as data you never recorded.
- Any chart where the exact value at a point matters — the curve does not pass through the sample as visibly as a straight segment does.
- Sparse series. With four points a spline is mostly invention; use AddLine.
Spline Chart in C#
Lifted verbatim from the chart types reference, so it compiles against the shipped API. See the API reference for every overload and the exact data types each series method accepts.
string svg = ChartBuilder.Create()
.Title("Temperature Trends — Smooth Spline")
.Size(700, 400)
.XAxis("Week", "W1","W2","W3","W4","W5","W6","W7","W8")
.YAxis("Temperature (°C)")
.AsAnimated()
.Series(s => s
.AddSpline("London", new double[] { 18, 20, 22, 25, 27, 24, 21, 19 },
cfg => cfg.Color(ChartColor.ChartBlue))
.AddSpline("Madrid", new double[] { 28, 31, 34, 38, 40, 37, 33, 30 },
cfg => cfg.Color(ChartColor.ChartOrange)))
.RenderToSvg();Install
dotnet add package TerraFluent.Chart.Reporting
- MIT licensed — free for commercial use, no chart limits, no watermarks.
- Zero dependencies — nothing but the .NET base class library.
- netstandard2.0 through net10.0 — .NET Framework 4.6.1+, .NET Core 2.0+, and every modern release.
- Output is one SVG string — embed it in HTML, a PDF, or a Word document.