XGraphclass provides an interface for the
xgraphprogram for plotting data on an X window system display. The modified
xgraphprogram provided with the Ptolemy distribution should be used, not the contributed version from the X11R5 tape. The constructor for
XGraphdoes not completely initialize the object; initialization is completed by the
void initialize(Block* parent, int noGraphs,The
const char* options, const char* title,
const char* saveFile = 0, int ignore = 0);
parentargument is the name of a
Blockthat is associated with the
Blockis used in
Error::abortRunmessages to report errors.
noGraphsspecifies the number of data sets that the graph will contain. Each data set is a separate stream and is plotted in a different color (a different line style for B/W displays).
optionsis a series of command line options that will be passed unmodified to the
xgraphprogram. It is subject to expansion by the Unix shell.
titleis the title for the graph; it can contain special characters (it is
notsubjected to expansion by the Unix shell).
saveFileis the name of a file to save the graph data into, in ASCII form. If it is not given, the data are not saved, and a faster binary format is used.
ignorespecifies the number of initial points to ignore from each data set.
void setIgnore(int n);Reset the "ignore" parameter to
void addPoint(float y);Add a single point to the first data set whose X value is automatically generated (0, 1, 2, 3... on successive calls) and whose Y value is
void addPoint(float x,float y);Add the point (
y)to the first data set.
void addPoint(int dataSet,float x,float y);Add the point (
)to the data set indicated by
dataSet.Data sets start with 1.
void newTrace(int dataSet = 1);Start a new trace for the nth dataset. This means that there will be no connecting line between the last point plotted and the next point plotted.
void terminate();This function flushes the data out to disk, closes the files, and invokes the
xgraphprogram. If the destructor is called before
terminate,it will close and delete the temporary files.