iPhone开发:Core-Plot性能在处理大量数据时速度慢

nul*_*cgo 1 iphone charts core-plot

iPhone开发:处理大量数据时Core-Plot性能变慢.

我试图把500个数据放到Plot中.表现表明它真的很慢.

大多数CandleStick图表都混合在一起......

有人对我有任何解决方案吗?

Eri*_*och 7

  1. 注意绘图区域的大小.如果您有比像素更多的数据点,请将数据集过滤为@benzado建议.

  2. 使用快速绘制的图形元素 - 不透明的颜色,没有渐变,没有图像,没有阴影.如果条形图只有几个像素宽,则不要同时设置填充和边框线; 使用任何一个绘制得更快.

  3. 减少或消除外部元素,如次要刻度线和网格线.

  4. 使用一种数据源方法,在一次调用中提供一组点,而不是一次一个.

    -(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange;
    -(double *)doublesForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange;
    -(CPTNumericData *)dataForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange;
    
    Run Code Online (Sandbox Code Playgroud)