Column Chart in C#
Generate column charts in C# with AddColumn — grouped, stacked, and 100% stacked, rendered as self-contained SVG with no JavaScript dependency.
Column Chart
Single-series column chart — product sales by category.
When to use a column chart
Reach for it when
- Comparing a value across a modest number of discrete categories — the default choice, and usually the right one.
- {"Time buckets that are genuinely discrete"=>"months, quarters, sprints."}
- Grouped or stacked composition where each category's parts sum to something meaningful.
Use something else when
- More than about fifteen categories, or long category names — switch to a horizontal bar chart, which has room for the labels.
- A truncated Y axis. Column length is the encoding, so a non-zero baseline misstates the comparison.
- Continuous data sampled densely; use a line chart.
Column 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.
// Single series
string svg = ChartBuilder.Create()
.Title("Product Sales by Category")
.Size(700, 420)
.XAxis("Category", "Electronics","Clothing","Books","Home","Sports","Toys")
.YAxis("Units Sold", min: 0)
.AsAnimated()
.Series(s => s
.AddColumn("Units Sold",
new double[] { 8400, 5200, 3100, 6700, 4300, 2800 }))
.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.