Vanguard Software
Forecasting & Planning Solutions
Home Products Solutions Services Customers Partners Company
 
Applying science to business management

contents.gifindex.gifprev1.gifnext1.gif

graph

Format: graph( data, x, style, title, xlabel, ylabel, legend )

Arguments: [real] data Y-data points

[any] x Optional x-data points; default = 1..n

[int] style Optional style declaration for graph of the corresponding data set; default = GS_DEFSTYLE

(text) title Optional graph title; default = null

(text) xlabel Optional x-axis label; default = null

(text) ylabel Optional y-axis label; default = null

[text] legend Optional label for each y-data set; default = null

Returns: null

Description: Graph can be used to produce a graphic representation of a set of data points. Any number of traces can be displayed on the same graph by specifying more than one set of y-data points. Also, the style of each trace can be declared independently; so, you can mix line plots, scatter plots, etc., on the same graph.

The x- and y-data points are specified in parallel lists. The first element in the x-list and the first element in the y-list together make up one data point. Likewise, the second elements in each list together make up the second point, and so on. If more than one data trace is to be graphed, compose the data argument as a list of lists; e.g., [y1,y2,y3] where each yn is a list of data for one trace. If the x argument contains only one list, these values are used for all data traces. Otherwise, the x argument must contain a list of x-value for each trace; e.g., [x1,x2,x3].

The type of graph created (line, bar, scatter, etc.) is declared by the style argument. This argument is an integer or list of integers that declare the style used to plot the corresponding data set. That is, the first number in the style list defines how the y1-data set is plotted, the second number in the style list defines the y2 set and so on. If there are fewer style elements than there are y-data sets, the last style is repeated for all remaining sets. This means that if only one style number is supplied, it defines the style for all data sets. The first style element defines not only the style of the first data set, but also defines several attributes about the entire graph such as turning the grid on or off.

The style arguments for the table, graph, and graph3 primitives are all constructed by adding together a series of pre-defined constants. These constants turn particular attributes on or off. For example, the default graph style, GS_DEFSTYLE, is defined as GS_LINE + GS_GRID + GS_AXES + GS_COLOR. Each of these style constants and all others that can be used are described in the following table:

Global Graph Styles:

GS_LOGX Use a logarithmic x-axis scale; all x-values must be greater than zero.

GS_LOGY Use a logarithmic y-axis scale; all y-values must be greater than zero.

GS_ZERO Include zero in the y-axis. The y-axis range is normally selected automatically to include all y-values. This option forces zero to be included in the y-range.

GS_BOX Draw a bounding box around the graph. This and the GS_GRID style force axes to be placed at the left and bottom edges of the graph rather than in the graph interior.

GS_AXES Draw x- and y-axes. Same as GS_AXISX + GS_AXISY.

GS_AXISX Draw x-axis.

GS_AXISY Draw y-axis.

GS_GRID Draw a grid. Same as GS_GRIDX + GS_GRIDY. This and the GS_BOX style force axes to be placed at the left and bottom edges of the graph rather than in the graph interior.

GS_GRIDX Draw a grid in the x-direction.

GS_GRIDY Draw a grid in the y-direction.

GS_ASPECT Use the same scale factor to adjust both the x- and y-axes. Normally, axes are scaled to fit the window or page on which the graph is drawn. Selecting this style forces one unit in the x-direction to be exactly the same physical length as one unit in the y-direction.

GS_COLOR Use color to distinguish different traces on the graph. Normally, hatch patterns or dotted lines are used.

GS_AUTO Automatically reconstruct the graph if any nodes in the system change. Without this option you can explicitly update a graph by clicking the Recalculate button.

GS_STACKED Stack successive data sets and plot the sums. The first trace is based on the y1-data set only. The second trace is based on the sum of the y1- and y2-sets; and so on. The final trace represents is the sum of all y-data sets.

Individual Trace Styles:

GS_AREA Shade the area beneath a line graph

GS_LINE Connect points with a straight line

GS_POINT Plot the data points

GS_BAR Create a bar graph. With bar graphs, the x-axis is not drawn to scale, but instead, each x-point is allocated the same space across the x-axis

GS_DELTA Draw a vertical arrows whose height represents magnitude in the y-direction

GS_VALUE Display the y-value above each point

Examples: x:=[1,2,3,4]

y1:=[3,7,12,15]

y2:=[9,10,10,12]

graph([y1,y2],x,GS_BAR+GS_AXES,"Sales","Year","Millions",

      ["ABC","XYZ"])

dph00470.gif

See Also: graph3, table

  Demand Planning  |  Financial Forecasting
Forecasting Software  |  Strategic Planning Software  |  Decision Tree Software
Decision Support Software  |  Expert System Software  |  Online Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2011 Vanguard Software Corporation
Print this page   Email this page to a friend