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.
Methods
Phase: Creating
+
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 setFileOutput: (BOOL)
fileOutputFlag Convenience method for creating a non-graphical EZGraph, the filename is generated from the sequence name
+
create: (id <Zone>)
aZone setFileName: (const char *)
aFileName Convenience method for creating a non-graphical EZGraph, in this case, the filename is explicitly set by the user
-
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.
-
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.
-
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.
-
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.)
-
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.)
-
setColors: (const char * const *)
colors count: (unsigned)
nc Set a custom vector of colors for the graph lines
Phase: Using
-
setRangesXMin: (double)
xmin Max: (double)
xmax Fix the range of X values on the graph between some range.
-
setRangesYMin: (double)
ymin Max: (double)
ymax Fix the range of Y values on the graph between some range.
-
setScaleModeX: (BOOL)
xs Y: (BOOL)
ys Whether to autoscale every timestep or instead to jump scale.
- (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.)
- (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 <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 (as opposed to a single object as in createSequence) 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 (as opposed to a single object as in createSequence) 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 (as opposed to a single object as in createSequence) 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 (as opposed to a single object as in createSequence) The method returns an id which can be used later with -dropSequence.
- (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 (as opposed to a single object as in createSequence) The method returns an id which can be used later with -dropSequence.
-
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.
- (const char *)
getTitle Return the title string.
- (const char *)
getFileName Return the file name prefix string.
-
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.
-
outputGraph the outputGraph method updates the graph with the data obtained from the last call to -update. If setGraphics==0, nothing is done.
-
outputToFile the outputToFile method sends to the disk file data obtained from the last call to -update. If setFileOutput==0, nothing is done.
-
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.