Thanks Drew! Now it works.
If anyone is having the same problem I will exemplify Drew's answer.
1. Create a Core Data model with the entity Data and attributes xData
and yData.
2. Create a NSArrayController in IB. Set its mode to Entity and Entity
name to "Data" (or whatever your entity is called). Bind its
managedObjectContext to the same as your model's (where your data
lives, if you created a default data model application, it is in the
app delegate).
3. In whatever class you are setting up your graph add an IBOutlet
your NSArrayController. You need to reference to it when you do your
binding and setting your sortDescriptor. I did this:
//Setting up a ScatterPlot
CPScatterPlot *plot = [[[CPScatterPlot alloc] init]
autorelease];
plot.dataLineStyle.lineWidth = 1.0f;
plot.dataLineStyle.lineColor = [CPColor blueColor];
[graph addPlot:plot];
//Binding x and y values
[plot bind:CPScatterPlotBindingXValues toObject:[self
arrayController] withKeyPath:@"arrangedObjects.xData" options:nil]; //
Binding
[plot bind:CPScatterPlotBindingYValues toObject:[self
arrayController] withKeyPath:@"arrangedObjects.yData" options:nil]; //
Binding
//Set the sorting
[arrayController setSortDescriptors:[NSArray arrayWithObject:
[NSSortDescriptor sortDescriptorWithKey:@"xData" ascending:YES]]];
Hans