使用核心图在x轴iphone上的日期

时间:2011-06-21 12:22:16

标签: iphone cocoa-touch core-plot

我想在CPXYPlotSpace上显示x轴上的数据。我已经看到在mac上使用类似的东西这样做,但它不适用于iPhone,所以任何建议或我必须手动。

 NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
dateFormatter.dateStyle = kCFDateFormatterShortStyle;
CPTimeFormatter *timeFormatter = [[[CPTimeFormatter alloc] initWithDateFormatter:dateFormatter] autorelease];
timeFormatter.referenceDate = refDate;
x.labelFormatter = timeFormatter;

1 个答案:

答案 0 :(得分:0)

不要忘记设置intervalLength

    NSTimeInterval oneDay = 24 * 60 * 60;
x.majorIntervalLength = CPDecimalFromFloat(oneDay);
y.orthogonalCoordinateDecimal = CPDecimalFromFloat(oneDay);