开发者

Date on x axis iphone using core plot

开发者 https://www.devze.com 2023-03-14 14:55 出处:网络
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.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消