Table of Contents
_________________________________________________________________
graph - 2D graph for plotting x and y coordinate data.
graph pathName ?option value?...
_________________________________________________________________
The graph command creates a graph for plotting twodimensional data (x,y coordinates). It has many configurable components: coordinate axes, elements, legend, grid lines, cross hairs, etc. They allow you to customize the look and feel of the graph.
The graph command creates a new window for plotting twodimensional data (x,y coordinates). Data points are plotted in a box displayed in the center of the new window. This is the plotting area. The graph's coordinate axes are displayed in the margins around the plotting area. By default, the legend is displayed in the right margin. The title is displayed in top margin.
A graph has several components: coordinate axes, elements, legend, grid, cross hairs, postscript, and markers. Each component can be queried and configured.
- Axes
- The graph widget has four coordinate axes: two x-coordinate and two y-coordinate axes. The axes control what region of data is displayed and how the data is scaled. Each axis consists of the axis line, title, major and minor ticks, and tick labels. Tick labels display the value of each major tick.
Elements An element represents a set of data to be plotted. It contains an x and y vector of values representing the data coordinates. Elements can be plotted with a symbol at each data point and lines connecting the points. The appearance of the element, such as its symbol, line width, and color is configurable.
- Legend
- The legend displays the name and symbol of each data element. The legend can be displayed in any margin or in the plotting area itself.
Markers Markers come in various forms: text strings, bitmaps, connected line segments, polygons, or embedded widgets (windows). They can be used to annotate or highlight areas of the graph. For example, you could use a polygon marker to fill an area under a curve, or a text marker to label a particular data point.
Postscript
The graph widget can generate encapsulated PostScript output. There are several options to configure the PostScript output.
Cross hairs
The graph widget has built-in cross hairs. They can be turned on and off. They are used to finely control the movement of the pointer in the graph.
Grid lines
Grid lines extend from the major and minor ticks of each axis horizontally or vertically across the plotting area.
The graph command creates a new graph.
# Create a new graph. Plotting area is black. graph .graph -plotbackground black
A new Tcl command .graph is created. This command can be used to perform various operations to query and modify the graph. For example, to change the title of the graph to "My Plot", you use the new command and the configure operation.
# Change the title of the graph. .graph configure -title "My Plot"
To add data elements to the graph, you use the command and the element operation.
# Create a new element named "line1" .graph element create line1 \
-xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \ -ydata { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 166.60 175.38 }
The element's x and y coordinates are specified using lists of numbers. Alternately, BLT vectors could be used to hold the x and y coordinates.
# Create two vectors and add them to the graph. vector xVector yVector
xVector set { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } yVector set { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 166.60 175.38 }
.graph element create line1 -xdata xVector -ydata yVector
The advantage of using vectors is that when you modify one, the graph is automatically redrawn to reflect the new values.
# Change the x and y coordinates of the first point. set xVector(0) 0.18
set yVector(0) 25.18
An element named line1 is now created in .graph. By default, the element's label in the legend will be also line1. You can change the label, or specify no legend entry, again using the element's configure operation.
# Don't display "line1" in the legend. .graph element configure line1 -label ""
You can configure more than just the element's label. An element has many attributes such as symbol type and size, dashed or solid lines, colors, line width, etc.
- .graph element configure line1 -symbol square -color red \
- -dashes { 2 4 2 } -linewidth 2 -pixels 2c
There are four coordinate axes in the graph widget. Their names are x, x2, y, and y2. By default, elements are mapped onto the standard (x and y) axes. This can be changed with the -mapx and -mapy options.
# Map "line1" on the alternate y axis "y2". .graph element configure line1 -mapy y2
Axes can be configured in many ways too. Each axis has an operation associated with it: xaxis, x2axis, yaxis, and y2axis. For example, you change the scale of the y-axis from linear to log using the yaxis operation.
# Y-axis is log scale.
.graph yaxis configure -logscale yes
One of the most important ways axes are used is to zoom in on a particular data region. Zooming is done by simply specifying new axis limits using the -min and -max configuration options.
# Zoom in
.graph xaxis configure -min 1.0 -max 1.5 .graph yaxis configure -min 12.0 -max 55.15
To zoom interactively, you link the configure operations with some user interaction (such as pressing the mouse button), using the bind command. To convert between screen and graph coordinates, use the invtransform operation.
# Click the button to set a new minimum bind .graph <B1> {
%W xaxis configure -min [%W xaxis invtransform %x] %W yaxis configure -min [%W yaxis invtransform %y] }
By default, the limits of the axis are determined from data values. To reset back to the default limits, set the -min and -max options to the empty value.
# Reset the axes to autoscale again. .graph xaxis configure -min {} -max {} .graph yaxis configure -min {} -max {}
By default, the legend is displayed in the right margin. You can change this any many other legend configuration options using the legend operation.
# Configure the legend font, color, and relief .graph legend configure -position left -relief raised \ -font fixed -fg blue
The prevent the legend from being displayed, turn off the -mapped option.
# Don't display the legend.
.graph legend configure -mapped no
The graph widget has simple drawing procedures called markers. They can be used to highlight or annotate data in the graph. The types of markers available are bitmaps, polygons, lines, or windows. Markers can be used, for example, to mark or brush points. In this example, is a text marker which labels the data first point. Markers are created using the marker operation.
# Create a label for the first data point of "line1". .graph marker create text -name first_marker -coords { 0.2 26.18 } \ -text "start" -anchor se -xoffset -10 -yoffset -10
This creates a text marker named first_marker. It will display the text "start" near the coordinates of the first data point. The -anchor, -xoffset, and -yoffset options are used to display the marker above and to the left of the data point, so that the actual data point isn't covered by the marker. By default, markers are drawn last, on top of data. You can change this with the -under option.
# Draw the label before elements are drawn. .graph marker configure first_marker -under yes
You can add cross hairs or grid lines using the crosshairs and grid operations.
# Display both cross hairs and grid lines. .graph crosshairs configure -mapped yes -color red .graph grid configure -mapped yes -dashes { 2 2 }
Finally, to get hardcopy of the graph, use the postscript operation.
# Print the graph into file "file.ps" .graph postscript output file.ps -maxpect yes -decorations no
This generates a file file.ps containing the encapsulated PostScript of the graph. The option -maxpect says to scale the graph to the size of the page. Turning off the -decorations option indicates that no borders or color backgrounds should be displayed (i.e. the background of the margins, legend, and plotting area will be white).
graph pathName ?option value?...
The graph command creates a new window pathName and makes it into a graph widget. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist. Additional options may may be specified on the command line or in the option database to configure aspects of the graph such as its colors and font. See the configure operation below for the exact details as to what option and value pairs are valid.
If successful, graph returns pathName. It also creates a new Tcl command pathName. This command may be used to invoke various operations to query or modify the graph widget. It has the general form:
pathName operation ?arg?...
Both operation and its arguments determine the exact behavior of the command. The operations available for the graph widget are described in the following section.
pathName cget option
Returns the current value of the graph configuration option given by option. Option may be any one of the options described below for the configure operation.
pathName configure ?option value?...
Queries or modifies the configuration options of the graph. If option isn't specified, a list describing all of the current options for pathName is returned. If option is specified, but not value, then a list describing option is returned. If one or more option and value pairs are specified, then for each pair, the graph option option is set to value. The following options are valid for the graph.
- -background color
- Sets the background color of the graph. This includes the margins and legend, but not the plotting area.
- -borderwidth pixels
- Sets the width of the 3-D border around the outside of the graph. The -relief option determines if the border is to be drawn. The default is 2.
- -bottommargin pixels
- Specifies the size of the margin below the x-coordinate axis. If pixels is 0, the size of the margin is selected automatically. The default is 0.
- -bufferelements boolean
- Indicates if to use an internal pixmap to buffer the display of data elements. If boolean is true, data elements are drawn to an internal pixmap. This option is especially useful when the graph is redrawn frequently while the remains data unchanged (for example, moving a marker across the plot). See the SPEED TIPS section. The default is 1.
- -cursor cursor
- Specifies the cursor to display in the graph window. The default cursor is crosshair.
- -font fontName
- Specifies the font of the graph title. The default is *-Helvetica-Bold-RNormal-*-18-180-*.
- -halo pixels
- Specifies a maximum distance to consider when searching for the closest data point (see the element's closest operation below). Data points outside of pixels are ignored. The default is 0.5i.
- -height pixels
- Specifies the requested height of the graph window. The default is 4i.
- -histmode boolean
- If boolean is true, bars are drawn from the minimum value of the y axis to the actual y value, otherwise they are drawn from the base line of the graph to the actual y value. The base line is either 0 (if -logscale is false) or 1 (because in this mode, all y values are log10-transformed, and log10(1) is 0). The default is 0. Note that this option only applies to barchart elements (see the element bar command in the ELEMENTS section for details).
- -invertxy boolean
- Indicates if the placement x and y axes should be inverted. If boolean is true, the x and y axes are swapped. The default is 0.
- -justify justify
- Specifies how the title should be justified. This matters only when the title contains more than one line of text. Justify must be left, right, or center. The default is center.
- -leftmargin pixels
- Sets the size of the margin from the left edge of the window to the the y-coordinate axis. If pixels is 0, the size is calculated automatically. The default is 0.
- -plotbackground color
- Specifies the background color of the plotting area. The default is white.
- -plotborderwidth pixels
- Sets the width of the 3-D border around the the plotting area. The -plotrelief option determines if a border is drawn. The default is 2.
- -plotrelief relief
- Specifies the 3-D effect for the plotting area. Relief indicates how the interior of the plotting area should appear relative to rest of the graph; for example, raised means the plot should appear to protrude from the graph, relative to the surface of the graph. The default is sunken.
- -rightmargin pixels
- Sets the size of margin from the plotting area to the right edge of the window. By default, the legend is displayed in this margin. If pixels is than 1, the margin size is selected automatically.
- -takefocus focus
- Provides information used when moving the focus from window to window via keyboard traversal (e.g., Tab and Shift-Tab). If focus is 0, this means that this window should be skipped entirely during keyboard traversal. 1 means that the this window should always receive the input focus. An empty value means that the traversal scripts make the decision about whether or not to focus on the window. The default is "".
- -tile image
- Specifies a tiled background for the graph. If image isn't "", the background of the graph is tiled using image. Otherwise, the normal background color is displayed (see the -background option). Image must be an image created using the Tk image command. The default is "".
- -title text
- Sets the title of the graph to text. If text is "", no title will be displayed.
- -topmargin pixels
- Specifies the size of the margin above the x2 axis. If pixels is 0, the margin size is calculated automatically.
- -width pixels
- Specifies the requested width of the graph window. The default is 5i.
pathName crosshairs operation ?arg?
See the CROSS HAIRS section.
pathName element operation ?arg?...
See the ELEMENTS section.
pathName extents item
Returns the size of a particular item in the graph. Item must be either leftmargin, rightmargin, topmargin, bottommargin, plotwidth, or plotheight.
pathName grid operation ?arg?...
See the GRID LINES section.
pathName invtransform winX winY
Performs a inverse coordinate transformation, mapping window coordinates back to graph coordinates, using the standard x and y axes. Returns a list of containing the x and y graph coordinates.
pathName legend operation ?arg?...
See the LEGEND section.
pathName marker operation ?arg?...
See the MARKERS section.
pathName postscript operation ?arg?...
See the POSTSCRIPT section.
pathName transform x y
Performs a coordinate transformation, mapping graph coordinates to window coordinates, using the standard x and y axes. Returns a list containing the x and y window coordinates.
pathName xaxis operation ?arg?...
pathName x2axis operation ?arg?...
pathName yaxis operation ?arg?...
pathName y2axis operation ?arg?...
See the AXES section.
The graph has four coordinate axes: two x-coordinate axes (x and x2) and two y-coordinate axes (y, and y2). The xaxis is located in the bottom margin, the y-axis in the left margin, the x2-axis in the top margin, and the y2-axis in the right margin.
An axis consists of the axis line, title, major and minor ticks, and tick labels. Major ticks are drawn at uniform intervals along the axis. Each tick is labeled with its coordinate value. Minor ticks are drawn at uniform intervals within major ticks.
The range of the axis controls what region of data is plotted. Data points outside of the minimum and maximum limits of the axis are not plotted. By default, the minimum and maximum limits are determined from the data, but you can reset either limit.
When data elements and markers are plotted, they are mapped onto one of the x and y axes. By default, they are mapped onto the standard axes x and y. Both elements and markers have -mapx and -mapy options to change this.
You can configure axes in many ways. The axis scale can be linear or logarithmic. The values along the axis can either monotonically increase or decrease. If you need custom tick labels, you can specify a Tcl procedure to format the label any way you wish. You can control how ticks are displayed, by changing the major tick interval or the number of minor ticks. You can define non-uniform tick intervals, such as for time-series plots.
The following operations are available for axes. The axis argument must be xaxis, x2axis, yaxis, or y2axis.
pathName axis cget option
Returns the current value of the option given by option for axis. Option may be any one of the options described below for the axis configure operation.
pathName axis configure ?option value?... Queries or modifies the configuration options of axis. If option isn't specified, a list describing all of the current options for axis is returned. If option is specified, but not value, then a list describing option is returned. If one or more option and value pairs are specified, then for each pair, the axis option option is set to value. The following options are valid for axes.
- -color color
- Sets the color of the axis and tick labels. The default is black.
- -command prefix
- Specifies a Tcl command to be invoked when formatting the axis tick labels. Prefix is a string containing the name of a Tcl proc and any extra arguments for the procedure. This command is invoked for each major tick on the axis. Two additional arguments are passed to the procedure: the pathname of the graph widget and the current the numeric value of the tick. The procedure returns the formatted tick label. If "" is returned, no label will appear next to the tick. You can get the standard tick labels again by setting prefix to "". The default is "".
Please note that this procedure is invoked during the actual display of the graph. You may query the graph options. But do not reset configuration options, because this can have unexpected results.
- -descending boolean
- Indicates if the values along the axis are monotonically increasing or decreasing. If boolean is true, the axis values will be decreasing. The default is 0.
- -justify justify
- Specifies how the axis title should be justified. This matters only when the axis title contains more than one line of text. Justify must be left, right, or center. The default is center.
- -linewidth pixels
- Sets the width of the axis and tick lines. The default is 1 pixel.
- -logscale boolean
- Indicates if the scale of the axis is logarithmic or linear. If boolean is true, the axis is logarithmic. The default scale is linear.
- -loose boolean
- Indicates if the limits of the axis should fit the data points tightly, at the outermost data points, or loosely, at the outer tick intervals. This is relevant only when the axis limit is automatically calculated. If boolean is true, the axis range is "loose". The default is 0.
- -majorticks majorList
- Specifies where to display major axis ticks. You can use this option to display ticks at non-uniform intervals. MajorList is a list of axis coordinates indicating the location of major ticks. In this case, no minor ticks are displayed. If majorList is "", major ticks will be automatically computed. The default is "".
- -mapped boolean
- Indicates if the axis should be displayed. By default, the standard axes are displayed (x and y), but not the alternate (x2 and y2).
- -max value
- Sets the maximum limit of axis. Any data point greater than value is not displayed. If value is "", the maximum limit is calculated using the largest data value. The default is "".
- -min value
- Sets the minimum limit of axis. Any data point less than value is not displayed. If value is "", the minimum limit is calculated using the smallest data value. The default is "".
- -minorticks minorList
- Specifies where to display minor axis ticks. You can use this option to display minor ticks at non-uniform intervals. MinorList is a list of real values, ranging from 0.0 to 1.0, indicating the placement of a minor tick. No minor ticks are displayed if the -majortick option is also set. If minorList is "", minor ticks will be automatically computed. The default is "".
- -rotate theta
- Specifies the how many degrees to rotate the axis tick labels. Theta is a real value representing the number of degrees to rotate the tick labels. The default is 0.0 degrees.
- -showticks boolean
- Indicates if axis ticks should be displayed. If boolean is true, ticks are displayed. If false, only the axis line is displayed. The default is 1.
- -stepsize value
- Specifies the interval between major axis ticks. If value isn't a valid interval (must be less than the axis range), the request is ignored and the step size is automatically calculated.
- -subdivisions number
- Indicates how many minor axis ticks are to be displayed. For example, if number is two, only one minor tick is displayed. If number is one, no minor ticks are displayed. The default is 2.
- -tickfont fontName
- Specifies the font for axis tick labels. The default is *-Courier-Bold-R-Normal-*-100-*.
- -ticklength pixels
- Sets the length of major and minor ticks (minor ticks are half the length of major ticks). If pixels is less than zero, the axis will be inverted with ticks drawn pointing towards the plot. The default is 0.1i.
- -title text
- Sets the title of the axis. If text is "", no axis title will be displayed.
- -titlefont fontName
- Specifies the font for axis title. The default is *-Helvetica-Bold-RNormal-*-14-140-*.
Axis configuration options may be also be set by the option command. The resource names in the option database are prefixed by x, y, x2, or y2 while class names are prefixed by Axis.
option add *Graph.AxisColor blue option add *Graph.xLogScale true option add *Graph.x2LogScale false
pathName axis invtransform value
Performs the inverse transformation, changing the screen coordinate value to a graph coordinate. The value is mapped to axis. Returns the graph coordinate.
pathName axis limits
Returns a list of the minimum and maximum limits for axis. The order of the list is min max.
pathName axis transform value
Transforms the coordinate value to a screen coordinate by mapping the it to axis. Returns the transformed screen coordinate.
Cross hairs consist of two intersecting lines (one vertical and one horizontal) drawn completely across the plotting area. They are used to finely control movement of the pointer in the graph. Cross hairs differ from line markers in that they are implemented using XOR drawing primitives. This means that they can be quickly drawn and erased without redrawing the entire graph.
The following operations are available for cross hairs:
pathName crosshairs cget option
Returns the current value of the cross hairs configuration option given by option. Option may be any one of the options described below for the cross hairs configure operation.
pathName crosshairs configure ?option value?... Queries or modifies the configuration options of the cross hairs. If option isn't specified, a list describing all of the current options for the cross hairs is returned. If option is specified, but not value, then a list describing option is returned.
If one or more option and value pairs are specified, then for each pair, the cross hairs option option is set to value. The following options are available for cross hairs.
- -color color
- Sets the color of the cross hairs. The default is black.
- -dashes dashList
- Sets the dash style of the cross hairs. DashList is a list of up to 11 numbers which alternately represent the lengths of the dashes and gaps on the cross hair lines. Each number must be between 1 and 255. If dashList is "", the cross hairs will be solid lines.
- -linewidth pixels
- Set the width of the cross hair lines. The default is 1.
- -mapped boolean
- Indicates if cross hairs are drawn. If boolean is true, cross hairs are displayed. The default is 0.
- -position pos
- Specifies the screen position where the cross hairs intersect. Pos must be in the form "@x,y", where x and y are the window coordinates of the intersection.
Cross hairs configuration options may be also be set by the option command. The resource names in the option database are prefixed by xhairs, while class names are prefixed by Xhairs.
option add *Graph.xhairsLineWidth 2 option add *Graph.XhairsColor red
pathName crosshairs off
Turns of the cross hairs.
pathName crosshairs on
Turns on the display of the cross hairs on the graph.
pathName crosshairs toggle
Toggles the current state of the cross hairs, alternately mapping and unmapping the cross hairs.
A data element represents a set of data. It contains x and y vectors which are the coordinates of the data points. Elements can be displayed with a symbol at each data point and lines connecting the points. Elements also control the appearance of the data, such as the symbol type, line width, color etc.
When new data elements are created, they are automatically added to a list of displayed elements. The display list controls what elements are displayed and in what order.
The following operations are available for elements.
pathName element activate elemName ?index?... Specifies which data points of element elemName are to be drawn using active foreground and background colors. ElemName is the name of the element and index is a number representing the index of the data point. If no indices are present then all data points become active.
pathName element bar elemName ?option value?... Creates a new barchart element elemName in the graph. Element names must be unique, so an element elemName may not already exist. See the manual for barchart for details as to what option and value pairs are valid.
pathName element cget elemName option
Returns the current value of the element configuration option given by option. Option may be any of the options described below for the element configure operation.
pathName element closest varName x y ?option value?... ?elem- Name?...
Finds the data point closest to the window coordinates x and y in the element elemName. ElemName is the name of an element, which must be mapped. If no elements are specified, then all mapped elements are searched. If a data point within the threshold distance can be found, 1 is returned, and varName will be created as an array containing the five elements name (name of the closest element), index (the index of its closest point), dist (the distance between x,y and the closest point), x, and y (the x and y coordinates of the closest point). If no data point within the threshold distance can be found, 0 is returned and varName is created as an array with the single element name, which is set to an empty string. The following option-value pairs are available. -halo pixels
Specifies a threshold distance beyond which data points are ignored. Pixels is a valid screen distance, such as 2 or 1.2i. If this option isn't specified, then it defaults to the value of the graph's -halo option.
- -interpolate boolean
- Indicates that both the data points and interpolated points along the line segment formed should be considered. If boolean is true, the closest line segment will be selected instead of the closest point. If this option isn't specified, boolean defaults to 0.
pathName element configure elemName ?option value?... Queries or modifies the configuration options for elements. If option isn't specified, a list describing all of the current options for elemName is returned. If option is specified, but not value, then a list describing the option option is returned. If one or more option and value pairs are specified, then for each pair, the element option option is set to value. The following options are valid for elements.
- -activefill color
- Like the -fill option, but sets the interior color of symbols when drawing active data points (see the activate operation). If color is symbol will be transparent. If color is defcolor, then the color will be the same as the -activecolor option. The default is defcolor.
- -activecolor color
- Like the -color option, but sets the active color of the traces connecting each data point. All data points must be active.
- -activeoutline color
- Like the -outline option, but sets the color of the outline around symbols when drawing active data points (see the activate operation). If color is no outline is drawn. If color is defcolor, then the color will be the same as the -activecolor option. The default is defcolor.
- -activelinewidth pixels
- Sets the width of the traces drawn connecting data points when the element is active. If pixels is 0 and the symbol is not none, no line will be drawn when the element is active. The default line width is 1.
- -dashes dashList
- Sets the dash style of element line. DashList is a list of up to 11 numbers which alternately represent the lengths of the dashes and gaps on the element line. Each number must be between 1 and 255. If dashList is "", the lines will be solid.
- -data coordList
- Specifies the x,y coordinates of the the data. CoordList is a list of numeric expressions representing the x and y coordinate pairs of each data point.
- -fill color
- Sets the interior color of symbols. If color is the interior of the symbol is transparent. If color is defcolor, then the color will be the same as the -color option. The default is defcolor.
- -color color
- Sets the color of the traces connecting the data points.
- -label text
- Sets the label for the element displayed in the legend. If text is "", no entry for the element will be displayed in the legend. The default label is the element's name.
- -linewidth pixels
- Sets the width of the connecting lines between data points. If pixels is 0, no connecting lines will be drawn between symbols. The default is 0.
- -mapped boolean
- Indicates if the element is displayed. The default is 1.
- -mapx xAxis
- Selects the x-axis to map the element's xcoordinates onto. XAxis must be either x, x2, or both. The default is x.
- -mapy yAxis
- Selects the y-axis to map the element's ycoordinates onto. YAxis must be either y, y2, or both. The default is y.
- -offdash color
- Sets the color of the stripes when traces are dashed (see the -dashes option). If color is "", then the "off" pixels will represent gaps instead of stripes. If color is defcolor, then the color will be the same as the -color option. The default is defcolor.
- -outline color
- Sets the color or the outline around each symbol. If color is "", then no outline is drawn. If color is defcolor, then the color will be the same as the -color option. The default is defcolor.
- -outlinewidth pixels
- Sets the width of the outline bordering each symbol. If pixels is 0, no outline will be drawn. The default is 1.
- -pixels pixels
- Sets the size of symbols. If pixels is 0, no symbols will be drawn. The default is 0.125i.
- -scalesymbols boolean
- If boolean is true, this indicates that the size of symbols drawn for elemName should change with scale of the x and y axes. At the time this option is set, the current ranges of the axes are saved as the normalized scales (i.e scale factor is 1.0) and the element is displayed at its designated size (see the -pixels option). As the scale of the axes change, the symbol will be scaled according to the smaller of the x and y axis scales. If boolean is false, the element's symbols are drawn at the designated size, regardless of axis scales. The default is 0.
- -symbol symbol
- Specifies the symbol to use for plotting data points. Symbol must be square, circle, diamond, plus, cross, splus, scross, triangle or none (where no symbol is drawn). The default is none.
- -trace direction
- Indicates if to draw connecting lines between data points whose x-coordinate values are increasing or decreasing. Direction must be increasing, decreasing, or both. For example, if direction is increasing, connecting lines will be drawn only between those data points where x-coordinate values are monotonically increasing. If direction is both, connecting lines will be draw between all data points. The default is both.
- -xdata xVector
- Specifies the x-coordinate vector of the data. XVector is the name of a BLT vector or a list of numeric expressions.
- -ydata yVector
- Specifies the y-coordinate vector of the data. YVector is the name of a BLT vector or a list of numeric expressions.
Element configuration options may also be set by the option command. The resource names in the option database are prefixed by elem.
option add *Graph.elemSymbol line
pathName element create elemName ?option value?... Creates a new element elemName in the graph. Element names must be unique, so an element elemName may not already exist. If additional arguments are present, they specify any of the element options valid for element configure operation.
pathName element deactivate elemName ?elemName?... Deactivates all the elements matching pattern for the graph. Elements whose names match any of the patterns given are redrawn using their normal colors.
pathName element delete ?pattern?...
Deletes all the elements matching pattern for the graph. Elements whose names match any of the patterns given are deleted. The graph will be redrawn without the deleted elements.
pathName element exists elemName
Returns 1 if an element elemName currently exists in the graph and 0 otherwise.
pathName element line elemName ?option value?... The operation is the same as create.
pathName element names
Returns a list of all the elements in the graph.
pathName element show ?nameList?
Queries or modifies the element display list. The element display list designates which elements are drawn and in what order. NameList is a list of elements to be displayed in the order which they are named. If there is no nameList argument, the current display list is returned.
pathName element type elemName
Indicates if the element elemName is a graph or barchart element. If the element is a bar element, the commands returns the string "bar", otherwise it returns "line".
Grid lines extend from the major and minor ticks of each axis horizontally or vertically across the plotting area. The following operations are available for grid lines.
pathName grid cget option
Returns the current value of the grid line configuration option given by option. Option may be any one of the options described below for the grid configure operation.
pathName grid configure ?option value?... Queries or modifies the configuration options for grid lines. If option isn't specified, a list describing all of the current grid options for pathName is returned. If option is specified, but not value, then a list describing option is returned. If one or more option and value pairs are specified, then for each pair, the grid line option option is set to value. The following options are valid for grid lines.
- -color color
- Sets the color of the grid lines. The default is black.
- -dashes dashList
- Sets the dash style of the grid lines. DashList is a list of up to 11 numbers which alternately represent the lengths of the dashes and gaps on the grid lines. Each number must be between 1 and 255. If dashList is "", the grid will be solid lines.
- -linewidth pixels
- Sets the width of grid lines. The default width is 1.
- -mapped boolean
- Indicates if the grid should be displayed. If boolean is true, the grid is shown. The default is 0.
- -mapx xAxis
- Specifies for which x-axis grid lines will be displayed. XAxis must be either x, x2, or both. The default is x.
- -mapy yAxis
- Specifies for which y-axis grid lines will be displayed. YAxis must be either y, y2, or both. The default is y.
- -minor boolean
- Indicates if the grid lines should be displayed for minor ticks. If boolean is true, the lines will appear at minor tick intervals. The default is 1.
Grid configuration options may also be set by the option command. The resource names in the option database are prefixed by by grid, while class names are prefixed by Grid.
option add *Graph.gridLineWidth 2 option add *Graph.GridColor black
pathName grid off
Turns off the display the grid lines.
pathName grid on
Turns on the display the grid lines.
pathName grid toggle
Toggles the display of the grid.
The legend displays a list of the data elements. Each entry consists of the element's symbol and label. The legend can appear in any margin of the graph (the default location is in the right margin). It can also be positioned anywhere within the plotting area of the graph.
The following operations are valid for the legend.
pathName legend activate pattern...
Selects legend entries to be drawn using the active legend colors and relief. All entries whose element names match pattern are selected. To be selected, the element name must match only one pattern.
pathName legend cget option
Returns the current value of a legend configuration option. Option may be any one of the options described below in the legend configure operation.
pathName legend configure ?option value?... Queries or modifies the configuration options for the legend. If option isn't specified, a list describing all of the current legend options for pathName is returned. If option is specified, but not value, then a list describing option is returned. If one or more option and value pairs are specified, then for each pair, the legend option option is set to value. The following options are valid for the legend.
- -activebackground color
- Sets the background color for active legend entries. All legend entries marked active (see the legend activate operation) are drawn using this background color.
- -activeborderwidth pixels
- Sets the width of the 3-D border around the outside of active legend entries. The default is 2.
- -activeforeground color
- Sets the foreground color for active legend entries. All legend entries marked as active (see the legend activate operation) are drawn using this foreground color.
- -activerelief relief
- Specifies the 3-D effect desired for active legend entries. Relief indicates how the interior of the entry should appear relative to the legend; for example, raised means the entry should appear to protrude from the legend, relative to the surface of the legend. The default is flat.
- -anchor anchor
- Tells how to position the legend relative to the positioning point for the legend. This is dependent upon the value of the -position option. The default is center.
left or right
The anchor describes how to position the legend vertically.
top or bottom
The anchor describes how to position the legend horizontally.
- @x,y
- The anchor indicates how to position the legend relative to the positioning point. For example, if anchor is center then the legend is centered on the point; if anchor is n then the legend will be drawn such that the top center point of the rectangular region occupied by the legend will be at the positioning point.
- plotarea
- The anchor indicates how to position the legend relative to the plotting area. For example, if anchor is center then the legend is centered in the plotting area; if anchor is ne then the legend will be drawn such that occupies the upper right corner of the plotting area.
- -background color
- Sets the background color of the legend. If color is "", the legend background with be transparent.
- -borderwidth pixels
- Sets the width of the 3-D border around the outside of the legend (if such border is being drawn; the relief option determines this). The default is 2 pixels.
- -font fontName
- FontName specifies a font to use when drawing the labels of each element into the legend. The default is *-Helvetica-Bold-RNormal-*-12-120-*.
- -foreground color
- Sets the foreground color of the text drawn for the element's label. The default is black.
- -ipadx pad
- Sets the amount of internal padding to be added to the width of each legend entry. Pad can be a list of one or two numbers. If pad has two elements, the left side of the legend entry is padded by the first value and the right side by the second value. If pad is just one value, both the left and right sides are padded by evenly by the value. The default is 2.
- -ipady pad
- Sets an amount of internal padding to be added to the height of each legend entry. Pad can be a list of one or two numbers. If pad has two elements, the top of the entry is padded by the first value and the bottom by the second value. If pad is just one number, both the top and bottom of the entry are padded evenly by the value. The default is 2.
- -mapped boolean
- Indicates if the legend should be displayed. If boolean is true, the legend will be mapped. The default is 1.
- -padx pad
- Sets the padding to the left and right exteriors of the legend. Pad can be a list of one or two numbers. If pad has two elements, the left side of the legend is padded by the first value and the right side by the second value. If pad has just one value, both the left and right sides are padded evenly by the value. The default is 4.
- -pady pad
- Sets the padding above and below the legend. Pad can be a list of one or two numbers. If pad has two elements, the area above the legend is padded by the first value and the area below by the second value. If pad is just one number, both the top and bottom areas are padded by the value. The default is 0.
- -position pos
- Specifies where the legend is displayed on the graph. The -anchor option also affects where the legend is positioned. If pos is left, left, top, or bottom, the legend is displayed in the specified margin. If pos is plotarea, then the legend is drawn inside the plotting area at a particular anchor. If pos is in the form "@x,y", where x and y are the window coordinates, the legend is drawn in the plotting area at the specified coordinates. The default is right.
- -relief relief
- Specifies the 3-D effect for the border around the legend. Relief indicates how the interior of the legend should appear relative to the graph; for example, raised means the legend should appear to protrude from the graph, relative to the surface of the graph. The default is sunken.
Legend configuration options may also be set by the option command. The resource names in the option database are prefixed by legend, while class names are prefixed with Legend.
option add *Graph.legendForeground blue option add *Graph.LegendRelief raised
pathName legend deactivate pattern...
Selects legend entries to be drawn using the normal legend colors and relief. All entries whose element names match pattern are selected. To be selected, the element name must match only one pattern.
pathName legend get pos
Returns the name of the element whose entry is at the screen position pos in the legend. Pos must be in the form "@x,y", where x and y are window coordinates. If the given coordinates do not lie over a legend entry, "" is returned.
The graph can generate encapsulated PostScript output. There are several configuration options you can specify to control how the graph will be printed. You can change the page dimensions and borders. The graph itself can be scaled, centered, or rotated to landscape. The PostScript output can be written directly to a file or returned.
The following postscript operations are available.
pathName postscript cget option
Returns the current value of the postscript option given by option. Option may be any one of the options described below for the postscript configure operation.
pathName postscript configure ?option value?... Queries or modifies the configuration options for PostScript generation. If option isn't specified, a list describing all of the current postscript options for pathName is returned. If option is specified, but not value, then a list describing option is returned. If one or more option and value pairs are specified, then for each pair, the postscript option option is set to value. The following postscript options are available.
- -center boolean
- Indicates if the graph should be centered on the PostScript page. If boolean is false, the the graph will be placed in the upper left corner of the page. The default is 1.
- -colormap varName
- VarName must be the name of a global array variable that specifies a color mapping from the X color name to PostScript. Each element of varName must consist of PostScript code to set a particular color value (e.g. ``1.0 1.0 0.0 setrgbcolor''). When outputting color information in PostScript, the graph checks to see if there is an element of varName with the same name as the color. If so, it uses the value of the element as the PostScript command to set the color. If this option hasn't been specified, or if there isn't an entry in varName for a given color, then it uses the red, green, and blue intensities from the X color.
- -colormode mode
- Specifies how to output color information. Mode must be either color (for full color output), gray (convert all colors to their gray-scale equivalents) or mono (convert foreground colors to black and background colors to white). The default mode is color.
- -fontmap varName
- VarName must be the name of a global array variable that specifies a font mapping from the X font name to PostScript. Each element of varName must consist of a Tcl list with one or two elements, which are the name and point size of a PostScript font. When outputting PostScript commands for a particular font, the graph checks to see if varName contains an element with the same name as the specified font. If there is such an element, then the font information contained in that element is used in the PostScript output. (If the point size is omitted from the list, the point size of the X font is used). Otherwise the X font is examined in an attempt to guess what PostScript font to use. This works only for fonts whose foundry property is Adobe (such as Times, Helvetica, Courier, etc.). If all of this fails then the font defaults to HelveticaBold.
- -decorations boolean
- Indicates if PostScript commands to generate color backgrounds and 3-D borders should be output. If boolean is false, the graph will background will be white and no 3-D borders will be generated. The default is 1.
- -height pixels
- Sets the height of the graph. This lets you print the graph with a height different from the one displayed on the screen. If pixels is 0, the height is the same as the displayed height. The default is 0.
- -landscape boolean
- If boolean is true, this specifies the printed area is to be rotated 90 degrees. In non-rotated output the
x
axis of the printed area runs along the short dimension of the page (``portrait'' orientation); in rotated output the x
axis runs along the long dimension of the page (``landscape'' orientation). Defaults to 0.
- -maxpect boolean
- Indicates to scale the the graph so that it fills the PostScript page. The aspect ratio of the graph is still retained. The default is 0.
- -padx pad
- Sets the horizontal padding for the left and right page borders. The borders are exterior to the graph. Pad can be a list of one or two numbers. If pad has two elements, the left border is padded by the first value and the right border by the second value. If pad has just one value, both the left and right borders are padded evenly by the value. The default is 1i.
- -pady pad
- Sets the vertical padding for the top and bottom page borders. The borders are exterior to the graph. Pad can be a list of one or two numbers. If pad has two elements, the top border is padded by the first value and the bottom border by the second value.
If pad has just one value, both the top and bottom borders are padded evenly by the value. The default is 1i.
- -paperheight pixels
- Sets the height of the postscript page. This can be used to select between different page sizes (letter, A4, etc). The default height is 11.0i.
- -paperwidth pixels
- Sets the width of the postscript page. This can be used to select between different page sizes (letter, A4, etc). The default width is 8.5i.
- -width pixels
- Sets the width of the graph. This lets you print the graph with a width different from the one displayed on the screen. If pixels is 0, the width is the same as the displayed width. The default is 0.
Postscript configuration options may be also be set by the option command. The resource names in the option database are prefixed by ps, while class names are prefixed by Ps.
option add *Graph.psDecorations false option add *Graph.PsLandscape true
pathName postscript output ?fileName? ?option value?... Outputs a file of encapsulated PostScript to print the graph. If a fileName argument isn't present, the command returns the PostScript. If any optionvalue pairs are present, they set configuration options controlling how the PostScript is generated. Option and value can be anything accepted by the postscript configure operation above.
Markers are simple drawing procedures used to annotate or highlight areas of the graph. Markers have various types: text strings, bitmaps, connected lines, windows, or polygons. They can be associated with a particular element, so that when the element is mapped or unmapped, so is the marker. By default, markers are the last items drawn on the graph, so that data elements will appear in behind them. You can change this by configuring the -under option.
Markers, in contrast to elements, don't affect the scaling of the coordinate axes. They can also have elastic coordinates (specified by -Inf and Inf respectively) which translate into the minimum or maximum limit of the axis. For example, you can place a marker so it always remains in the lower left corner of the plotting area, by using the coordinates -Inf,-Inf.
The following operations are available for markers.
pathName marker after markerId ?markerId? Reorders the marker display list placing the first marker after the second. If no second markerId argument is specified, the marker is placed at the end of the display list. This command can be used to control how markers are displayed since markers are drawn in the order of this display list.
pathName marker before markerId ?markerId? Reorders the marker display list placing the first marker before the second. If no second markerId argument is specified, the marker is placed at the beginning of the display list. This command can be used to control how markers are displayed since markers are drawn in the order of this display list.
pathName marker cget option
Returns the current value of the marker configuration option given by option. Option may be any one of the options described below in the configure operation.
pathName marker configure markerId ?option value?... Queries or modifies the configuration options for markers. If option isn't specified, a list describing all of the current options for markerId is returned. If option is specified, but not value, then a list describing option is returned. If one or more option and value pairs are specified, then for each pair, the marker option option is set to value.
The following options are valid for all markers. Each type of marker also has its own type-specific options. They are described in the sections below.
- -coords coordList
- Specifies the coordinates of the marker. CoordList is a list of x and y graph coordinates. The number of coordinates is dependent upon the type of marker. Text, bitmap, and window markers need only two coordinates (an x and y coordinate). Line markers need at least four coordinates, polygons at least six. If coordList is "", the marker will not be displayed. The default is "".
- -element elemName
- Links the marker with the element elemName. The marker is displayed only if the element is also currently displayed (see the element's show operation). If elemName is "", the marker is always displayed. The default is "".
- -mapped boolean
- Indicates if the marker is to be drawn. If boolean is true, the marker is displayed. The default is 1.
- -mapx xAxis
- Specifies which x-axis to map the marker's x-coordinates onto. XAxis must be either x, x2, or both. The default is x.
- -mapy yAxis
- Specifies which y-axis to map the marker's y-coordinates onto. YAxis must be either y, y2, or both. The default is y.
- -name markerId
- Changes the identifier for the marker. The identifier markerId can not already be used by another marker. If this option isn't specified, the marker's name is uniquely generated.
- -under boolean
- Indicates if the marker should be drawn before or after the data elements. If boolean is true, the marker is be displayed underneath the data element symbols and lines. Otherwise, the marker is drawn on top of the element. The default is 0.
- -xoffset pixels
- Specifies a screen distance to offset the marker horizontally. Pixels is a valid screen distance, such as 2 or 1.2i. The default is 0.
- -yoffset pixels
- Specifies a screen distance to offset the markers vertically. Pixels is a valid screen distance, such as 2 or 1.2i. The default is 0.
Marker configuration options may also be set by the option command. The resource names in the option database are prefixed by bmMarker, textMarker, lineMarker, polyMarker, or winMarker with respect to the marker type. Class names are prefixed by Marker.
option add *Graph.MarkerBackground blue option add *Graph.textMarkerForeground white
pathName marker create type ?option value?... Creates a marker of the selected type. Type may be either text, line, bitmap, polygon, or window. This command returns the marker identifier, which is used as the markerId argument in the other marker-related commands. If the -name option is used, this overrides the normal marker identifier. If the name provided is already used for another marker, the new marker will replace the old.
pathName marker delete ?pattern?...
Removes the markers with identifiers matching pattern.
pathName marker exists markerId
Returns 1 if the marker markerId exists and 0 otherwise.
pathName marker ids ?pattern?
Returns a list of IDs of markers created. If pattern is supplied, only those markers whose IDs matching it will be returned.
pathName marker type markerId
Returns the type of the marker given by markerId, such as Line or Text. If markerId is not a valid a marker identifier, "" is returned.
TEXT MARKERS
A text marker displays a string of characters on one or more lines of text. Embedded newlines cause line breaks. They may be used to annotate regions of the graph. Text markers are created with the create operation in the form:
pathName marker create text ?option value?...
There may be any number of option-value pairs, each of which sets one of the configuration options for the text marker. These same option-value pairs may be used with the marker's configure operation.
The following options are specific to text markers:
- -anchor anchor
- Anchor tells how to position the text relative to the positioning point for the text. For example, if anchor is center then the text is centered on the point; if anchor is n then the text will be drawn such that the top center point of the rectangular region occupied by the text will be at the positioning point. This default is center.
- -background color
- Sets the background color of the text string. If color is "", the background will be transparent. The default is white.
- -font fontName
- Specifies the font of the text. The default is *-Helvetica-Bold-R-Normal-*-120-*.
- -foreground color
- Sets the foreground color of the text. The default is black.
- -justify justify
- Specifies how the text should be justified. This matters only when the marker contains more than one line of text. Justify must be left, right, or center. The default is center.
- -padx pad
- Sets the padding to the left and right exteriors of the text. Pad can be a list of one or two numbers. If pad has two elements, the left side of the text is padded by the first value and the right side by the second value. If pad has just one value, both the left and right sides are padded evenly by the value. The default is 4.
- -pady pad
- Sets the padding above and below the text. Pad can be a list of one or two numbers. If pad has two elements, the area above the text is padded by the first value and the area below by the second value. If pad is just one number, both the top and bottom areas are padded by the value. The default is 4.
- -rotate theta
- Specifies the number of degrees to rotate the text. Theta is a real number representing the angle of rotation. The marker is first rotated along its center and is then displayed according to its anchor position. The default is 0.0.
- -text text
- Specifies the text of the marker. The exact way in which the text is displayed may be affected by other options such as -anchor or -rotate.
LINE MARKERS
A line marker displays one or more connected line segments on the graph. Line markers are created with marker's create operation in the form:
pathName marker create line ?option value?...
There may be any number of option-value pairs, each of which sets one of the configuration options for the marker. These same option-value pairs may be used with the marker's configure operation.
The following options are specific to line markers:
- -background color
- Sets the background color of the line. The option is affects the line color only when the -stipple option is set. If this option isn't specified then it defaults to white.
- -dashes dashList
- Sets the dash style of the line. DashList is a list of up to 11 numbers which alternately represent the lengths of the dashes and gaps on the line. Each number must be between 1 and 255. If dashList is "", the marker line will be solid.
- -foreground color
- Sets the foreground color. The default foreground color is black.
- -linewidth pixels
- Sets the width of the lines. The default width is 0.
- -stipple bitmap
- Indicates that the line should be drawn with a stippled pattern rather than solid. Bitmap specifies a bitmap to use as the stipple pattern. If bitmap is "", then the line is drawn in a solid fashion. The default is "".
BITMAP MARKERS
A bitmap marker displays a bitmap on the graph. Bitmap markers are created with the marker's create operation in the form:
pathName marker create bitmap ?option value?...
There may be any number of option-value pairs, each of which sets one of the configuration options for the marker. These same option-value pairs may be used with the marker's configure operation.
The following options are specific to bitmap markers:
- -anchor anchor
- Anchor tells how to position the bitmap relative to the positioning point for the bitmap. For example, if anchor is center then the bitmap is centered on the point; if anchor is n then the bitmap will be drawn such that the top center point of the rectangular region occupied by the bitmap will be at the positioning point. This option defaults to center.
- -background color
- Sets the background color of the bitmap. If color is "", the background color will be transparent. The default background color is white.
- -foreground color
- Sets the foreground color of the bitmap. The default foreground color is black.
- -bitmap bitmap
- Specifies the bitmap to be displayed. If bitmap is "", the marker will not be displayed. The default is "".
- -rotate theta
- Sets the rotation of the bitmap. Theta is a real number representing the angle of rotation in degrees. The marker is first rotated and then placed according to its anchor position. The default rotation is 0.0.
POLYGON MARKERS
A polygon marker displays a closed region described as two or more connected line segments on the graph. It is assumed the first and last points are connected. Polygon markers are created using the marker create operation in the form:
pathName marker create polygon ?option value?...
There may be any number of option-value pairs, each of which sets one of the configuration options for the marker. These same option-value pairs may be used with the marker configure command to change the marker's configuration. The following options are supported for polygon markers:
- -dashes dashList
- Sets the dash style of the outline of the polygon. DashList is a list of up to 11 numbers which alternately represent the lengths of the dashes and gaps on the outline. Each number must be between 1 and 255. If dashList is "", the outline will be a solid line.
- -fill color
- Sets the fill color of the polygon. If color is "", then the interior of the polygon is transparent. The default is white.
- -linewidth pixels
- Sets the width of the outline of the polygon. If pixels is zero, no outline is drawn. The default is 0.
- -outline color
- Sets the color of the outline of the polygon. If the polygon is stippled (see the -stipple option), then this represents the foreground color of the stipple. The default is black.
- -stipple bitmap
- Indicates that the polygon should be drawn with a stippled pattern rather than a solid color. Bitmap specifies a bitmap to use as the stipple pattern. If bitmap is "", then the polygon is filled with a solid color (if the -fill option is set). The default is "".
WINDOW MARKERS
A window marker displays a widget at a given position on the graph. Window markers are created with the marker's create operation in the form:
pathName marker create window ?option value?...
There may be any number of option-value pairs, each of which sets one of the configuration options for the marker. These same option-value pairs may be used with the marker's configure command.
The following options are specific to window markers:
- -anchor anchor
- Anchor tells how to position the widget relative to the positioning point for the widget. For example, if anchor is center then the widget is centered on the point; if anchor is n then the widget will be displayed such that the top center point of the rectangular region occupied by the widget will be at the positioning point. This option defaults to center.
- -height pixels
- Specifies the height to assign to the marker's window. If this option isn't specified, or if it is specified as "", then the window is given whatever height the widget requests internally.
- -width pixels
- Specifies the width to assign to the marker's window. If this option isn't specified, or if it is specified as "", then the window is given whatever width the widget requests internally.
- -window pathName
- Specifies the widget to be managed by the graph. PathName must be a child of the graph widget.
You can manipulate a graph's data elements from the C language. There may be situations where it is too expensive to translate the data values from ASCII strings. Or you might want to read data in a special file format.
The convenience function Blt_GraphElement no longer exists. But data can manipulated from the C language using BLT vectors instead. You specify the x and y data coordinates of an element as vectors and manipulate the vector from C. The graph will be redrawn automatically after the vectors are updated.
From Tcl, create the vectors and configure the element to use them.
vector x y
.graph element configure line1 -xdata x -ydata y
To set data points from C, you pass the values as arrays of doubles using the Blt_ResetVector call. The vector is reset with the new data and at the next idle point (when Tk re-enters its event loop), the graph will be redrawn automatically.
#include <tcl.h>
#include <blt.h>
register int i;
Blt_Vector x, y;
/* Allocate space for the new vectors */ x.numValues = x.arraySize = 50;
y.numValues = y.arraySize = 50;
x.valueArr = (double *)malloc(sizeof(double) * 50); y.valueArr = (double *)malloc(sizeof(double) * 50);
/* Write the data points into the vectors */ for (i = 0; i < 50; i++) {
x.valueArr[i] = i * 0.02;
y.valueArr[i] = sin(x.valueArr[i]); } /* Update the BLT vectors "x" and "y" */ if ((Blt_ResetVector(interp, "x", &x, TCL_DYNAMIC) != TCL_OK) || (Blt_ResetVector(interp, "y", &y, TCL_DYNAMIC) != TCL_OK)) { return TCL_ERROR;
}
There may be cases where the graph needs to be drawn and updated as quickly as possible. If the graph's drawing speed becomes a big problem, here are a few tips to speed up displays.
- · Try to minimize the number of data points. The more
- data points the graph looks at, the more work the graph must do.
- · If your data is generated as floating point values, the
- time required to convert the data values to and from ASCII strings can be significant, especially when there any many data points. You can avoid the redundant string-to-decimal conversions using the C API to BLT vectors.
- · Data elements without symbols are displayed faster than
- with symbols. Set the data element's -symbol option to none. If you need to draw symbols, try using the simple symbols such as splus and scross.
- · Don't stipple or dash the element. Solid lines are much
- faster.
- · If you update data elements frequently, try turning off
- the -bufferelements option for the graph. When the graph is first displayed, it draws data elements into an internal pixmap. The pixmap acts as a cache, so that when the graph needs to be redrawn again, and the data elements or coordinate axes haven't changed, the pixmap is simply copied to the screen. This is especially useful when you are using markers to highlight points and regions on the graph. But if the graph is updated frequently, changing either the element data or coordinate axes, the buffering becomes redundant.
Auto-scale routines do not use requested min/max limits as boundaries when the axis is logarithmically scaled.
The PostScript output generated for polygons with more than 1500 points may exceed the limits of some printers (See PostScript Language Reference Manual, page 568). The work-around is to break the polygon into separate pieces.
graph, widget
Table of Contents