Android & Xamarin.Android Charting Documentation - SciChart Android Charts SDK v2.x
Axis Types

There are several axis types in SciChart Android. 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.

The axis types provided by SciChart Android are listed below:

All the axis types in SciChart implement the IAxis interface.

NumericAxis

The NumericAxis is a Value axis and is suitable for X and Y Axis when the data 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 NumericAxis, use the following code:

Copy Code
IAxis axis = new NumericAxis(getActivity());

axis.setAxisAlignment(AxisAlignment.Right);
axis.setAutoRange(AutoRange.Once);
axis.setGrowBy(new DoubleRange(0.1d, 0.1d));
axis.setVisibleRange(new DoubleRange(-45d, 300d));

LogarithmicNumericAxis

The LogarithmicNumericAxis 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 LogarithmicNumericAxis cannot render data values less than or equal to zero. Please ensure you append valid data to your DataSeries.

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

Copy Code
LogarithmicNumericAxis axis = new LogarithmicNumericAxis(getActivity());

axis.setAxisAlignment(AxisAlignment.Right);
axis.setAutoRange(AutoRange.Once);
axis.setGrowBy(new DoubleRange(0.1d, 0.1d));

// Specifies how lables appear on the axis
axis.setScientificNotation(ScientificNotation.LogarithmicBase);
axis.setTextFormatting("#.#E+0");

// Specifies the logarithm base for the logarithmic scale of the axis
axis.setLogarithmicBase(10d);
axis.setVisibleRange(new DoubleRange(0.1d, 1000d));

DateAxis

The DateAxis is a Value axis, which is suitable for X and Y Axis and is designed to work with temporal data (Date). It is not suitable for numeric data types.

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

Copy Code
IAxis axis = new DateAxis(getActivity());

axis.setAxisAlignment(AxisAlignment.Bottom);
axis.setAutoRange(AutoRange.Once);
axis.setGrowBy(new DoubleRange(0.1d, 0.1d));
axis.setVisibleRange(new DateRange(dateMin, dateMax));

CategoryDateAxis

The CategoryDateAxis 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 indicies, not actual data values. It is not suitable for YAxis or numeric data types.

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

Copy Code
IAxis axis = new CategoryDateAxis(getActivity());

axis.setAxisAlignment(AxisAlignment.Top);
axis.setAutoRange(AutoRange.Once);
axis.setGrowBy(new DoubleRange(0.1d, 0.1d));

// Set VisibleRange to [min data index, max data index]
xAxis.setVisibleRange(new DoubleRange(10d, 50d));

See the Axis Types in action

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

See Also

Reference