Help with code...
Help with code...
- Subject: Help with code...
- From: John <email@hidden>
- Date: Wed, 16 Mar 2005 21:21:53 -0500
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