CorePlot:Date的自动标签策略

时间:2012-12-05 16:34:49

标签: iphone core-plot

我正在将CorePlot用于iPhone应用程序。我的x轴由日期组成。我像这样设置我的refDate:

NSDateComponents *dateComponents = [[NSDateComponents alloc]init];
[dateComponents setHour:12];
[dateComponents setMinute:0];
[dateComponents setSecond:0];
NSCalendar *gregorian = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *refDate = [gregorian dateFromComponents:dateComponents];

NSDateFormatter *dateFormater = [[NSDateFormatter alloc]init];
[dateFormater setDateFormat:@"HH:mm"];
CPTTimeFormatter *timeFormater = [[CPTTimeFormatter alloc]initWithDateFormatter:dateFormater];
timeFormater.referenceDate = refDate;

我像这样设置x轴:

CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;    
CPTXYAxis *x = axisSet.xAxis;
x.majorGridLineStyle = majorXGridLineStyle;
x.majorIntervalLength = CPTDecimalFromFloat(oneHour * 4);
x.minorTicksPerInterval = 3;
x.labelFormatter = timeFormater;

当我不使用自动标签政策时,图表如下所示: enter image description here

哪个好,但是当我放大时,我很想拥有自动标注功能。所以当我启用它时:

x.labelingPolicy = CPTAxisLabelingPolicyAutomatic;

我得到了这些结果:

enter image description here

有没有办法将我的值与自动标注政策中的值结合起来?

0 个答案:

没有答案