Graph Components

There are several graph component objects that can be added to the parameter of a Graph object to control how the graph looks. The components include the Equation and Data components that are used to display data on a graph and several components that allow you to control how the graph, axes, labels, and other parts of the graph look.

To add a graph to your document you need to first add a reference to the Graph.eql library. Once that reference has been added, a graph always starts with the Graph object in the Graph namespace. This objects is a one parameter object that can have zero or more components in it that define how the graph will look.

The component objects of a graph include:

Equation - has two parameters, the first is the equation to be graphed. The equation must have the form f(x) = (expression involving x). The second parameter contains any properties for this equation. The allow properties include
Property name Description
Data spacing Used with the Data min and max property to determines the number of points on the graph. If the minimum is set to zero and the maximum to 10, then a data spacing of 1 will result in 11 points. A data spacing of 0.1 will result in 101 points.
Data min and max The minimum and maximum values for X that will be included in the graph of the equation.
Color The color of the line and markers (if any) that are plotted on the graph
Label The text that will be shown in the legend for this equation if a legend is included on the graph.
Line width The line width (in pixels) of the line for this equation.
Line style The line style for the line plotted for this equation.
Marker shape The marker shape for this equation. Default is none. Options include open circle, diamond and square, fill circle, diamond and square and triangle up and down.
Marker size The size of the markers (in pixels) for this equation. Default is 5 pixels.

Data - has two parameters, the first is the list of points that will be graphed. The second parameter contains any properties for this data. The allowed properties include:

Property name Description
Color The color of the line and markers (if any) that are plotted on the graph
Label The text that will be shown in the legend for this data if a legend is included on the graph.
Line width The line width (in pixels) of the line for this data.
Line style The line style for the line plotted for this data.
Marker shape The marker shape for this data. Default is none. Options include open circle, diamond and square, fill circle, diamond and square and triangle up and down.
Marker size The size of the markers (in pixels) for this data. Default is 5 pixels.

Width - has one parameter, the width of the graph in pixels. If this object is not included in the graph, a default of 600 pixels in used

Height - has one parameter, the height of the graph in pixels. If this object is not included in the graph a default height of 2/3 of the width is used.

Title - has two parameters, the first parameter is a Text object containing the string that will be used as the title. The second parameter contains any properties for the title. The allowed properties include:

Property name Description
Color The color of the title text. Default is black.
Font name The font used for the title text. Default is Arial
Font size The font size (in points) used the title text. Default is 12 points.

XAxisLabel and YAxisLabel - the labels are two parameter objects. The first parameter is the text for the label, the second parameter contains any properties for the label. The allowed properties include:

Property name Description
Color The color of the axis label text. Default is black.
Font name The font used for the axis label text. Default is Arial
Font size The font size (in points) used the axis label text. Default is 12 points.

Legend - the Legend is a one parameter object. The parameter contains any properties for the legend. The allowed properties include:

Property name Description
Color The color of the frame of the legend.
Font name The font used for the axis label text.
Font size The font size (in points) used the axis label text. Default is 12 points.

Layout - the Layout controls the positioning of the graph region inside the image and the positioning of the X and Y axis labels. The Layout is a one parameter object, the parameter contains any properties of the layout. The allowed properties are:

Property name Description
Padding The padding used around the region of the graph that contains data
Label X offset The distance between the edge of the graph and the X axis label (in pixels)
Label Y offset The distance between the edge of the graph and the Y axis label (in pixels)

Grid - the Grid object controls the spacing, color and line style of the grid in the graph region. Note that the spacing of the grid also controls where the major ticks are on the X and Y axes. The allowed properties are:

Property name Description
Color The color of the lines that make up the grid
Spacing X The spacing of the lines on the X axis. Note that this also sets the positioning of the major ticks on the X axis.
Spacing Y The spacing of the lines on the Y axis. Note that this also sets the positioning of the major ticks on the Y axis.
Enable horizontal Enables or disables the horizontal lines of the grid.
Enable vertical Enables or disables the vertical lines of the grid.
Line width The line width of the lines of the grid.
Line style The line style of the lines of the grid.

All of these objects are in the Graph namespace and are defined in the Graph.eql library.

Example graphs are in the GraphAndImageExamples.equ document in the Documents location.