Error Bar Chart in C#
Add error bars in C# with AddErrorBar and RangePoint — confidence intervals and variance whiskers over columns, rendered as self-contained SVG.
Column + Error Bars
AddErrorBar() — I-beam uncertainty whiskers.
When to use a error bar chart
Reach for it when
- Measurements with known uncertainty — confidence intervals, standard deviation, measurement tolerance.
- Overlaid on columns, so the reader sees both the estimate and how much to trust it.
- Experimental results where overlapping intervals are the honest answer to "is this difference real?".
Use something else when
- Charts where you have not defined what the bar represents. State whether it is SD, SE, or a CI.
- Decorative use on data with no uncertainty model behind it.
- Dense series, where the whiskers overlap into a hedge — use an area range band instead.
Error Bar 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.
using TerraFluent.Chart.Reporting.Models;
string svg = ChartBuilder.Create()
.Title("Measured Mean ± Std. Dev.")
.Size(700, 400)
.XAxis("Sample", "A","B","C","D","E")
.YAxis("Value", min: 0)
.AsAnimated()
.Series(s => s
.AddLine("Mean", new double[] { 30, 42, 38, 55, 48 },
cfg => cfg.Color(ChartColor.ChartBlue))
.AddErrorBar("± SD", new[]
{
new RangePoint(26, 34), new RangePoint(37, 47), new RangePoint(33, 43),
new RangePoint(49, 61), new RangePoint(43, 53),
}, cfg => cfg.Color(ChartColor.Charcoal)))
.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.