Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

OHLC chart

Since 0.1.0-alpha.23
Charts long price histories, such as a year of trading days.

Use OHLC bars for price histories over many periods, where candlesticks would crowd together. Leave out Open for high-low-close, which suits end-of-day prices such as a fund's. For the trend alone, use a line chart.

OHLC bars over a year

ChartOhlcSeries takes each item's Open, High, Low and Close, here for a year of trading days. The tick on the left is the open and the one on the right the close. Drag across the plot to zoom into a month.

Static

Preview

EUR/USD, daily, Nov 2025 to Oct 2026
Arrow keys move between values; plus and minus zoom, 0 zooms out; Escape hides the tooltip.

Code

Usage.razor
@* A year of an exchange rate's trading days as OHLC bars, which stay readable where candles would crowd; zoom to read a month. *@
<Chart Items="_days" Argument="d => d.Date" Title="EUR/USD, daily, Nov 2025 to Oct 2026">
    <ChartValueAxis Format="0.000" />
    <ChartArgumentAxis Zoom />
    <ChartOhlcSeries Open="d => d.Open" High="d => d.High" Low="d => d.Low" Close="d => d.Close" Name="EUR/USD" />
</Chart>

@code {
    private record Day(DateOnly Date, decimal Open, decimal High, decimal Low, decimal Close);

    private readonly Day[] _days;

    public Usage()
    {
        // Weekdays (the currency market closes at weekends), a slow drift with small daily swings.
        var random = new Random(11);
        var days = new List<Day>();
        var close = 1.085m;
        for (var date = new DateOnly(2025, 11, 3); date <= new DateOnly(2026, 10, 30); date = date.AddDays(1))
        {
            if (date.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday || (date.Month == 12 && date.Day == 25) || (date.Month == 1 && date.Day == 1)) continue;
            var open = close;
            close = Math.Round(open * (1 + (decimal)(random.NextDouble() - 0.485) * 0.012m), 4);
            var high = Math.Round(Math.Max(open, close) * (1 + (decimal)random.NextDouble() * 0.004m), 4);
            var low = Math.Round(Math.Min(open, close) * (1 - (decimal)random.NextDouble() * 0.004m), 4);
            days.Add(new Day(date, open, high, low, close));
        }

        _days = [.. days];
    }
}

Add this example to a page with the izzy CLI:

bash
izzy add component ChartOhlcSeries --at <file>:<line>

Without an Open, bars show the high, low and close, and an item is up when it closed above the one before.

IncreaseColor and DecreaseColor set the colors, as on a candlestick chart.

For a low and a high alone, such as a day's temperatures, use a Range bar chart.

Details

Thinner than candlesticks, bars stay readable over many items, such as a year of days. Without an Open, high-low-close: an item is up when it closed at or above the one before. Stands upright only.

Mode support

What works in each mode, OHLC chart
FeatureStaticInteractive
OHLC bars, the open a tick to the left and the close to the right, colored by whether the price closed upYesYes
High-low-close, with no openYesYes
Trading days side by side, with no gaps for weekends and holidays, labeled where weeks, months and years beginYesYes
Each period's prices in its tooltip and the tableYesYes
A table of the values behind a "Show data" buttonYesYes
Tooltips on hover and from the keyboardYesYes
Zoom and pan along the datesYesYes

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

ChartOhlcSeries parameters
PropTypeDefault
OpenEach item's opening price, such as d => d.Open, drawn as a tick to the left.Expression<Func<TItem, object?>>?
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).DataAggregateDataAggregate.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.ChartLabelsChartLabels.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).ChartLabelOverlapChartLabelOverlap.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.ChartTrendChartTrend.None
TrendOrderA polynomial trend's order, 2 (a parabola) to 6.int2
TrendPeriodHow many values a moving average takes in, 2 or more.int3
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.boolfalse

Connection lost

Rejoining the server…