Search code examples
cocoacore-plotcocoa-bindings

Cocoa Bindings & Core Plot


I have a pie chart working using the datasource and delegate methods for core plot, however I'm now trying to use bindings and running into some issues.

I using the following code to bind to the arraycontroller:

[graph addPlot:pieChart];

    // add bindings
    NSLog(@"The arranged objects are: %@", [[[self sectorAllocation] arrangedObjects] valueForKey:@"sectorPercentage"]);
    [pieChart bind:CPTPieChartBindingPieSliceWidthValues toObject:[self
                                                    sectorAllocation] withKeyPath:@"arrangedObjects.sectorPercentage"
           options:nil];

    //Set the sorting
    [[self sectorAllocation] setSortDescriptors:[NSArray arrayWithObject:
                                         [NSSortDescriptor sortDescriptorWithKey:@"sectorPercentage" ascending:YES]]];

It seems to be getting hung up on updateNormalizedData function. Based on my NSlog statement my arraycontroller is returning proper values, so I have no idea what I'm doing wrong...any suggestions?

enter image description here


Solution

  • You found a bug in the pie chart. I just fixed it and pushed a change to the repository. Use Mercurial to pull the latest code. If you don't want to update the whole Core Plot library, use the change here to patch your copy.