Candlestick Chart in C#
Render financial candlestick charts in C# with AddCandlestick and OhlcPoint — open, high, low, close with up/down colouring. Self-contained SVG, MIT.
Candlestick
AddCandlestick() — OHLC bodies with wicks.
When to use a candlestick chart
Reach for it when
- Price series where each period's open, high, low, and close all matter.
- Financial reporting and trading dashboards, where the candle body convention is already understood.
- Twenty to a hundred and twenty periods — enough to see pattern, few enough that candles stay distinct.
Use something else when
- Any data that is not genuinely OHLC. The body and wick have fixed meanings.
- Long ranges — years of daily candles compress into an unreadable comb; aggregate to weekly first.
- Audiences outside finance, for whom the convention needs explaining; a line of closing prices is clearer.
Candlestick 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("ACME — Daily OHLC")
.Size(720, 420)
.XAxis("Day", "Mon","Tue","Wed","Thu","Fri")
.YAxis("Price ($)")
.AsAnimated()
.Series(s => s
.AddCandlestick("ACME", new[]
{
// OhlcPoint(open, high, low, close)
new OhlcPoint(120, 128, 118, 126),
new OhlcPoint(126, 130, 122, 123),
new OhlcPoint(123, 133, 121, 132),
new OhlcPoint(132, 135, 128, 129),
new OhlcPoint(129, 140, 127, 138),
}))
.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.