0
我正在用coreplot制作应用程序,并试图让我的标签沿Xaxis读取12pm,1pm,2pm等。我已成功将NSDateFormatter实现到xAxis.label格式器中。CorePlot:xAxis NSDateFormatter麻烦
问题是,间隔时间似乎以秒为单位(见下图)我需要他们在几个小时内。
我试图通过使xAxis.majorIntervalLength 3600解决这个问题,但这只是使图形看起来就像这样:
蜱是史迪威那里,但现在他们如果这是合理的,那么就把3600放在一起。这里是我的代码:
CPTXYAxisSet *faxisSet = (CPTXYAxisSet *)self.graph.axisSet;
faxisSet.xAxis.title = @"Time";
faxisSet.xAxis.titleTextStyle = textStyle;
faxisSet.xAxis.titleOffset = 30.0f;
faxisSet.xAxis.axisLineStyle = axislineStyle;
faxisSet.xAxis.majorTickLineStyle = axislineStyle;
faxisSet.xAxis.minorTickLineStyle = axislineStyle;
faxisSet.xAxis.labelTextStyle = textStyle;
faxisSet.xAxis.labelOffset = 3.0f;
faxisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(3600.0f);
faxisSet.xAxis.minorTicksPerInterval = 1;
faxisSet.xAxis.minorTickLength = 5.0f;
faxisSet.xAxis.majorTickLength = 7.0f;
NSString *dats1 = @"16";
NSDateFormatter *dateFormatter3 = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter3 setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter3 setDateFormat:@"hh:mm:ss a"];
CPTTimeFormatter *timeFormatter = [[CPTTimeFormatter alloc]initWithDateFormatter:dateFormatter3];
timeFormatter.referenceDate = [dateFormatter3 dateFromString:dats1];
faxisSet.xAxis.labelFormatter = timeFormatter;
基本上,我想有每一个其他刻度读取小时,但我想他们除了保持相同的距离。
我会感谢任何帮助,谢谢!
谢谢,完美无缺! – pj409 2013-04-05 01:08:16