iOS Charting Documentation - SciChart iOS Charts SDK v3.x

The OHLC Series Type

The OHLC series are provided by the SCIFastOhlcRenderableSeries type. This accepts data (X, Open, High, Low, Close) from a SCIOhlcDataSeries and renders OHLC bar at each X-Value coordinate.

NOTE: For more info about SCIOhlcDataSeries, as well as other DataSeries types in SciChart, see the DataSeries API article.

OHLC Series Type

NOTE: Examples of the OHLC Series can be found in the SciChart iOS Examples Suite as well as on GitHub:

The SCIFastOhlcRenderableSeries is very much alike the SCIFastCandlestickRenderableSeries class. It allows to specify StrokeUp and StrokeDown pens as well as relative DataPointWidth, which will be applied to every bar. Mentioned settings can be accessed via the following properties:

NOTE: To learn more about Pens and Brushes and how to utilize them, please refer to the SCIPenStyle, SCIBrushStyle and SCIFontStyle article.

NOTE: In multi axis scenarios, a series has to be assigned to particular X and Y axes. This can be done passing the axes IDs to the ISCIRenderableSeries.xAxisId, ISCIRenderableSeries.yAxisId properties.

Create an OHLC Series

OHLC Chart Example

To create an OHLC Series, use the following code:

// Assume a surface has been created and configured somewhere id<ISCIChartSurface> surface; // Create DataSeries and fill it with some data SCIOhlcDataSeries *dataSeries = [[SCIOhlcDataSeries alloc] initWithXType:SCIDataType_Date yType:SCIDataType_Double]; // Create OHLC Series SCIFastOhlcRenderableSeries *ohlcSeries = [SCIFastOhlcRenderableSeries new]; ohlcSeries.dataSeries = dataSeries; ohlcSeries.strokeUpStyle = [[SCISolidPenStyle alloc] initWithColorCode:0xFF00AA00 thickness:1]; ohlcSeries.strokeDownStyle = [[SCISolidPenStyle alloc] initWithColorCode:0xFFFF0000 thickness:1]; [surface.renderableSeries add:ohlcSeries];
// Assume a surface has been created and configured somewhere let surface: ISCIChartSurface // Create DataSeries and fill it with some data let dataSeries = SCIOhlcDataSeries(xType: .date, yType: .double) // Create OHLC Series let ohlcSeries = SCIFastOhlcRenderableSeries() ohlcSeries.dataSeries = dataSeries ohlcSeries.strokeUpStyle = SCISolidPenStyle(colorCode: 0xFF00AA00, thickness: 1.0) ohlcSeries.strokeDownStyle = SCISolidPenStyle(colorCode: 0xFFFF0000, thickness: 1.0) surface.renderableSeries.add(ohlcSeries)
// Assume a surface has been created and configured somewhere IISCIChartSurface surface; // Create DataSeries and fill it with some data var dataSeries = new OhlcDataSeries<DateTime, double>(); // Create Candlestick Series var ohlcSeries = new SCIFastOhlcRenderableSeries { DataSeries = dataSeries, StrokeUpStyle = new SCISolidPenStyle(0xFF00AA00, 1f), StrokeDownStyle = new SCISolidPenStyle(0xFFFF0000, 1f), }; surface.RenderableSeries.Add(ohlcSeries);

OHLC Series Features

OHLC Series also has some features similar to other series, such as:

Render a Gap in an OHLC Series

It’s possible to render a Gap in OHLC series, by passing a data point with a NaN as the Open, High, Low, Close values. Please refer to the RenderableSeries APIs article for more details.

Specify Color for Individual Bars

Is SciChart, you can draw each bar of the OHLC Series with different colors using the PaletteProvider API. To Use palette provider for OHLC Series - a custom ISCIStrokePaletteProvider has to be provided to the ISCIRenderableSeries.paletteProvider property. Please refer to the PaletteProvider API article for more info.