例如,从 09:00am 到 09:05:am
理想情况下,我的情节从服务器获得 6 分。
- (NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {
return 6;
}
数据源
Index Time Price
0 09:00 84.2
1 09:01 84.5
2 09:02 84.1
3 09:03 84.0
4 09:04 84.1
5 09:05 84.0
但是,实际上Server会这样响应数据源
Index Time Price
0 09:00 84.2
1 09:01 84.5
2 09:02 nil
3 09:03 nil
4 09:04 84.1
5 09:05 84.0
我为 numberOfRecordsForPlot 返回 6
numberForPlot 索引 2 和 3 为 nil
我会得到这样的情节
我的问题是
如果索引 2 和索引 3 没有数据
如何用直线将索引 1 连接到索引 4
即使用直线将 (1, 84.5) 连接到 (4, 84.1)
最佳答案
因为您只有四个数据点要绘制,-numberOfRecordsForPlot:
应该返回 4
。数据源还应该跳过 nil
值:
Index Time Price
0 09:00 84.2
1 09:01 84.5
2 09:04 84.1
3 09:05 84.0
关于ios - CPT ScatterPlot 连接点与跳过一些数据点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36347861/