Documentation Set for Swarm 2.2
Prev | Reference IX. Analysis Library | Next

# EZGraph

## Name

EZGraph -- A class for easily create graphs.

## Description

This class allows the user to easily create graphs of various quantities in the model s/he is investigating. The user first creates the EZGraph, and then creates "Sequences"; (lines) which will appear in the graph. The sequences are generated based on data provided by a single object or a collection of target objects, in reponse to a specified selector. One of the features of the EZGraph is that it will automatically generate average, total, min, max and count sequences without the user having to mess with Averagers amd other low-level classes.

## Protocols adopted by EZGraph

SwarmObject GUIComposite CREATABLE

## Methods

### Phase: Creating

- - setColors: (const char * const *)colors count: (unsigned)count
  Set a custom vector of colors for the graph lines

- - setAxisLabelsX: (const char *)xl Y: (const char *)yl
  The setAxisLabels:X:Y method sets the horizontal and vertical labels on the histogram in the graphical version of EZGraph. (Only relevant if the state of setGraphics is set to 1.)

- - setTitle: (const char *)aTitle
  The setTitle method uses a title string to label a graph window in the graphical version of EZGraph. The label appears at the top of the graph window. (Only relevant if the state of setGraphics is set to 1.)

- - setFileName: (const char *)aFileName
  The setFileName method sets the name used for disk file data output. (Only relevant if the state of setFileOutput is set to 1.) The name set here is prepended to the names of each data sequence. If file name is NOT set, with this method, the file name for the sequence will default simply to the sequence name.

- - setHDF5Container: (id <HDF5>)hdf5Container
  The setHDF5Container: method allows one to combine multiple graphs with multiple sequences in a single HDF5 file.

- - setFileOutput: (BOOL)state
  The setFileOutput method sets the state of file I/O. Set the state to 1 if data for the sequences is to be sent to a file. The default state is 0 meaning that by default no file I/O is carried out by the EZGraph class.

- - setGraphics: (BOOL)state
  The setGraphics method sets the state of the display. Set the state to 0 if a graphical display of the graph is not required. The default state is 1 meaning that by default the data appears graphically in a window.

- + create: (id <Zone>)aZone setHDF5Container: (id <HDF5>)hdf5Container setPrefix: (const char *)prefix
  Convenience method for creating a non-graphical EZGraph, inside of a HDF5 container.

- + create: (id <Zone>)aZone setFileName: (const char *)filename
  Convenience method for creating a non-graphical EZGraph, in this case, the filename is explicitly set by the user

- + create: (id <Zone>)aZone setFileOutput: (BOOL)fileOutputFlag
  Convenience method for creating a non-graphical EZGraph, the filename is generated from the sequence name

- + create: (id <Zone>)aZone setTitle: (const char *)aTitle setAxisLabelsX: (const char *)xl Y: (const char *)yl setWindowGeometryRecordName: (const char *)windowGeometryRecordName
  Convenience method for creating `graphical' EZGraph instances

- + create: (id <Zone>)aZone setTitle: (const char *)aTitle setAxisLabelsX: (const char *)xl Y: (const char *)yl setWindowGeometryRecordName: (const char *)windowGeometryRecordName setSaveSizeFlag: (BOOL)saveSizeFlag

### Phase: Using

- - (void)step
  The step method combines -update, -outputGraph and -outputToFile. If you want file output to occur at a different frequency than graph updates, schedule those methods separately instead of using -step.

- - (void)outputToFile
  the outputToFile method sends to the disk file data obtained from the last call to -update. If setFileOutput==0, nothing is done.

- - (void)outputGraph
  the outputGraph method updates the graph with the data obtained from the last call to -update. If setGraphics==0, nothing is done.

- - (void)update
  the -update method causes the underlying sequences to get the next set of data values. If a sequence has a single object attached rather than an Averager, nothing is done.

- - (const char *)getFileName
  Return the file name prefix string.

- - (const char *)getTitle
  Return the title string.

- - dropSequence: aSeq
  The dropSequence method drops a data sequence (line on the graph), e.g. because the source object no longer exists. The aSeq parameter should be an id previously returned by one of the createSequence: methods. If the drop is successful, the method returns aSeq, otherwise it returns nil.

- - (id <EZAverageSequence>)createCountSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createCountSequence method takes a collection of objects and generates a sequence based on the count over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createMaxSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createMaxSequence method takes a collection of objects and generates a sequence based on the maximums over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createMinSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createMinSequence method takes a collection of objects and generates a sequence based on the minimum over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createTotalSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createTotalSequence method takes a collection of objects and generates a sequence based on the sum over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createMovingStdDevSequence: (const char *)aName withFeedFrom: aTarget andSelector: (SEL)aSel andWidth: (unsigned)width
  The createMovingStdDevSequence method takes a single object, or collection of objects and generates a sequence based on the variance over the responses of the entire object set for a given width chunk of samples. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createStdDevSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createStdDevSequence method takes a collection of objects and generates a sequence based on the sample variance over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createMovingVarianceSequence: (const char *)aName withFeedFrom: aTarget andSelector: (SEL)aSel andWidth: (unsigned)width
  The createMovingVarianceSequence method takes a single object, or collection of objects and generates a sequence based on the variance over the responses of the entire object set for a given width chunk of samples. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createVarianceSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createVarianceSequence method takes a collection of objects and generates a sequence based on the sample variance over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createMovingAverageSequence: (const char *)aName withFeedFrom: aTarget andSelector: (SEL)aSel andWidth: (unsigned)width
  The createMovingAverageSequence method takes a single object, or collection of objects and generates a sequence based on the average over the responses of the entire object set for a given width chunk of samples. The method returns an id which can be used later with -dropSequence.

- - (id <EZAverageSequence>)createAverageSequence: (const char *)aName withFeedFrom: aCollection andSelector: (SEL)aSel
  The createAverageSequence method takes a collection of objects and generates a sequence based on the average over the responses of the entire object set. The method returns an id which can be used later with -dropSequence.

- - (id <EZSequence>)createSequence: (const char *)aName withFeedFrom: anObj andSelector: (SEL)aSel
  The createSequence method creates a sequence in the EZGraph based on the return value provided by the object anObj when sent the selector aSel. If file I/O is enabled, then the data will be sent to a file with the name aName, otherwise the aName argument is simply used as the legend for the graph element generated by EZGraph. The method returns an id which can be used later with -dropSequence.

- - (id <Graph>)getGraph
  The getGraph method lets the user access the graph generated internally by the EZGraph. (Only relevant if the state of setGraphics is set to 1.)

- - (void)setScaleModeX: (BOOL)xs Y: (BOOL)ys
  Whether to autoscale every timestep or instead to jump scale.

- - (void)setRangesYMin: (double)ymin Max: (double)ymax
  Fix the range of Y values on the graph between some range.

- - (void)setRangesXMin: (double)xmin Max: (double)xmax
  Fix the range of X values on the graph between some range.

Prev | Home | Next
EZDistribution | Up | EZSequence