• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help with code...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with code...


  • Subject: Re: Help with code...
  • From: Dave Rosborough <email@hidden>
  • Date: Wed, 16 Mar 2005 18:37:06 -0800

I've never used Narrative, but that is clearly generating a single point (a "set of coordinates"). You need to call the method once for every point.

TTYL
DaveR

On 16-Mar-05, at 6:21 PM, John wrote:

Hello all, I had a really bad start with this list, asking a very obtuse question... Anyways, I'm a bit into my program, and am scratching my head over this one...

I'm trying to figure out how to use Narrative, a plotting framework.

I've been able to integrate the framework into my program, by looking at how an example program was created. The author includes the following code inside the sample program:


-(NSDictionary *)clusterCoordinatesForPlot:(id)plot andDataClusterIndex:(unsigned)entryIndex {
float x, y;


    srand( entryIndex * 100000 );

    x = 100.0 * entryIndex / 9.0;

    if ( [[plot identifier] isEqual:@"ChartLinePlot"] ) {
        y = 50.0 + 50.0 * rand() /  (float)RAND_MAX;
    }
    else if ( [[plot identifier] isEqual:@"ChartHistogramPlot"] ) {
        y = 20.0 + 20.0 * rand() / (float)RAND_MAX;
    }

    return [NSDictionary dictionaryWithObjectsAndKeys:
        [NSNumber numberWithFloat:x],	NRTXClusterIdentifier,
        [NSNumber numberWithFloat:y], 	NRTYClusterIdentifier, nil];
}


This portion of the code generates the x/y coordinates of a plot. It stores them in a dictionary. I understand everything up to the return statement ---> without looking at the framework, how exactly is this generating multiple plot points? Or, does this need to be run for each data point?I can contact the author, but do not with to pester him with questions. I was hoping someone here had experience with Narrative, or could tell what this is doing. I *think* each time this (method?) is called, it generates a random y value, with fixed spacing for the x.



Thanks

John

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Duplicate Nib Windows (From: SD <email@hidden>)
 >Re: Duplicate Nib Windows (From: Thomas Davie <email@hidden>)
 >Help with code... (From: John <email@hidden>)

  • Prev by Date: Re: Cocoa Newbie book suggestions
  • Next by Date: Re: slow NSWorkspaceDidWakeNotification
  • Previous by thread: Help with code...
  • Next by thread: Re: Help with code...
  • Index(es):
    • Date
    • Thread