iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x

Axis APIs

There are several axis types in SciChart iOS. Although they all differ in types of data values that can be rendered, the most fundamental difference is in their behavior. By that, the axes can be divided into two groups, Category and Value axis types. Please read the Value Axis vs. Category Axis article elaborating on what the difference is.

A list of the axis types are found below:

Axis Type Value or Category Axis
SCINumericAxis Value Axis
SCILogarithmicNumericAxis Value Axis
SCIDateAxis Value Axis
SCICategoryDateAxis Category Axis

All the axis types in SciChart conforms to the ISCIAxis protocol.

SCINumericAxis

The SCINumericAxis is a Value-Axis and is suitable for X and Y Axis when the data type on that axis is numeric (e.g. double, int, long, float, short). It is not suitable for non-numeric data types.

To create and configure a SCINumericAxis, use the following code:

id<ISCIAxis> axis = [SCINumericAxis new]; axis.axisAlignment = SCIAxisAlignment_Right; axis.autoRange = SCIAutoRange_Once; axis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1]; axis.visibleRange = [[SCIDoubleRange alloc] initWithMin:-45 max:300];
let axis = SCINumericAxis() axis.axisAlignment = .right; axis.autoRange = .once; axis.growBy = SCIDoubleRange(min: 0.1, max: 0.1) axis.visibleRange = SCIDoubleRange(min: -45, max: 300)
var axis = new SCINumericAxis { AxisAlignment = SCIAxisAlignment.Right, AutoRange = SCIAutoRange.Once, GrowBy = new SCIDoubleRange(0.1, 0.1), VisibleRange = new SCIDoubleRange(-45, 300) };

SCILogarithmicNumericAxis

The SCILogarithmicNumericAxis is a Value axis which uses non-linear (logarithmic) scale. It is suitable for X and Y Axis when the data is numeric (e.g. double, int, long, float, short). It is not suitable for non-numeric data types.

NOTE: The SCILogarithmicNumericAxis cannot render data values less than or equal to zero. Please ensure you append valid data to your DataSeries.

To create and configure a SCILogarithmicNumericAxis, use the following code:

SCILogarithmicNumericAxis *axis = [SCILogarithmicNumericAxis new]; axis.axisAlignment = SCIAxisAlignment_Right; axis.autoRange = SCIAutoRange_Once; axis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1]; // Specifies how labels appear on the axis axis.scientificNotation = SCIScientificNotation_LogarithmicBase; axis.textFormatting = @“#.#E+0”; // Specifies the logarithm base for the logarithmic scale of the axis axis.logarithmicBase = 10.0; axis.visibleRange = [[SCIDoubleRange alloc] initWithMin:0.1 max:1000.0];
let axis = SCILogarithmicNumericAxis() axis.axisAlignment = .right; axis.autoRange = .once; axis.growBy = SCIDoubleRange(min: 0.1, max: 0.1) // Specifies how labels appear on the axis axis.scientificNotation = .logarithmicBase axis.textFormatting = “#.#E+0” // Specifies the logarithm base for the logarithmic scale of the axis axis.logarithmicBase = 10.0 axis.visibleRange = SCIDoubleRange(min: 0.1, max: 1000.0)
var axis = new SCILogarithmicNumericAxis { AxisAlignment = SCIAxisAlignment.Right, AutoRange = SCIAutoRange.Once, GrowBy = new SCIDoubleRange(0.1, 0.1), // Specifies how labels appear on the axis ScientificNotation = SCIScientificNotation.LogarithmicBase, TextFormatting = “#.#E+0”, // Specifies the logarithm base for the logarithmic scale of the axis LogarithmicBase = 10.0, VisibleRange = new SCIDoubleRange(0.1, 1000.0) };

SCIDateAxis

The SCIDateAxis is a Value axis, which is suitable for X and Y Axis and is designed to work with dates only.

NOTE: The SCIDateAxis is not suitable for numeric data types.

To create and configure a SCIDateAxis, use the following code:

id<ISCIAxis> axis = [SCIDateAxis new]; axis.axisAlignment = SCIAxisAlignment_Bottom; axis.autoRange = SCIAutoRange_Once; axis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1]; axis.visibleRange = [[SCIDoubleRange alloc] initWithMin:dateMin max:dateMax];
let axis = SCIDateAxis() axis.axisAlignment = .bottom; axis.autoRange = .once; axis.growBy = SCIDoubleRange(min: 0.1, max: 0.1) axis.visibleRange = SCIDoubleRange(min: dateMin, max: dateMax)
var axis = new SCIDateAxis { AxisAlignment = SCIAxisAlignment.Bottom, AutoRange = SCIAutoRange.Once, GrowBy = new SCIDoubleRange(0.1, 0.1), VisibleRange = new SCIDoubleRange(dateMin, dateMax) };

SCICategoryDateAxis

The SCICategoryDateAxis is a Category axis and is suitable for the XAxis only. It is designed to handle a special case when data is discontinuous or contains breaks at regular intervals. Unlike the other axis types, it works with with data indices, not actual data values.

NOTE: The SCICategoryDateAxis is not suitable for YAxis or numeric data types.

To create and configure a SCICategoryDateAxis, use the following code:

id<ISCIAxis> axis = [SCICategoryDateAxis new]; axis.axisAlignment = SCIAxisAlignment_Top; axis.autoRange = SCIAutoRange_Once; axis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1]; // Set visibleRange to [min data index, max data index] axis.visibleRange = [[SCIDoubleRange alloc] initWithMin:10 max:50];
let axis = SCICategoryDateAxis() axis.axisAlignment = .top; axis.autoRange = .once; axis.growBy = SCIDoubleRange(min: 0.1, max: 0.1) // Set visibleRange to [min data index, max data index] axis.visibleRange = SCIDoubleRange(min: 10, max: 50)
var axis = new SCICategoryDateAxis { AxisAlignment = SCIAxisAlignment.Top, AutoRange = SCIAutoRange.Once, GrowBy = new SCIDoubleRange(0.1, 0.1), // Set VisibleRange to [min data index, max data index] VisibleRange = new SCIDoubleRange(10, 50) };

NOTE: Note the SCICategoryDateAxis is treated as a special case. Although it is intended to show Dates, it doesn’t allow setting SCIDateRange as VisibleRange. The reason for this is that this axis type works with with data indices, not actual data values. So a SCIDoubleRange should be applied instead, with lower data index as Min and Upper data index as Max.

To learn more about how to convert values from Dates to Indexes and back, please refer to the Convert Pixels to Data Coordinates article.

See the Axis Types in action

Please take a look at the examples from the iOS Examples Suite listed below to see these axis types in action: