Box Plot in C#
Draw box-and-whisker plots in C# with AddBoxPlot and BoxPlotPoint — median, quartiles, and whiskers as self-contained SVG. Zero-dependency .NET charting.
Box-and-Whisker Plot
AddBoxPlot() — five-number summary per category.
When to use a box plot
Reach for it when
- Comparing the distribution — not just the average — of a measure across groups.
- Latency and response-time analysis, where the spread and the tail are the point.
- Showing skew and outliers that a mean would conceal.
Use something else when
- An audience unfamiliar with the five-number summary; annotate it or use a simpler chart.
- Small samples, where quartiles computed from a handful of values are noise.
- Multimodal data — a box plot shows the same box for one cluster or two, so check the shape first.
Box Plot 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("Response Time Distribution by Endpoint (ms)")
.Size(700, 420)
.XAxis("Endpoint", "/login","/search","/checkout","/report")
.YAxis("ms", min: 0)
.AsAnimated()
.Series(s => s
.AddBoxPlot("Latency", new[]
{
// BoxPlotPoint(low, q1, median, q3, high)
new BoxPlotPoint( 40, 70, 95, 130, 210),
new BoxPlotPoint( 55, 90, 120, 160, 260),
new BoxPlotPoint( 80, 140, 190, 250, 400),
new BoxPlotPoint(120, 220, 300, 410, 620),
}))
.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.