New to Telerik UI for Xamarin? Download free 30-day trial

Chart for Xamarin.iOS: DateTimeCategory Axis

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 properties 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;
In this article