Inherits from | SChartAxis : NSObject |

Declared in | SChartCategoryAxis.h |

Availability |
Standard Premium |

Related samples |
Area BarChart ColumnChart LineChart |

A SChartCategoryAxis is a subclass of SChartAxis designed to work with discrete data points with no linear correlation between values.

For the purposes of ranges, each data point value for a category axis is represented by an integer (generated by the order in which data points are added to the series - but removing duplicates). This determines order and can be used to set ranges.

For example, for datapoint values @“June”, @5 and @“Frog” passed to the chart in that order along a category axis:

- June is equivalent to 0.
- 5 is equivalent to 1.
- Frog is equivalent to 2.
- The range of this data is 0 to 2.
- Setting a range of 0 to 1 would show June and 5, but not Frog.

However, the `dataIndex`

from the datasource may not correspond to the NSNumber mapped to the category.

For example, when points are prepended and new categories are added they will be given negative values. This is due to prepending points not reloading the entire chart’s data again.

The data point values are not sorted and do not need to be members of the same class - as long as they respond to the ‘description’ selector.

Each series linked to the Category Axis can only have one datapoint per Category. If a second data point is added with the same value, it will replace the first.

Since one cannot interpolate between ‘5’ and a ‘Frog’, or group ‘June’ and ‘5’ into an encapsulating value, minor tick marks are disabled on Category Axes.

Major tick marks and labels, if enabled, will be shown for each datapoint.

Setting major or minor tick frequencies will have no effect.

An array containing all of the categories across all series linked to this axis.

`@property (nonatomic, retain, readonly) NSArray<NSString *> *categories`

This array can be used to link data point values to integer values.

The `dataIndex`

from the datasource may not correspond to the index of the category.

For example, when points are prepended and new categories are added they will be given negative values. This is due to prepending points not reloading the entire chart’s data again.

`SChartCategoryAxis.h`

Init a Category Axis with a range representing the indices.

`- (id)initWithRange:(nullable SChartRange *)`*range*

The range is based upon the index number of each category where 0 is the first category and n is the nth category, in the order in which the data points are presented to the chart.
The index number of a category can be found from the array `categories`

- which contains the actual set of categories.

`SChartCategoryAxis.h`