I have a NSPersistentDocument-based Core Data application. There is an array of data I can edit in the document, and I want the data to be displayed in a Core Plot graph. I bound a CTPScatterPlot to an ArrayController that is connected to the respective entity.
Almost everything works: The plot is updated every time I add a new data point or edit one. So I guess I did the bindings right.
Problem is, when I open a document, the data plot isn't initially shown. I only see the axes with wrong ranges.
I setup the graph and plots in the awakeFromNib method of my GraphController (not the document). I bind the plot to the ArrayController and then scale the plot space. When debugging I can see that the count of the arrangedObjects is zero, so no wonder that scaling doesn't work.
I currently scale the plot space again by calling my scaleSpace method when pressing a button.
It appears to me that the managedObjectContext is not ready when I set up the graph. When is the proper time to do the scaling?