Chart Axes: Date Time Category

The TKChartDateTimeCategoryAxis is a special axis that is similar to TKChartCategoryAxis and adds notation for NSCalendarUnit enumeration. This axis uses the selected calendar units to extract a key from dates. The key is used to build categories. Once build, categories are sorted in chronological order.

The most important property of TKChartDateTimeCategoryAxis is the dateComponent. It is used to specify which parts of the date are important. Its default value is TKCalendarUnitDate which is a shortcut for NSCalendarUnitDay|NSCalendarUnitMonth|NSCalendarUnitYear.

Configure a TKChartDateTimeCategoryAxis

You can configure a date time category axis by setting the dateComponent property. Optionally you can set propertie like plotMode and labelFormatter to control the appearance of the axis:

var xAxis = new TKChartDateTimeCategoryAxis ();
var formatter = new NSDateFormatter ();
formatter.DateFormat = "d MMM";
xAxis.LabelFormatter = formatter;