SChartDateTimeAxis majorTickFrequency Issues


#1

Hello,

The issue i am facing is about a column chart with an SChartNumberAxis as yAxis and an SChartDateTimeAxis as x Axis. The objects that i need to display are grouped in 4 categories. The user can select a category from an UISegmentedControl. These categories are “Day”,“Week”,“Month” & “Year”. 

Category “Day” includes 24 objects representing the time in a day (00:00 - 23:00) and a value for each object.

Category “Week” includes 7 objects representing days in a week (Mon - Sun) and a value for each object.

Category “Month” includes lets say 30 objects representing days in a month and a value for each object.

Category “Year” includes 12 objects representing months in a year and a value for each object.

 The preselected category is “Day” when the app starts.

When a user selects a category, i update an array with the the data to be displayed, i set the proper majorTickFrequency to xAxis  ( dateFrequencyWithHour:1 for “Day”, dateFrequencyWithDay:1, for “Week” & “Month”  or dateFrequencyWithMonth:1 for “Year” ) reloadData & redraw the chart.

 The problem lies in xAxis TickMark Labels. When selecting “Year” category, the tickMarkLabels for the Months are not aligned with the bars in the chart. For the other categories , they are aligned correctly. The strange fact is that when starting the chart with “Year” category as preselected (majorTickFrequency is dateFrequencyWithMonth:1) all labels are displayed correctly for all categories.

 I have created a sample project which replicates this issue every time. I would appreciate any help.

Thank you,

Kyriakos


#2

You need to set xAxis.anchorPoint so axis would know where to start calculations from.


#3

Thank you! This seems to make things right!