Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6601069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:42:19+00:00 2026-05-25T18:42:19+00:00

In numberOfRecordsForPlot:… I have this code: int count = [[optsDict objectForKey:@Values] count]; NSLog(@pie count:

  • 0

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:

enter image description here

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:42:20+00:00Added an answer on May 25, 2026 at 6:42 pm

    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)index object of class NSNumber

    num = (NSNumber *)[NSNumber numberWithInt:(int)percentage];
    return num;
    

    I was testing this in sample that is included in CorePlot framework. Firstly I tried to init contentArray array with NSNumbers:

    NSMutableArray *contentArray = [NSMutableArray arrayWithObjects:[NSNumber numberWithInt:9.0909099], [NSNumber numberWithInt:9.0909099], [NSNumber numberWithInt:63.63636463], [NSNumber numberWithInt:18.181818], nil];
    

    And everything works perfect. Then I’ve tried to init array as in your code with NSDecimalNumbers:

    NSMutableArray *contentArray = [NSMutableArray arrayWithObjects:[NSDecimalNumber numberWithInt:9.0909099], [NSDecimalNumber numberWithInt:9.0909099], [NSDecimalNumber numberWithInt:63.63636463], [NSDecimalNumber numberWithInt:18.181818], nil];
    

    And I’ve received exactly your double colored chart.

    Hope this will help you =)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is this: I can't seem to access the variable todaysDate from the
Here I have added no of co-ordinates to dataForPlot (which is an mutable array).I'm
In my iPhone app, I have a view with two separate bar plots. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.