Candlestick chart
Since 0.1.0-alpha.23Use candlesticks to show how a price moved in each period, such as a stock's day of trading. Up and down periods stand out at a glance. Over long histories the candles crowd together, so use an OHLC chart. For the closing price alone, use a line chart.
Candlesticks
ChartCandlestickSeries takes each item's Open, High, Low and Close. A period that closed up is hollow and one that closed down is filled, so the direction shows without color.
Static
Preview
| Date | NWND |
|---|---|
| 9/14/2026 | open $203.53, high $205.83, low $203.08, close $203.34 |
| 9/15/2026 | open $204.43, high $205.79, low $201.70, close $202.88 |
| 9/16/2026 | open $202.14, high $206.40, low $200.28, close $205.30 |
| 9/17/2026 | open $205.32, high $210.10, low $204.66, close $209.64 |
| 9/18/2026 | open $210.37, high $211.33, low $206.44, close $207.39 |
| 9/21/2026 | open $206.82, high $207.78, low $204.53, close $204.81 |
| 9/22/2026 | open $204.19, high $204.90, low $200.45, close $202.39 |
| 9/23/2026 | open $202.94, high $204.85, low $198.57, close $199.29 |
| 9/24/2026 | open $199.89, high $202.99, low $197.76, close $201.25 |
| 9/25/2026 | open $201.41, high $203.33, low $196.71, close $198.43 |
| 9/28/2026 | open $198.35, high $204.48, low $197.84, close $202.07 |
| 9/29/2026 | open $202.35, high $204.59, low $200.25, close $204.14 |
| 9/30/2026 | open $204.60, high $207.21, low $203.53, close $206.14 |
| 10/1/2026 | open $206.18, high $209.78, low $205.98, close $208.78 |
| 10/2/2026 | open $207.68, high $212.81, low $205.95, close $210.64 |
| 10/5/2026 | open $211.88, high $216.27, low $211.44, close $214.32 |
| 10/6/2026 | open $213.23, high $213.26, low $208.27, close $210.46 |
| 10/7/2026 | open $209.89, high $211.65, low $206.66, close $208.39 |
| 10/8/2026 | open $207.94, high $211.83, low $207.11, close $209.53 |
| 10/9/2026 | open $208.86, high $210.11, low $204.98, close $206.36 |
| 10/12/2026 | open $205.29, high $205.56, low $204.74, close $204.91 |
| 10/13/2026 | open $205.13, high $207.07, low $201.77, close $204.14 |
| 10/14/2026 | open $203.50, high $206.91, low $201.69, close $204.87 |
| 10/15/2026 | open $204.23, high $206.01, low $199.50, close $201.21 |
| 10/16/2026 | open $200.44, high $203.59, low $199.31, close $203.25 |
| 10/19/2026 | open $203.68, high $205.12, low $201.47, close $202.43 |
| 10/20/2026 | open $203.54, high $206.02, low $201.45, close $205.73 |
| 10/21/2026 | open $206.64, high $208.75, low $201.15, close $203.32 |
| 10/22/2026 | open $202.89, high $204.42, low $200.15, close $201.53 |
| 10/23/2026 | open $201.89, high $205.07, low $200.13, close $203.64 |
Code
@* Six weeks of a stock's trading days as candlesticks. *@
<Chart Items="_days" Argument="d => d.Date" Title="Northwind Traders (NWND), Sep to Oct 2026">
<ChartValueAxis Format="C2" />
<ChartCandlestickSeries Open="d => d.Open" High="d => d.High" Low="d => d.Low" Close="d => d.Close" Name="NWND" />
</Chart>
{
private record Day(DateOnly Date, decimal Open, decimal High, decimal Low, decimal Close);
private static readonly HashSet<DateOnly> Holidays = [new(2026, 9, 7)];
private readonly Day[] _days;
public Usage()
{
// Trading days: a random walk with a slow climb, each day opening near the last close.
var random = new Random(26);
var days = new List<Day>();
var close = 204m;
for (var date = new DateOnly(2026, 9, 14); date <= new DateOnly(2026, 10, 23); date = date.AddDays(1))
{
if (date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday || Holidays.Contains(date)) continue;
var open = Math.Round(close * (1 + (decimal)(random.NextDouble() - 0.5) * 0.012m), 2);
close = Math.Round(open * (1 + (decimal)(random.NextDouble() - 0.47) * 0.04m), 2);
var high = Math.Round(Math.Max(open, close) * (1 + (decimal)random.NextDouble() * 0.012m), 2);
var low = Math.Round(Math.Min(open, close) * (1 - (decimal)random.NextDouble() * 0.012m), 2);
days.Add(new Day(date, open, high, low, close));
}
_days = [.. days];
}
}Add this example to a page with the izzy CLI:
izzy add component ChartCandlestickSeries --at <file>:<line>Dates under candles sit side by side by item, so weekends and holidays leave no gaps.
IncreaseColor and DecreaseColor set the colors, such as green and red.
With a moving average and volume
A stock chart often adds a moving average over the candles and the volume traded beneath them. The 20-day average is a ChartLineSeries of a value worked out in the data, so it starts from the days before the chart's first. The volume is a bar chart of its own, joined to the prices with Sync for hover and zoom.
Static
Preview
- Price
- 20-day average
Code
@* A stock's last three months of trading days: candles with a 20-day moving average, and the day's volume in a chart under them, synced. *@
<Chart Items="_shown" Argument="d => d.Date" Title="Northwind Traders (NWND), daily" Sync="nwnd" DataTable="ChartDataTable.None">
<ChartValueAxis Title="Price" Format="C2" Position="ChartAxisPosition.Right" LabelWidth="Length.Rem(4)" />
<ChartArgumentAxis HideLabels Zoom />
<ChartCandlestickSeries Open="d => d.Open" High="d => d.High" Low="d => d.Low" Close="d => d.Close" Name="Price" />
<ChartLineSeries Value="d => d.Average" Name="20-day average" />
</Chart>
<Chart Items="_shown" Argument="d => d.Date" Title="Northwind Traders (NWND), volume" HideTitle Sync="nwnd" Height="Length.Rem(8)" DataTable="ChartDataTable.None">
<ChartValueAxis Title="Volume" Format="#,##0,,M" Position="ChartAxisPosition.Right" LabelWidth="Length.Rem(4)" />
<ChartBarSeries Value="d => d.Volume" Name="Volume" />
</Chart>
{
private record Day(DateOnly Date, decimal Open, decimal High, decimal Low, decimal Close, long Volume)
{
public decimal? Average { get; init; }
}
private static readonly HashSet<DateOnly> Holidays = [new(2026, 5, 25), new(2026, 6, 19), new(2026, 7, 3), new(2026, 9, 7)];
private readonly Day[] _shown;
public CandlestickVolume()
{
// Trading days from May to October 2026: a random walk with a slow climb, a wider swing
// on busier days, and more shares traded when the price moves most.
var random = new Random(26);
var days = new List<Day>();
var close = 182m;
for (var date = new DateOnly(2026, 5, 1); date <= new DateOnly(2026, 10, 30); date = date.AddDays(1))
{
if (date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday || Holidays.Contains(date)) continue;
var open = Math.Round(close * (1 + (decimal)(random.NextDouble() - 0.5) * 0.012m), 2);
var move = (decimal)(random.NextDouble() - 0.47) * 0.04m;
close = Math.Round(open * (1 + move), 2);
var high = Math.Round(Math.Max(open, close) * (1 + (decimal)random.NextDouble() * 0.012m), 2);
var low = Math.Round(Math.Min(open, close) * (1 - (decimal)random.NextDouble() * 0.012m), 2);
var volume = (long)(18_000_000 + Math.Abs(move) * 900_000_000m + random.Next(0, 8_000_000));
days.Add(new Day(date, open, high, low, close, volume));
}
// The 20-day average of the close, from the days before the chart's first too.
for (var i = 19; i < days.Count; i++)
{
days[i] = days[i] with { Average = Math.Round(days.Skip(i - 19).Take(20).Average(d => d.Close), 2) };
}
_shown = days.Where(d => d.Date >= new DateOnly(2026, 8, 3)).ToArray();
}
}A line series over the candles takes the same spacing by item; on a chart without bars or candles, SkipGaps on ChartArgumentAxis does it.
The same LabelWidth on both value axes lines up their plots, and the prices' chart hides its dates with HideLabels, since the volume's show them. Only the prices' chart sets Zoom, so its buttons zoom both, and the volume follows.
One title names the pair: the volume chart's Title is for screen readers, hidden with HideTitle, and each value axis's Title says what it measures. Both leave out their tables (DataTable="ChartDataTable.None"), so nothing sits between the two plots.
Details
A candle is hollow when the price closed above its open and filled when it closed below, in the chart's increase and decrease colors (blue and red by default, which stay apart for red-green color blindness), so the direction shows without color too. Add a ChartLineSeries<T> for a moving average; volume reads best as bars in a chart of its own under this one, joined with Sync. For many items, ChartOhlcSeries<T> is thinner. Stands upright only.
Mode support
| Feature | Static | Interactive |
|---|---|---|
| Candlesticks, hollow when the price closed up and filled when it closed down, so direction shows without color | Yes | Yes |
| Trading days side by side, with no gaps for weekends and holidays, labeled where weeks, months and years begin | Yes | Yes |
| A moving average or other line drawn over the prices, and volume in a synced chart beneath | Yes | Yes |
| Each period's four prices in its tooltip and the table | Yes | Yes |
| A table of the values behind a "Show data" button | Yes | Yes |
| Tooltips on hover and from the keyboard | Yes | Yes |
| Zoom and pan along the dates | Yes | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Without JavaScript
Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off.
- Tooltips on hover and from the keyboard: waits for the script
- Zoom and pan along the dates: waits for the script
Parameters
| Prop | Type | Default |
|---|---|---|
OpenEach item's opening price, such as d => d.Open. | Expression<Func<TItem, object?>> | Required |
HighEach item's highest price, such as d => d.High. | Expression<Func<TItem, object?>> | Required |
LowEach item's lowest price, such as d => d.Low. | Expression<Func<TItem, object?>> | Required |
CloseEach item's closing price, such as d => d.Close. | Expression<Func<TItem, object?>> | Required |
IncreaseColorThe CSS color of items that closed up, such as var(--ib-color-success). | string? | computed |
DecreaseColorThe CSS color of items that closed down. | string? | computed |
AggregateWith ChartDrillLevel<T>s, how each level adds up its items' values: DataAggregate.Sum (the default), DataAggregate.Avg, DataAggregate.Min, DataAggregate.Max or DataAggregate.Count (the items with a value). | DataAggregate | DataAggregate.Sum |
NameThe series' name, in the legend, the data table and each value's description. | string? | computed |
SeriesBySplits the series into one per value of this, such as p => p.Device: each draws only its own items' values, is named by its value, and takes the next color and marker, in the order the values first appear. | Expression<Func<TItem, object?>>? | |
ColorA CSS color, such as var(--ib-color-danger) or #0f766e. | string? | computed |
LabelsWrites each value beside its bar or point. | ChartLabels | ChartLabels.None |
LabelFormatA .NET format string for this series' labels, such as C0. | string? | computed |
LabelTextWhat each label says in place of its value, such as r => r.Region to name each bubble or point. | Expression<Func<TItem, object?>>? | |
LabelOverlapWhat labels do when they'd overlap others: left out at those widths (ChartLabelOverlap.Hide, the default), or shown anyway (ChartLabelOverlap.Show). | ChartLabelOverlap | ChartLabelOverlap.Hide |
TrendDraws a trend through the values: a dashed line in the series' color, named "Revenue trend" (a moving average "Revenue, 7-day average") in the legend, tooltips and data table. | ChartTrend | ChartTrend.None |
TrendOrderA polynomial trend's order, 2 (a parabola) to 6. | int | 2 |
TrendPeriodHow many values a moving average takes in, 2 or more. | int | 3 |
TrendColorThe trend's CSS color, such as var(--ib-color-danger), used as given. | string? | computed |
ValueAxisThe Name of the value axis the series is read off, for a measure in other units on a second axis at the end side, such as "margin". | string? | computed |
HiddenStarts with the series hidden: the chart is drawn as if it weren't there, and it keeps its place in the legend, to show it again, and in the data table. | bool | false |