Date on x axis iphone using core plot
I want to show data on x-axis on CPXYPlotSpace. I have seen doing so on mac using something like that but it does not work on iphone so any suggestion or i have to do it manually.
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
dateFormatter.dateStyle =开发者_开发百科 kCFDateFormatterShortStyle;
CPTimeFormatter *timeFormatter = [[[CPTimeFormatter alloc] initWithDateFormatter:dateFormatter] autorelease];
timeFormatter.referenceDate = refDate;
x.labelFormatter = timeFormatter;
Don't forget to set intervalLength
NSTimeInterval oneDay = 24 * 60 * 60;
x.majorIntervalLength = CPDecimalFromFloat(oneDay);
y.orthogonalCoordinateDecimal = CPDecimalFromFloat(oneDay);
精彩评论