我正在将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;
当我不使用自动标签政策时,图表如下所示:
哪个好,但是当我放大时,我很想拥有自动标注功能。所以当我启用它时:
x.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
我得到了这些结果:
有没有办法将我的值与自动标注政策中的值结合起来?