0
votes

So I'm plotting about 80k records in CorePlot and it is kind of slow. I realized, however, that the pixel density of my graph zoomed out is obviously not 80k pixels. I'd like to be able to preform a data reduction on my data depending on zoom range so I have no more than 1 point per pixel but I'm having trouble determining how to find out the frame size of the plot area.

Is there a way to do this programmatically. What i've done is save a screen shot of the graph from the iPhone simulator and trace out the Plot Area graph area by hand and I come up with about: 1760x1116

I'd love to know if there is a way to do this from code.

enter image description here

1

1 Answers

1
votes

The plot area (and many other parts of a Core Plot graph) are CALayer objects. Get the bounds of that layer and inspect the size field. If you have a reference to a plot, you can use this:

CGSize plotAreaSize = plot.plotArea.bounds.size;

If not, you can also get to the plot area from the graph:

CGSize plotAreaSize = graph.plotAreaFrame.plotArea.bounds.size;