Variable Tick Spacing


#1

I have a chart where I want to put major ticks at the begining of every month.  The only problem is, some months have 4 weeks, some months have 5 weeks.  How do I handle this variable tick spacing?


#2

Hi jmonroe,

Here is an example of how you could be able to alter the tick marks so that they only show for the 1st of each month:

[financialChart xAxis].majorTickFrequency = [SChartDateFrequency dateFrequencyWithMonth:1];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy"];
NSDate *dateFromString = [[NSDate alloc] init];
NSString *dateString = @"01-01-2000";   
dateFromString = [dateFormatter dateFromString:dateString];
[financialChart xAxis].anchorPoint = [NSDate dateWithTimeInterval:NSTimeIntervalSince1970 sinceDate:dateFromString];
[[[financialChart xAxis].labelFormatter dateFormatter] setDateFormat:@"dd MM yyyy"];

Let me know how you get on.

Kind regards,

Daniel Allsop