iOS 核心图 - 图表线未延伸至主要区间
iOS Core plot - graph line not extending upto major interval
我是 CorePlot 的新手。我正在尝试呈现每 10 秒通过网络提取数据的图表。我想绘制每 10 秒提取一次的数据,所以我将 x.majorIntervalLength 设置为 10。我希望每个图都出现在主要刻度上,但是,它不是这样工作的。
如果我的 x 轴是 12:10:10 12:10:20 12:10:30 12:10:40 等等,第一个情节出现在 12:10:10,但是第二个情节发生 12:10:11 ,第三个 12:10:12 等等。我希望第二个和第三个绘图符号出现在 12:10:20 和 12:10:30 处,因为那是从后端提取数据的时候。
这是我的 x 轴配置:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init] ;
[dateFormatter setDateFormat:@" HH:mm:ss\rYYYY.MM.dd"];
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
CPTTimeFormatter *dateTimeFormatterForXAxis = [[CPTTimeFormatter alloc] initWithDateFormatter:dateFormatter] ;
dateTimeFormatterForXAxis.referenceDate = [NSDate date];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
x.labelFormatter = dateTimeFormatterForXAxis;
x.minorTicksPerInterval = 0;
x.majorIntervalLength = @10;
我在这里错过了什么?
求推荐。
时间间隔以秒为单位,因此您应该将索引乘以 10 以 space 间隔 10 秒的数据点。
我是 CorePlot 的新手。我正在尝试呈现每 10 秒通过网络提取数据的图表。我想绘制每 10 秒提取一次的数据,所以我将 x.majorIntervalLength 设置为 10。我希望每个图都出现在主要刻度上,但是,它不是这样工作的。
如果我的 x 轴是 12:10:10 12:10:20 12:10:30 12:10:40 等等,第一个情节出现在 12:10:10,但是第二个情节发生 12:10:11 ,第三个 12:10:12 等等。我希望第二个和第三个绘图符号出现在 12:10:20 和 12:10:30 处,因为那是从后端提取数据的时候。
这是我的 x 轴配置:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init] ;
[dateFormatter setDateFormat:@" HH:mm:ss\rYYYY.MM.dd"];
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
CPTTimeFormatter *dateTimeFormatterForXAxis = [[CPTTimeFormatter alloc] initWithDateFormatter:dateFormatter] ;
dateTimeFormatterForXAxis.referenceDate = [NSDate date];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
x.labelFormatter = dateTimeFormatterForXAxis;
x.minorTicksPerInterval = 0;
x.majorIntervalLength = @10;
我在这里错过了什么?
求推荐。
时间间隔以秒为单位,因此您应该将索引乘以 10 以 space 间隔 10 秒的数据点。