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:
majorTickInterval- defines an interval between major axis ticks.
baseline- defines how the series data should be aligned. For example: The
TKChartBarSeriesmight render its bars up and down depending on whether its value is greater or less than the baseline value.
offset- determines an axis value where the axis is crossed with another axis.
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 = 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.
TKChartAxisPlotMode is used by the axis to plot the data. Possible values are
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 = TKChartAxisPlotMode.BetweenTicks;