0
votes

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?

1
What version of Core Plot are you using? I've fixed some issues that might be causing this problem since the 1.1 release. - Eric Skroch
I am using 1.1. I will try the current version, thank you! - Dirk
I cloned the latest repository and replaced version 1.1 in my project, then did a clean rebuild. It fixed another problem that I was going to report, but the behavior I described above remained the same. Sorry. - Dirk

1 Answers

0
votes

I think you answered your own question. It does no good to scale the plot space when the plot(s) don't have any data. Wait until your data model is built and then scale the plot space. You can build the graph any time you want; it will redraw when the data becomes available.