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 6888465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:01:14+00:00 2026-05-27T06:01:14+00:00

Here I have added no of co-ordinates to dataForPlot (which is an mutable array).I’m

  • 0

Here I have added no of co-ordinates to dataForPlot (which is an mutable array).I’m trying to display ONE set of co-ordinates here. so I have returned [dataForPlot count] in numberOfRecordsForPlot method.This is working fine.

but now I have different-different sets of co-ordinates(i.e. 4 to 5 for loops which I have used in viewDidLoad method)

I want to show those 4 to 5 sets/records on plot with different color for each set.
what should I return in numberOfRecordsForPlot method and any change needed in numberForPlot method?How should I achieve that?

I’m new to core plot.

- (void)viewDidLoad 
{
    [super viewDidLoad];
    NSMutableArray *contentArray = [NSMutableArray arrayWithCapacity:100];
    NSUInteger i;
    for ( i = 0; i < 60; i++ ) {

       id x = [NSNumber numberWithFloat:1+i*0.05];
       id y = [NSNumber numberWithFloat:1.2*rand()/(float)RAND_MAX + 1.2];
       [contentArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:x, @"x", y, @"y", nil]];
   }
self.dataForPlot = contentArray;
}


-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot 
{
    return [dataForPlot count];
}


-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index 
{
     NSDecimalNumber *num = nil;

    num = [[dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];

   return num;
}
  • 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-27T06:01:15+00:00Added an answer on May 27, 2026 at 6:01 am

    First, you should read sample code. CPTTestAPP-iPhone. It has two scatter plots. Green one and Blue one.

    All sample src code is included in CorePlot package.

    If your application is for iOS5 and ARC(Automatic Reference Count), you should download latest full CorePlot package by using Mercurial. Because 0.90 release does not include recent modification for ARC.

    -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
    -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index

    Above two meshods are CPTPlot’s data source.
    Even you have many scatter plot, each your scatter plot can have identifier. So data source can dtermine who is real client.

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

Sidebar

Related Questions

Java Newbie here. I have a JFrame that I added to my netbeans project,
Just wondering what little scripts/programs people here have written that helps one with his
In my application I have added interceptor to filter the request.Here each user is
I have added a nice little bit of jquery which make images black and
Here is my .classpath file, after I have added two more external jars (org.restlet.ext.simple.jar
here is the case. with jquery ajax call i have added a new link
I have added some debugging code to my app which I want to call
I have added one image (it is a nice painted box type thing rectangular
Here...The code i have added to filter the anchor link is not working.. And
I have to build a custom module in which i have added a custom

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.