使用核心图更新图形的特定部分?

Updating specific part of graph using core plot?

我正在使用 [thePlot5 insertDataAtIndex:i numberOfRecords:150]; 将数据插入实时图表。该图表包含将近 10000 个数据点(我需要该图表中的 10000 个点)。 但是我每次更新150个数据点。

但是-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot方法returns每次10000。因此 -(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx 中的迭代将是 2000 万次 x 和 y.This 会降低性能。

我只想更新新积分(即150分而不是全部10000分)。请大家帮帮我。

-insertDataAtIndex:numberOfRecords: 方法告诉绘图只加载新的数据点。在问题中给出的示例中,绘图应该向数据源请求 150 个新点,从数据索引 i 开始。请注意,在插入调用之后,-numberOfRecordsForPlot: 应该 return 旧值加上新记录数 (10000 + 150 = 10150)。如果你想保持总点数不变,你需要用 -deleteDataInIndexRange:.

删除一些旧点