我正在为 iPhone 应用程序使用 CorePlot。我的 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;
我得到这些结果:
有没有办法将我的价值观与自动标签政策中的价值观结合起来?