In numberOfRecordsForPlot:... I have this code:
int count = [[optsDict objectForKey:@"Values"] count];
NSLog(@"pie count: %i", count);
return count;
It outputs pie count: 4 thus (unless I’m misinterpreting) there should be 4 segments to the pie chart.
Then in numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index I have this:
double percentage = ((float)counter/(float)total)*100;
num = (NSDecimalNumber *)[NSDecimalNumber numberWithInt:(int)percentage];
NSLog(@"index: %i, percentage: %f", index, percentage);
NSLog(@"%@", num);
return num;
This outputs:
index: 0, percentage: 9.090909
9
index: 1, percentage: 9.090909
9
index: 2, percentage: 63.636364
63
index: 3, percentage: 18.181818
18
So I am assuming (reasonably) that the function is getting run once for each segment and its returning a figure for all of them!
However the chart looks like this:

Theres not really much else I can tell you. Thats all I know, I don’t know much about core plot!
If there is ANY help you can give me I’d be very appreciative!
Thank you
I play with your values and I think I found the problem in your code.
Try to return in
-(NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)indexobject of classNSNumberI was testing this in sample that is included in CorePlot framework. Firstly I tried to init
contentArrayarray withNSNumbers:And everything works perfect. Then I’ve tried to init array as in your code with
NSDecimalNumbers:And I’ve received exactly your double colored chart.
Hope this will help you =)