Search code examples
ioscore-plotiphone-4

iPhone4 Core Plot what's a reasonable number of points for scatter plot?


I'm messing around with the Core Plot, and the performance is killing me. I have up to 43000 data points, and it appears that the core plot is failing after about 1500. What's a good number of points to plot for the scatter plot?

Maybe there's some other plot type that would let me plot all 43000 points within a large view?

Thank you!


Solution

  • Assuming you're drawing a scatter XY plot, are you sure you have to use all the 43000 values? That would require 43000 pixels wide view to see them all at once :)

    In my application I have scatter plots of data with up to 3600 values, but I only display as many points as would fit within the visible xRange. E.g. my graph view is 600px wide, so I adjust plot data points amount to be either:

    • no more than 600 points in current xRange - if xRange.lengthDouble >= 600
    • no more than xRange.lengthDouble points in current xRange - if xRange.lengthDouble < 600

    If globalXRange is larger than xRange (i.e. when plot is zoomed), I adjust data points count to 600 for current xRange and reload plot data - that makes data point count larger than 600, but still smaller than my total 3600.

    This brings the limitation that when you zoom in the plot too much, your data point count would anyway increase significantly and cause slow down, but it all depends on your situation. If you don't have to display the data in huge zoom factor, you could simply reduce data points and display only 1/n part of your data (every nth result).