I have created a scatter plot using Core Plot. My graph however needs to be refreshed dynamically (points are constantly being added and removed). I need the plot to be fluent and appear to be "sliding across the graph". Instead I seem to be getting a choppy line that adds several values at once, freezes and the again adds several values. What could be causing this behaviour?
-(void)updateDataWithVal:(double)percentageUsage
{
if ([self.graphData count] >= 10)
{
[self.graphData removeLastObject];
}
[self.graphData insertObject:[NSNumber numberWithDouble:percentageUsage] atIndex: 0];
[self.graph reloadData];
}
Above is the function that is called every time I want the graph to change. The problem isn't with the data being updated. I debugged the function and noticed that the data is being updated fluently (a point is added and removed from the data array per second). The problem is with the graph actually changing. What could be causing the graph to freeze and adding several points at once (every 6-7 seconds) instead of continuously updating every second like the data is?
I doubt this is being caused by adding to many points in a short interval. Only one point is removed and added per second. Additionally, my graph has only one plot.
My graph is running on OSX not iOS. All code is in Objective-C.