TGraphWindow
Written by: Mark E. Burkard
Email: mebd at uhura dot cc dot rochester dot edu
Last updated: 19 September 1998
Copyright (C) 1998 by Mark E. Burkard
Overview
This is a TWindow-derived class for OWL 5.0 (Windows class library for
Borland C++ 5.02). The purpose is to make a window containing a graph of
Y vs X variables as provided by the calling function. The program connects
the points by lines. The user can select line color and thickness and can
print the plot or copy it to the clipboard. Lines can be selected or deselected
for plotting by the user.
Conditions For Use
The code may be freely used and modified. However, the user of the code
assumes all liability. I will not be held liable for use or misuse of this
code.
Usage
The constructor is as follows:
TGraphWindow(TFrameWindow* frame, TWindow* parent, char* titl, int nyg,
int* ny, char* xName, char** ygNames, char*** yNames,
char* xUnits, char** yUnits, TArray<double>* x,
TArray<double>*** y, bool delArrays);
where:
- frame is a pointer to the framewindow that will hold the TGraphWindow,
parent is the parent window, if any
- titl is a pointer to the graph title,
- nyg is the number of different y "groups" of variables that will appear in the
graph(most likely 1, but more are possible; 2 different y types are shown in demo)
- ny is a pointer to an array of integers; the array has nyg elements. This gives
the number of lines plotted per group
- xName is the name appearing on the x axis, excluding units.
- ygNames are the names appearing on each y axis (each group has its own y axis with
its own label).
- yNames contains information about each line plotted on the graph. The first index
corresponds to the group number (i.e. which axis it belongs to). The second index
identifies which line in the group (the number of lines in each group were given by
the ny array).
- xUnits contains the name of the x units.
- yUnits contains the name of y units for each group.
and finally, the data:
- x is a pointer to the TArray containing the x values
- y is a triple pointer to TArrays containing y values for each series; the first index
provides the group number and the second index is the line (or series) within the group.
Example
The TGraph.ide contains a program that displays an example graph. The
graphtest.cpp file contains the example call to TGraphWindow.
GOOD LUCK!