Creating a Graph
In AIM 4.2 or later, you can use the AIM Graph Plot package to add a graph to a menu page. The graph is defined by a user-specified real array and string array that have the same name. This name is specified in the parameters for a graph display menu item.
Internally, a third array keeps track of the display state and intermediate values. It is a three-dimensional array that has the same name as the other two.
For example, if the user-specified name is "graph", the display is defined by the global arrays graph[] and $graph[]. These arrays may be setup to default values by mu.graph.setup(). The hidden internal data array is graph[,,].
The data for a graph is contained in a second user-specified two-dimensional array. The name of this array is also specified in the parameters for a graph display menu item. The data for this array is in the following format (the array name can be user-specified):
Array Element
Interpretation
data[0,0] Contains the number of X values to be plotted.
data[0,1]
Contains the first X value.
data[0,n]
Contains the nth X value. The maximum n value is data[0,0]
data[1,0]
Contains the number of Y values to be plotted.
data[1,1]
Contains the first Y value.
data[1,n]
Contains the nth Y value. The maximum n value is data[1,0]
data[1,*]
is only used if the mu.df.fl.y1 flag is set.
data[2,*]
Contains the data for a 2nd Y plot. It is only used if the mu.df.fl.y2 flag is set.
... data[6,*]
Contains the data for a 6th Y plot. It is only used if the mu.df.fl.y6 flag is set.
To display (and update) a graph on an AIM menu:
To create the panel, open the menu page where the panel will display. Then, select:
Utilities -> Edit Menu -> New -> Static Panel
Note: See Creating Static Items for details.
Click graph to configure the graph data in the graph definition box:
Enter the name of a V+ array that contains the graph description.
Enter the name of a V+ array that will contain the graph data.
If you want to update the graph while the menu page is displayed, click Auto Refresh.
Call mu.graph.setup() to setup default graph definition array. For details, see mu.graph.setup()
Change the elements of the definition array to override the defaults. See user.graph.rtn for details.
Define the data in the data array. See user.graph.rtn for details.
Somewhere during initialization, define the definition array and set the data[*,0] values to zero. Then, never set [x,0] to be greater than the number of valid data elements in the array.
Fill the data[,] arrays with data.
Update the data[*,0] elements to be the proper values.
Call mu.graph.redraw() from wherever the data[,] arrays are set. Otherwise, you need to wait to display the page or force a redraw some other way.
V+ Graph Routines