Chart Axes: Datetime

The TKChartDateTimeAxis Categoric axis is an axis with NSDate values sorted chronologically. It also allows definitions of categories based on specific date time components – year, month, day etc. For example, if data values fall in the range of one year, the points can be plotted in categories for each month. If data values fall in the range of one month, the values can be categorized by days. It also introduces several important properties:

Configure a TKChartDateTimeAxis

You can configure a date-time axis by initializing it and setting it as the main x-axis or y-axis of the chart:

TKChartDateTimeAxis *xAxis = [[TKChartDateTimeAxis alloc] initWithMinimumDate:minDate andMaximumDate:maxDate];
xAxis.majorTickIntervalUnit = TKChartDateTimeAxisIntervalUnitMonths;
xAxis.majorTickInterval = 1;
let xAxis = TKChartDateTimeAxis(minimumDate: minDate, andMaximumDate: maxDate)
xAxis.majorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.months
xAxis.majorTickInterval = 1
TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis (minDate, maxDate);
xAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Months;
xAxis.MajorTickInterval = 1;

You can define the axis categories by changing the interval unit property to one of the following values:
TKChartDateTimeAxisIntervalUnitSeconds - The majorTickInterval is measured in seconds.
TKChartDateTimeAxisIntervalUnitMinutes - The majorTickInterval is measured in minutes.
TKChartDateTimeAxisIntervalUnitHours - The majorTickInterval is measured in hours.
TKChartDateTimeAxisIntervalUnitDays - The majorTickInterval is measured in days.
TKChartDateTimeAxisIntervalUnitWeeks - The majorTickInterval is measured in weeks.
TKChartDateTimeAxisIntervalUnitMonths - The majorTickInterval is measured in months.
TKChartDateTimeAxisIntervalUnitYears - The majorTickInterval is measured in years.
TKChartDateTimeAxisIntervalUnitCustom - The majorTickInterval is measured in ticks.

Setting a plotting mode of axis

The TKChartAxisPlotMode is used by the axis to plot the data. Possible values are TKChartAxisPlotModeBetweenTicks and TKChartAxisPlotModeOnTicks. TKChartAxisPlotModeBetweenTicks plots points in the middle of the range, defined by two ticks. OnTicks plots the points over each tick.

You should use the following lines of code to alter this behavior:

xAxis.plotMode = TKChartAxisPlotModeBetweenTicks;
xAxis.setPlotMode(TKChartAxisPlotMode.betweenTicks)
xAxis.PlotMode = TKChartAxisPlotMode.BetweenTicks;