<!-- manual page source format generated by PolyglotMan v3.0.8+XFree86, --> <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> <HTML> <HEAD> <TITLE>graph(n) manual page</TITLE> </HEAD> <BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red"> <A HREF="#toc">Table of Contents</A><P> <H2><A NAME="sect0" HREF="#toc0">Name</A></H2> eps - Encapsulated PostScript canvas item. <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2> <I>canvas<B> create eps <I>x y </I></B></I>?<I>option value</I>?... <H2><A NAME="sect2" HREF="#toc2">Description</A></H2> The <B>eps</B> canvas item lets you place encapulated PostScript (EPS) on a canvas, controlling its size and placement. The EPS item is displayed either as a solid rectangle or a preview image. The preview image is designated in one of two ways: 1) the EPS file contains an ASCII hexidecimal preview, or 2) a Tk photo image. When the canvas generates PostScript output, the EPS will be inserted with the proper translation and scaling to match that of the EPS item. So can use the canvas widget as a page layout tool. <H2><A NAME="sect3" HREF="#toc3">Example</A></H2> Let's say you have for PostScript files of four graphs which you want to tile two-by-two on a single page. Maybe you'd like to annotate the graphs by putting a caption at the bottom of each graph. <P> Normally, you would have to resort to an external tool or write your own PostScript program. The <B>eps</B> canvas item lets you do this through Tk's canvas widget. An <B>eps</B> item displays an image (or rectangle) representing the encapsulated PostScript file. It also scales and translates the EPS file when the canvas is printed. <P> <H2><A NAME="sect4" HREF="#toc4">Syntax</A></H2> <BR> <P> <CODE><I>canvas <B>create eps <I>x y </I></B></I>?<I>option value</I>?...<BR> </CODE><P>The <B>eps</B> item creates a new canvas item. <I>Canvas</I> is the name of a <B>canvas</B> widget. You must supply the X-Y coordinate of the new eps item. How the coordinate is exactly interpretered is controlled by the <B>-anchor</B> option (see below). <P> Additional options may be specified on the command line to configure aspects of the eps item such as its color, stipple, and font. The following <I>option</I> and <I>value</I> pairs are valid. <DL> <DT><B>-anchor <I>anchor</I></B> </DT> <DD>Tells how to position the EPS item relative to its X-Y coordinate. The default is <I>center</I>. </DD> <DT><B>-background <I>color</I></B> </DT> <DD>Sets the background color of the EPS rectangle. </DD> <DT><B>-borderwidth <I>pixels</I></B> </DT> <DD>Sets the width of the 3-D border around the outside edge of the item. The <B>-relief</B> option determines if the border is to be drawn. The default is <I>0</I>. </DD> <DT><B>-file <I>fileName</I></B> </DT> <DD>Specifies the name of the EPS file. The first line of an EPS file must start with "%!PS" and contain a "EPS" version specification. The other requirement is that there be a "%%BoundingBox:" entry which contains four integers representing the lower-left and upper-right coordinates of the area bounding the EPS. The default is <I>""</I>. </DD> <DT><B>-font <I>fontName</I></B> </DT> <DD>Specifies the font of the title. The default is <I>*-Helvetica-Bold-R-Normal-*-18-180-*</I>. </DD> <DT><B>-foreground <I>color</I></B> </DT> <DD>Specifies the foreground color of the EPS rectangle. The option matters only when the <B>-stipple</B> option is set. The default is <I>white</I>. </DD> <DT><B>-height <I>pixels</I></B> </DT> <DD>Specifies the height EPS item. If <I>pixels</I> is <I>0</I>, then the height is determined from the PostScript "BoundingBox:" entry in the EPS file. The default is <I>0</I>. </DD> <DT><B>-image <I>photo</I></B> </DT> <DD>Specifies the name of a Tk photo image to be displayed as in the item as a preview image. This option overrides any preview specification found in the EPS file. The default is <I>""</I>. </DD> <DT><B>-justify <I>justify</I></B> </DT> <DD>Specifies how the title should be justified. This matters only when the title contains more than one line of text. <I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD> <DT><B>-relief <I>relief</I></B> </DT> <DD>Specifies the 3-D effect for the EPS item. <I>Relief</I> specifies how the item should appear relative to canvas; for example, <I>raised</I> means the item should appear to protrude. The default is <I>flat</I>. </DD> <DT><B>-shadowcolor <I>color</I></B> </DT> <DD>Specifies the color of the drop shadow used for the title. The option with the <B>-shadowoffset</B> option control how the title's drop shadow appears. The default is <I>grey</I>. </DD> <DT><B>-shadowoffset <I>pixels</I></B> </DT> <DD>Specifies the offset of the drop shadow from the title's text. If <I>pixels</I> is <I>0</I>, no shadow will be seen. The default is <I>0</I>. </DD> <DT><B>-showimage <I>boolean</I></B> </DT> <DD>Indicates whether to display the image preview (if one exists), or a simple rectangle. The default is <I>yes</I>. </DD> <DT><B>-stipple <I>bitmap</I></B> </DT> <DD>Specifies a bitmap to used to stipple the rectangle representing the EPS item. The default is <I>""</I>. </DD> <DT><B>-title <I>string</I></B> </DT> <DD>Sets the title of the EPS item. If <I>string</I> is <I>""</I>, then the title specified by the PostScript "Title:" entry is used. You can set the string a single space to display no title. The default is <I>""</I>. </DD> <DT><B>-titleanchor <I>anchor</I></B> </DT> <DD>Tells how to position the title within EPS item. The default is <I>n</I>. </DD> <DT><B>-titlecolor <I>color</I></B> </DT> <DD>Specifies the color of the title. The default is <I>white</I>. </DD> <DT><B>-titlerotate <I>degrees</I></B> </DT> <DD>Sets the rotation of the title. <I>Degrees</I> is a real number representing the angle of rotation. The title is first rotated in space and then placed according to the <B>-titleanchor</B> position. The default rotation is <I>0.0</I>. </DD> <DT><B>-width <I>pixels</I></B> </DT> <DD>Specifies the width EPS item. If <I>pixels</I> is <I>0</I>, then the width is determined from the PostScript "BoundingBox:" entry in the EPS file. The default is <I>0</I>. <I>5i</I>. </DD> </DL> <H2><A NAME="sect5" HREF="#toc5">Example</A></H2> The <B>graph</B> command creates a new graph. <BR> <CODE># Create a new graph. Plotting area is black.<BR> graph .g -plotbackground black<BR> </CODE><P>A new Tcl command <I>.g</I> is also created. This command can be used 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 graph's <B>configure</B> operation. <BR> <CODE># Change the title.<BR> .g configure -title "My Plot"<BR> </CODE><P>A graph has several components. To access a particular component you use the component's name. For example, to add data elements, you use the new command and the <B>element</B> component. <BR> <CODE># Create a new element named "line1"<BR> .g element create line1 \<BR> <tt> </tt> <tt> </tt> -xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \<BR> <tt> </tt> <tt> </tt> -ydata { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 <BR> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> 155.85 166.60 175.38 }<BR> </CODE><P>The element's X and Y coordinates are specified using lists of numbers. Alternately, BLT vectors could be used to hold the X-Y coordinates. <BR> <CODE># Create two vectors and add them to the graph.<BR> vector xVec yVec<BR> xVec set { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 }<BR> yVec set { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 <BR> <tt> </tt> <tt> </tt> 166.60 175.38 }<BR> .g element create line1 -xdata xVec -ydata yVec<BR> </CODE><P>The advantage of using vectors is that when you modify one, the graph is automatically redrawn to display the new values. <BR> <CODE># Change the X-Y coordinates of the first point.<BR> set xVec(0) 0.18<BR> set yVec(0) 25.18<BR> </CODE><P>An element named <I>line1</I> is now created in <I>.g</I>. By default, the element's label in the legend will be also <I>line1</I>. You can change the label, or specify no legend entry, again using the element's <B>configure</B> operation. <BR> <CODE># Don't display "line1" in the legend.<BR> .g element configure line1 -label ""<BR> </CODE><P>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. <BR> <CODE>.g element configure line1 -symbol square -color red \<BR> <tt> </tt> <tt> </tt> -dashes { 2 4 2 } -linewidth 2 -pixels 2c<BR> </CODE><P>Four coordinate axes are automatically created: <I>x</I>, <I>x2</I>, <I>y</I>, and <I>y2</I>. And by default, elements are mapped onto the axes <I>x</I> and <I>y</I>. This can be changed with the <B>-mapx</B> and <B>-mapy</B> options. <BR> <CODE># Map "line1" on the alternate Y-axis "y2".<BR> .g element configure line1 -mapy y2<BR> </CODE><P>Axes can be configured in many ways too. For example, you change the scale of the Y-axis from linear to log using the <B>axis</B> component. <BR> <CODE># Y-axis is log scale.<BR> .g axis configure y -logscale yes<BR> </CODE><P>One important way axes are used is to zoom in on a particular data region. Zooming is done by simply specifying new axis limits using the <B>-min</B> and <B>-max</B> configuration options. <BR> <CODE>.g axis configure x -min 1.0 -max 1.5<BR> .g axis configure y -min 12.0 -max 55.15<BR> </CODE><P>To zoom interactively, you link the axis <B>configure</B> operations with some user interaction (such as pressing the mouse button), using the <B>bind</B> command. To convert between screen and graph coordinates, use the <B>invtransform</B> operation. <BR> <CODE># Click the button to set a new minimum <BR> bind .g <ButtonPress-1> { <BR> %W axis configure x -min [%W axis invtransform x %x]<BR> %W axis configure x -min [%W axis invtransform x %y]<BR> }<BR> </CODE><P>By default, the limits of the axis are determined from data values. To reset back to the default limits, set the <B>-min</B> and <B>-max</B> options to the empty value. <BR> <CODE># Reset the axes to autoscale again.<BR> .g axis configure x -min {} -max {}<BR> .g axis configure y -min {} -max {}<BR> </CODE><P>By default, the legend is drawn in the right margin. You can change this or any legend configuration options using the <B>legend</B> component. <BR> <CODE># Configure the legend font, color, and relief<BR> .g legend configure -position left -relief raised \<BR> <tt> </tt> <tt> </tt> -font fixed -fg blue<BR> </CODE><P>To prevent the legend from being displayed, turn on the <B>-hide</B> option. <BR> <CODE># Don't display the legend.<BR> .g legend configure -hide yes<BR> </CODE><P>The <B>graph</B> 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, images, polygons, lines, or windows. Markers can be used, for example, to mark or brush points. In this example, is a text marker that labels the data first point. Markers are created using the <B>marker</B> component. <BR> <CODE># Create a label for the first data point of "line1".<BR> .g marker create text -name first_marker -coords { 0.2 26.18 } \<BR> <tt> </tt> <tt> </tt> -text "start" -anchor se -xoffset -10 -yoffset -10<BR> </CODE><P>This creates a text marker named <I>first_marker</I>. It will display the text "start" near the coordinates of the first data point. The <B>-anchor</B>, <B>-xoffset</B>, and <B>-yoffset</B> options are used to display the marker above and to the left of the data point, so that the data point isn't covered by the marker. By default, markers are drawn last, on top of data. You can change this with the <B>-under</B> option. <BR> <CODE># Draw the label before elements are drawn.<BR> .g marker configure first_marker -under yes<BR> </CODE><P>You can add cross hairs or grid lines using the <B>crosshairs</B> and <B>grid</B> components. <BR> <CODE># Display both cross hairs and grid lines.<BR> .g crosshairs configure -hide no -color red<BR> .g grid configure -hide no -dashes { 2 2 }<BR> </CODE><P>Finally, to get hardcopy of the graph, use the <B>postscript</B> component. <BR> <CODE># Print the graph into file "file.ps"<BR> .g postscript output file.ps -maxpect yes -decorations no<BR> </CODE><P>This generates a file <I>file.ps</I> containing the encapsulated PostScript of the graph. The option <B>-maxpect</B> says to scale the plot to the size of the page. Turning off the <B>-decorations</B> option denotes that no borders or color backgrounds should be drawn (i.e. the background of the margins, legend, and plotting area will be white). <H2><A NAME="sect6" HREF="#toc6">Graph Operations</A></H2> <DL> <DT><I>pathName <B>axis <I>operation </I></B></I>?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT> section. </DD> <DT><I>pathName <B>bar <I>elemName </I></B></I>?<I>option value</I>?... </DT> <DD>Creates a new barchart element <I>elemName</I>. It's an error if an element <I>elemName</I> already exists. See the manual for <B>barchart</B> for details about what <I>option</I> and <I>value</I> pairs are valid. </DD> <DT><I>pathName <B>cget</B></I> <I>option</I> </DT> <DD>Returns the current value of the configuration option given by <I>option</I>. <I>Option</I> may be any option described below for the <B>configure</B> operation. </DD> <DT><I>pathName <B>configure </B></I>?<I>option value</I>?... </DT> <DD>Queries or modifies the configuration options of the graph. If <I>option</I> isn't specified, a list describing the current options for <I>pathName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the option <I>option</I> is set to <I>value</I>. The following options are valid. <blockquote></DD> <DT><B>-background <I>color</I></B> </DT> <DD>Sets the background color. This includes the margins and legend, but not the plotting area. </DD> <DT><B>-borderwidth <I>pixels</I></B> </DT> <DD>Sets the width of the 3-D border around the outside edge of the widget. The <B>-relief</B> option determines if the border is to be drawn. The default is <I>2</I>. </DD> <DT><B>-bottommargin <I>pixels</I></B> </DT> <DD>Specifies the size of the margin below the X-coordinate axis. If <I>pixels</I> is <I>0</I>, the size of the margin is selected automatically. The default is <I>0</I>. </DD> <DT><B>-bufferelements <I>boolean</I></B> </DT> <DD>Indicates whether an internal pixmap to buffer the display of data elements should be used. If <I>boolean</I> 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 <FONT SIZE=-1><B>SPEED TIPS</B></FONT> section. The default is <I>1</I>. </DD> <DT><B>-cursor <I>cursor</I></B> </DT> <DD>Specifies the widget's cursor. The default cursor is <I>crosshair</I>. </DD> <DT><B>-font <I>fontName</I></B> </DT> <DD>Specifies the font of the graph title. The default is <I>*-Helvetica-Bold-R-Normal-*-18-180-*</I>. </DD> <DT><B>-halo <I>pixels</I></B> </DT> <DD>Specifies a maximum distance to consider when searching for the closest data point (see the element's <B>closest</B> operation below). Data points further than <I>pixels</I> away are ignored. The default is <I>0.5i</I>. </DD> <DT><B>-height <I>pixels</I></B> </DT> <DD>Specifies the requested height of widget. The default is <I>4i</I>. </DD> <DT><B>-invertxy <I>boolean</I></B> </DT> <DD>Indicates whether the placement X-axis and Y-axis should be inverted. If <I>boolean</I> is true, the X and Y axes are swapped. The default is <I>0</I>. </DD> <DT><B>-justify <I>justify</I></B> </DT> <DD>Specifies how the title should be justified. This matters only when the title contains more than one line of text. <I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD> <DT><B>-leftmargin <I>pixels</I></B> </DT> <DD>Sets the size of the margin from the left edge of the window to the Y-coordinate axis. If <I>pixels</I> is <I>0</I>, the size is calculated automatically. The default is <I>0</I>. </DD> <DT><B>-plotbackground <I>color</I></B> </DT> <DD>Specifies the background color of the plotting area. The default is <I>white</I>. </DD> <DT><B>-plotborderwidth <I>pixels</I></B> </DT> <DD>Sets the width of the 3-D border around the plotting area. The <B>-plotrelief</B> option determines if a border is drawn. The default is <I>2</I>. </DD> <DT><B>-plotpadx <I>pad</I></B> </DT> <DD>Sets the amount of padding to be added to the left and right sides of the plotting area. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has two elements, the left side of the plotting area entry is padded by the first distance and the right side by the second. If <I>pad</I> is just one distance, both the left and right sides are padded evenly. The default is <I>8</I>. </DD> <DT><B>-plotpady <I>pad</I></B> </DT> <DD>Sets the amount of padding to be added to the top and bottom of the plotting area. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has two elements, the top of the plotting area is padded by the first distance and the bottom by the second. If <I>pad</I> is just one distance, both the top and bottom are padded evenly. The default is <I>8</I>. </DD> <DT><B>-plotrelief <I>relief</I></B> </DT> <DD>Specifies the 3-D effect for the plotting area. <I>Relief</I> specifies how the interior of the plotting area should appear relative to rest of the graph; for example, <I>raised</I> means the plot should appear to protrude from the graph, relative to the surface of the graph. The default is <I>sunken</I>. </DD> <DT><B>-relief <I>relief</I></B> </DT> <DD>Specifies the 3-D effect for the graph widget. <I>Relief</I> specifies how the graph should appear relative to widget it is packed into; for example, <I>raised</I> means the graph should appear to protrude. The default is <I>flat</I>. </DD> <DT><B>-rightmargin <I>pixels</I></B> </DT> <DD>Sets the size of margin from the plotting area to the right edge of the window. By default, the legend is drawn in this margin. If <I>pixels</I> is than 1, the margin size is selected automatically. </DD> <DT><B>-takefocus</B> <I>focus</I> </DT> <DD>Provides information used when moving the focus from window to window via keyboard traversal (e.g., Tab and Shift-Tab). If <I>focus</I> is <I>0</I>, this means that this window should be skipped entirely during keyboard traversal. <I>1</I> means that the this window should always receive the input focus. An empty value means that the traversal scripts make the decision whether to focus on the window. The default is <I>""</I>. </DD> <DT><B>-tile <I>image</I></B> </DT> <DD>Specifies a tiled background for the widget. If <I>image</I> isn't <I>""</I>, the background is tiled using <I>image</I>. Otherwise, the normal background color is drawn (see the <B>-background</B> option). <I>Image</I> must be an image created using the Tk <B>image</B> command. The default is <I>""</I>. </DD> <DT><B>-title <I>text</I></B> </DT> <DD>Sets the title to <I>text</I>. If <I>text</I> is <I>""</I>, no title will be displayed. </DD> <DT><B>-topmargin <I>pixels</I></B> </DT> <DD>Specifies the size of the margin above the x2 axis. If <I>pixels</I> is <I>0</I>, the margin size is calculated automatically. </DD> <DT><B>-width <I>pixels</I></B> </DT> <DD>Specifies the requested width of the widget. The default is <I>5i</I>. </DD> </DL> </blockquote> <DL> <DT><I>pathName <B>crosshairs <I>operation </I></B></I>?<I>arg</I>? </DT> <DD>See the <FONT SIZE=-1><B>CROSSHAIRS COMPONENT</B></FONT> section. </DD> <DT><I>pathName <B>element <I>operation </I></B></I>?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>ELEMENT COMPONENTS</B></FONT> section. </DD> <DT><I>pathName <B>extents <I>item</I></B></I> </DT> <DD>Reports the size of a particular items in the graph. <I>Item</I> must be either <I>leftmargin</I>, <I>rightmargin</I>, <I>topmargin</I>, <I>bottommargin</I>, <I>plotwidth</I>, or <I>plotheight</I>. </DD> <DT><I>pathName <B>grid <I>operation </I></B></I>?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>GRID COMPONENT</B></FONT> section. </DD> <DT><I>pathName <B>invtransform <I>winX winY</I></B></I> </DT> <DD>Performs an inverse coordinate transformation, mapping window coordinates back to graph coordinates, using the standard X-axis and Y-axis. Returns a list of containing the X-Y y graph coordinates. </DD> <DT><I>pathName <B>inside <I>x y</I></B></I> </DT> <DD>Returns <I>1</I> is the designated screen coordinate (<I>x</I> and <I>y</I>) is inside the plotting area and <I>0</I> otherwise. </DD> <DT><I>pathName <B>legend <I>operation </I></B></I>?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>LEGEND COMPONENT</B></FONT> section. </DD> <DT><I>pathName <B>line<B> operation arg</B></B></I>... </DT> <DD>The operation is the same as <B>element</B>. </DD> <DT><I>pathName <B>marker <I>operation </I></B></I>?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>MARKER COMPONENTS</B></FONT> section. </DD> <DT><I>pathName <B>postscript <I>operation </I></B></I>?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>POSTSCRIPT COMPONENT</B></FONT> section. </DD> <DT><I>pathName <B>snap <I>photoName</I></B></I> </DT> <DD>Takes a snapshot of the graph and stores the contents in the photo image <I>photoName</I>. <I>PhotoName</I> is the name of a Tk photo image that must already exist. </DD> <DT><I>pathName <B>transform <I>x y</I></B></I> </DT> <DD>Performs a coordinate transformation, mapping graph coordinates to window coordinates, using the standard X-axis and Y-axis. Returns a list containing the X-Y screen coordinates. </DD> <DT><I>pathName <B>xaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT> <DD></DD> <DT><I>pathName <B>x2axis <I>operation</I></B></I> ?<I>arg</I>?... </DT> <DD></DD> <DT><I>pathName <B>yaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT> <DD></DD> <DT><I>pathName <B>y2axis <I>operation</I></B></I> ?<I>arg</I>?... </DT> <DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT> section. </DD> </DL> <H2><A NAME="sect7" HREF="#toc7">Graph Components</A></H2> A graph is composed of several components: coordinate axes, data elements, legend, grid, cross hairs, postscript, and annotation markers. Instead of one big set of configuration options and operations, the graph is partitioned, where each component has its own configuration options and operations that specifically control that aspect or part of the graph. <H3><A NAME="sect8" HREF="#toc8">Axis Components</A></H3> Four coordinate axes are automatically created: two X-coordinate axes (<I>x</I> and <I>x2</I>) and two Y-coordinate axes (<I>y</I>, and <I>y2</I>). By default, the axis <I>x</I> is located in the bottom margin, <I>y</I> in the left margin, <I>x2</I> in the top margin, and <I>y2</I> in the right margin. <P> 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. <P> The range of the axis controls what region of data is plotted. Data points outside 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. <P> You can create and use several axes. To create an axis, invoke the axis component and its create operation. <BR> <CODE># Create a new axis called "tempAxis"<BR> .g axis create tempAxis<BR> </CODE><P>You map data elements to an axis using the element's -mapy and -mapx configuration options. They specify the coordinate axes an element is mapped onto. <BR> <CODE># Now map the tempAxis data to this axis.<BR> .g element create "e1" -xdata $x -ydata $y -mapy tempAxis<BR> </CODE><P>While you can create many axes, only four can be displayed simultaneously. They are drawn in each of the margins surrounding the plotting area. The axes <I>x</I> and <I>y</I> are drawn in the bottom and left margins. The axes <I>x2</I> and <I>y2</I> are drawn in top and right margins. Only <I>x</I> and <I>y</I> are shown by default. Note that the axes can have different scales. <P> To display a different axis, you invoke one of the following components: <B>xaxis</B>, <B>yaxis</B>, <B>x2axis</B>, and <B>y2axis</B>. The <B>use</B> operation designates the axis to be drawn in the corresponding margin: <B>xaxis</B> in the bottom, <B>yaxis</B> in the left, <B>x2axis</B> in the top, and <B>y2axis</B> in the right. <BR> <CODE># Display the axis tempAxis in the left margin.<BR> .g yaxis use tempAxis<BR> <P> </CODE><P>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 drawn, 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. <P> <DL> <DT><I>pathName <B>axis <B>cget <I>axisName <I>option</I></I></B></B></I> </DT> <DD>Returns the current value of the option given by <I>option</I> for <I>axisName</I>. <I>Option</I> may be any option described below for the axis <B>configure</B> operation. </DD> <DT><I>pathName <B>axis <B>configure <I>axisName </I></B></B></I>?<I>axisName</I>?... ?<I>option value</I>?... </DT> <DD>Queries or modifies the configuration options of <I>axisName</I>. Several axes can be changed. If <I>option</I> isn't specified, a list describing all the current options for <I>axisName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the axis option <I>option</I> is set to <I>value</I>. The following options are valid for axes. <blockquote></DD> <DT><B>-color <I>color</I></B> </DT> <DD>Sets the color of the axis and tick labels. The default is <I>black</I>. </DD> <DT><B>-command <I>prefix</I></B> </DT> <DD>Specifies a Tcl command to be invoked when formatting the axis tick labels. <I>Prefix</I> 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 widget and the current the numeric value of the tick. The procedure returns the formatted tick label. If <I>""</I> is returned, no label will appear next to the tick. You can get the standard tick labels again by setting <I>prefix</I> to <I>""</I>. The default is <I>""</I>. <P> Please note that this procedure is invoked while the graph is redrawn. You may query configuration options. But do not them, because this can have unexpected results. </DD> <DT><B>-descending <I>boolean</I></B> </DT> <DD>Indicates whether the values along the axis are monotonically increasing or decreasing. If <I>boolean</I> is true, the axis values will be decreasing. The default is <I>0</I>. </DD> <DT><B>-hide <I>boolean</I></B> </DT> <DD>Indicates whether the axis is displayed. </DD> <DT><B>-justify <I>justify</I></B> </DT> <DD>Specifies how the axis title should be justified. This matters only when the axis title contains more than one line of text. <I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD> <DT><B>-limits <I>formatStr</I></B> </DT> <DD>Specifies a printf-like description to format the minimum and maximum limits of the axis. The limits are displayed at the top/bottom or left/right sides of the plotting area. <I>FormatStr</I> is a list of one or two format descriptions. If one description is supplied, both the minimum and maximum limits are formatted in the same way. If two, the first designates the format for the minimum limit, the second for the maximum. If <I>""</I> is given as either description, then the that limit will not be displayed. The default is <I>""</I>. </DD> <DT><B>-linewidth <I>pixels</I></B> </DT> <DD>Sets the width of the axis and tick lines. The default is <I>1</I> pixel. </DD> <DT><B>-logscale <I>boolean</I></B> </DT> <DD>Indicates whether the scale of the axis is logarithmic or linear. If <I>boolean</I> is true, the axis is logarithmic. The default scale is linear. </DD> <DT><B>-loose <I>boolean</I></B> </DT> <DD>Indicates whether 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 <I>boolean</I> is true, the axis range is "loose". The default is <I>0</I>. </DD> <DT><B>-majorticks <I>majorList</I></B> </DT> <DD>Specifies where to display major axis ticks. You can use this option to display ticks at non-uniform intervals. <I>MajorList</I> is a list of axis coordinates designating the location of major ticks. No minor ticks are drawn. If <I>majorList</I> is <I>""</I>, major ticks will be automatically computed. The default is <I>""</I>. </DD> <DT><B>-max <I>value</I></B> </DT> <DD>Sets the maximum limit of <I>axisName</I>. Any data point greater than <I>value</I> is not displayed. If <I>value</I> is <I>""</I>, the maximum limit is calculated using the largest data value. The default is <I>""</I>. </DD> <DT><B>-min <I>value</I></B> </DT> <DD>Sets the minimum limit of <I>axisName</I>. Any data point less than <I>value</I> is not displayed. If <I>value</I> is <I>""</I>, the minimum limit is calculated using the smallest data value. The default is <I>""</I>. </DD> <DT><B>-minorticks <I>minorList</I></B> </DT> <DD>Specifies where to display minor axis ticks. You can use this option to display minor ticks at non-uniform intervals. <I>MinorList</I> is a list of real values, ranging from 0.0 to 1.0, designating the placement of a minor tick. No minor ticks are drawn if the <B>-majortick</B> option is also set. If <I>minorList</I> is <I>""</I>, minor ticks will be automatically computed. The default is <I>""</I>. </DD> <DT><B>-rotate <I>theta</I></B> </DT> <DD>Specifies the how many degrees to rotate the axis tick labels. <I>Theta</I> is a real value representing the number of degrees to rotate the tick labels. The default is <I>0.0</I> degrees. </DD> <DT><B>-showticks <I>boolean</I></B> </DT> <DD>Indicates whether axis ticks should be drawn. If <I>boolean</I> is true, ticks are drawn. If false, only the axis line is drawn. The default is <I>1</I>. </DD> <DT><B>-stepsize <I>value</I></B> </DT> <DD>Specifies the interval between major axis ticks. If <I>value</I> isn't a valid interval (must be less than the axis range), the request is ignored and the step size is automatically calculated. </DD> <DT><B>-subdivisions <I>number</I></B> </DT> <DD>Indicates how many minor axis ticks are to be drawn. For example, if <I>number</I> is two, only one minor tick is drawn. If <I>number</I> is one, no minor ticks are displayed. The default is <I>2</I>. </DD> <DT><B>-tickfont <I>fontName</I></B> </DT> <DD>Specifies the font for axis tick labels. The default is <I>*-Courier-Bold-R-Normal-*-100-*</I>. </DD> <DT><B>-ticklength <I>pixels</I></B> </DT> <DD>Sets the length of major and minor ticks (minor ticks are half the length of major ticks). If <I>pixels</I> is less than zero, the axis will be inverted with ticks drawn pointing towards the plot. The default is <I>0.1i</I>. </DD> <DT><B>-title <I>text</I></B> </DT> <DD>Sets the title of the axis. If <I>text</I> is <I>""</I>, no axis title will be displayed. </DD> <DT><B>-titlecolor <I>color</I></B> </DT> <DD>Sets the color of the axis title. The default is <I>black</I>. </DD> <DT><B>-titlefont <I>fontName</I></B> </DT> <DD>Specifies the font for axis title. The default is <I>*-Helvetica-Bold-R-Normal-*-14-140-*</I>. </DD> </DL> <P> Axis configuration options may be also be set by the <B>option</B> command. The resource class is <I>Axis</I>. The resource names are the names of the axes (such as <I>x</I> or <I>x2</I>). <BR> <CODE>option add *Graph.Axis.Color blue<BR> option add *Graph.x.LogScale true<BR> option add *Graph.x2.LogScale false<BR> </blockquote> <DL> <DT></CODE><P><I>pathName <B>axis <B>create <I>axisName </I></B></B></I>?<I>option value</I>?... </DT> <DD>Creates a new axis by the name <I>axisName</I>. No axis by the same name can already exist. <I>Option</I> and <I>value</I> are described in above in the axis <B>configure</B> operation. </DD> <DT><I>pathName <B>axis <B>delete </B></B></I>?<I>axisName</I>?... </DT> <DD>Deletes the named axes. An axis is not really deleted until it is not longer in use, so it's safe to delete axes mapped to elements. </DD> <DT><I>pathName <B>axis invtransform <I>axisName value</I></B></I> </DT> <DD>Performs the inverse transformation, changing the screen coordinate <I>value</I> to a graph coordinate, mapping the value mapped to <I>axisName</I>. Returns the graph coordinate. </DD> <DT><I>pathName <B>axis limits <I>axisName</I></B></I> </DT> <DD>Returns a list of the minimum and maximum limits for <I>axisName</I>. The order of the list is <I>min max</I>. </DD> <DT><I>pathName <B>axis names </B></I>?<I>pattern</I>?... </DT> <DD>Returns a list of axes matching zero or more patterns. If no <I>pattern</I> argument is give, the names of all axes are returned. </DD> <DT><I>pathName <B>axis transform <I>axisName value</I></B></I> </DT> <DD>Transforms the coordinate <I>value</I> to a screen coordinate by mapping the it to <I>axisName</I>. Returns the transformed screen coordinate. </DD> </DL> <P> Only four axes can be displayed simultaneously. By default, they are <I>x</I>, <I>y</I>, <I>x2</I>, and <I>y2</I>. You can swap in a different axis with <B>use</B> operation of the special axis components: <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B>. <BR> <CODE>.g create axis temp<BR> .g create axis time<BR> ...<BR> .g xaxis use temp<BR> .g yaxis use time<BR> </CODE><P>Only the axes specified for use are displayed on the screen. <P> The <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B> components operate on an axis location rather than a specific axis like the more general <B>axis</B> component does. The <B>xaxis</B> component manages the X-axis located in the bottom margin (whatever axis that happens to be). Likewise, <B>yaxis</B> uses the Y-axis in the left margin, <B>x2axis</B> the top X-axis, and <B>y2axis</B> the right Y-axis. <P> They implicitly control the axis that is currently using to that location. By default, <B>xaxis</B> uses the <I>x</I> axis, <B>yaxis</B> uses <I>y</I>, <B>x2axis</B> uses <I>x2</I>, and <B>y2axis</B> uses <I>y2</I>. These components can be more convenient to use than always determining what axes are current being displayed by the graph. <P> The following operations are available for axes. They mirror exactly the operations of the <B>axis</B> component. The <I>axis</I> argument must be <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>, or <B>y2axis</B>. <DL> <DT><I>pathName <I>axis <B>cget <I>option</I></B></I></I> </DT> <DD></DD> <DT><I>pathName <I>axis <B>configure </B></I></I>?<I>option value</I>?... </DT> <DD></DD> <DT><I>pathName <I>axis<B> invtransform <I>value</I></B></I></I> </DT> <DD></DD> <DT><I>pathName <I>axis <B>limits</B></I></I> </DT> <DD></DD> <DT><I>pathName <I>axis<B> transform <I>value</I></B></I></I> </DT> <DD></DD> <DT><I>pathName <I>axis<B> use </B></I></I>?<I>axisName</I>? </DT> <DD>Designates the axis <I>axisName</I> is to be displayed at this location. <I>AxisName</I> can not be already in use at another location. This command returns the name of the axis currently using this location. </DD> </DL> <H3><A NAME="sect9" HREF="#toc9">Crosshairs Component</A></H3> Cross hairs consist of two intersecting lines (one vertical and one horizontal) drawn completely across the plotting area. They are used to position the mouse in relation to the coordinate axes. 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. <P> The following operations are available for cross hairs: <DL> <DT><I>pathName <B>crosshairs cget <I>option</I></B></I> </DT> <DD>Returns the current value of the cross hairs configuration option given by <I>option</I>. <I>Option</I> may be any option described below for the cross hairs <B>configure</B> operation. </DD> <DT><I>pathName <B>crosshairs configure </B></I>?<I>option value</I>?... </DT> <DD>Queries or modifies the configuration options of the cross hairs. If <I>option</I> isn't specified, a list describing all the current options for the cross hairs is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the cross hairs option <I>option</I> is set to <I>value</I>. The following options are available for cross hairs. <blockquote></DD> <DT><B>-color <I>color</I></B> </DT> <DD>Sets the color of the cross hairs. The default is <I>black</I>. </DD> <DT><B>-dashes <I>dashList</I></B> </DT> <DD>Sets the dash style of the cross hairs. <I>DashList</I> is a list of up to 11 numbers that alternately represent the lengths of the dashes and gaps on the cross hair lines. Each number must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the cross hairs will be solid lines. </DD> <DT><B>-hide <I>boolean</I></B> </DT> <DD>Indicates whether cross hairs are drawn. If <I>boolean</I> is true, cross hairs are not drawn. The default is <I>yes</I>. </DD> <DT><B>-linewidth <I>pixels</I></B> </DT> <DD>Set the width of the cross hair lines. The default is <I>1</I>. </DD> <DT><B>-position <I>pos</I></B> </DT> <DD>Specifies the screen position where the cross hairs intersect. <I>Pos</I> must be in the form "<I>@x,y</I>", where <I>x</I> and <I>y</I> are the window coordinates of the intersection. </DD> </DL> <P> Cross hairs configuration options may be also be set by the <B>option</B> command. The resource name and class are <I>crosshairs</I> and <I>Crosshairs</I> respectively. <BR> <CODE>option add *Graph.Crosshairs.LineWidth 2<BR> option add *Graph.Crosshairs.Color red<BR> </blockquote> <DL> <DT></CODE><P><I>pathName <B>crosshairs off</B></I> </DT> <DD>Turns off the cross hairs. </DD> <DT><I>pathName <B>crosshairs on</B></I> </DT> <DD>Turns on the display of the cross hairs. </DD> <DT><I>pathName <B>crosshairs toggle</B></I> </DT> <DD>Toggles the current state of the cross hairs, alternately mapping and unmapping the cross hairs. </DD> </DL> <H3><A NAME="sect10" HREF="#toc10">Element Components</A></H3> A data element represents a set of data. It contains x and y vectors containing 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. <P> When new data elements are created, they are automatically added to a list of displayed elements. The display list controls what elements are drawn and in what order. <P> The following operations are available for elements. <DL> <DT><I>pathName <B>element activate <I>elemName </I></B></I>?<I>index</I>?... </DT> <DD>Specifies the data points of element <I>elemName</I> to be drawn using active foreground and background colors. <I>ElemName</I> is the name of the element and <I>index</I> is a number representing the index of the data point. If no indices are present then all data points become active. </DD> <DT><I>pathName <B>element cget <I>elemName <I>option</I></I></B></I> </DT> <DD>Returns the current value of the element configuration option given by <I>option</I>. <I>Option</I> may be any of the options described below for the element <B>configure</B> operation. </DD> <DT><I>pathName <B>element closest <I>x y</I></B></I> <I>varName</I> ?<I>option value</I>?... ?<I>elemName</I>?... </DT> <DD>Finds the data point closest to the window coordinates <I>x</I> and <I>y</I> in the element <I>elemName</I>. <I>ElemName</I> is the name of an element, that must not be hidden. If no elements are specified, then all visible elements are searched. It returns via the array variable <I>varName</I> the name of the closest element, the index of its closest point, and the graph coordinates of the point. Returns <I>0</I>, if no data point within the threshold distance can be found, otherwise <I>1</I> is returned. The following <I>option</I>-<I>value</I> pairs are available. <blockquote></DD> <DT><B>-halo <I>pixels</I></B> </DT> <DD>Specifies a threshold distance where selected data points are ignored. <I>Pixels</I> is a valid screen distance, such as <I>2</I> or <I>1.2i</I>. If this option isn't specified, then it defaults to the value of the graph's <B>-halo</B> option. </DD> <DT><B>-interpolate <I>boolean</I></B> </DT> <DD>Indicates that both the data points and interpolated points along the line segment formed should be considered. If <I>boolean</I> is true, the closest line segment will be selected instead of the closest point. If this option isn't specified, <I>boolean</I> defaults to <I>0</I>. </DD> </DL> </blockquote> <DL> <DT><I>pathName <B>element configure <I>elemName </I></B></I>?<I>elemName</I>... ?<I>option value</I>?... </DT> <DD>Queries or modifies the configuration options for elements. Several elements can be modified at the same time. If <I>option</I> isn't specified, a list describing all the current options for <I>elemName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing the option <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the element option <I>option</I> is set to <I>value</I>. The following options are valid for elements. <blockquote></DD> <DT><B>-activepen <I>penName</I></B> </DT> <DD>Specifies pen to use to draw active element. If <I>penName</I> is <I>""</I>, no active elements will be drawn. The default is <I>activeLine</I>. </DD> <DT><B>-color <I>color</I></B> </DT> <DD>Sets the color of the traces connecting the data points. </DD> <DT><B>-dashes <I>dashList</I></B> </DT> <DD>Sets the dash style of element line. <I>DashList</I> is a list of up to 11 numbers that alternately represent the lengths of the dashes and gaps on the element line. Each number must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the lines will be solid. </DD> <DT><B>-data <I>coordList</I></B> </DT> <DD>Specifies the X-Y coordinates of the data. <I>CoordList</I> is a list of numeric expressions representing the X-Y coordinate pairs of each data point. </DD> <DT><B>-fill <I>color</I></B> </DT> <DD>Sets the interior color of symbols. If <I>color</I> is <I>""</I>, then the interior of the symbol is transparent. If <I>color</I> is <I>defcolor</I>, then the color will be the same as the <B>-color</B> option. The default is <I>defcolor</I>. </DD> <DT><B>-hide <I>boolean</I></B> </DT> <DD>Indicates whether the element is displayed. The default is <I>no</I>. </DD> <DT><B>-label <I>text</I></B> </DT> <DD>Sets the element's label in the legend. If <I>text</I> is <I>""</I>, the element will have no entry in the legend. The default label is the element's name. </DD> <DT><B>-linewidth <I>pixels</I></B> </DT> <DD>Sets the width of the connecting lines between data points. If <I>pixels</I> is <I>0</I>, no connecting lines will be drawn between symbols. The default is <I>0</I>. </DD> <DT><B>-mapx <I>xAxis</I></B> </DT> <DD>Selects the X-axis to map the element's X-coordinates onto. <I>XAxis</I> must be the name of an axis. The default is <I>x</I>. </DD> <DT><B>-mapy <I>yAxis</I></B> </DT> <DD>Selects the Y-axis to map the element's Y-coordinates onto. <I>YAxis</I> must be the name of an axis. The default is <I>y</I>. </DD> <DT><B>-offdash <I>color</I></B> </DT> <DD>Sets the color of the stripes when traces are dashed (see the <B>-dashes</B> option). If <I>color</I> is <I>""</I>, then the "off" pixels will represent gaps instead of stripes. If <I>color</I> is <I>defcolor</I>, then the color will be the same as the <B>-color</B> option. The default is <I>defcolor</I>. </DD> <DT><B>-outline <I>color</I></B> </DT> <DD>Sets the color or the outline around each symbol. If <I>color</I> is <I>""</I>, then no outline is drawn. If <I>color</I> is <I>defcolor</I>, then the color will be the same as the <B>-color</B> option. The default is <I>defcolor</I>. </DD> <DT><B>-outlinewidth <I>pixels</I></B> </DT> <DD>Sets the width of the outline bordering each symbol. If <I>pixels</I> is <I>0</I>, no outline will be drawn. The default is <I>1</I>. </DD> <DT><B>-pixels <I>pixels</I></B> </DT> <DD>Sets the size of symbols. If <I>pixels</I> is <I>0</I>, no symbols will be drawn. The default is <I>0.125i</I>. </DD> <DT><B>-scalesymbols <I>boolean</I></B> </DT> <DD>If <I>boolean</I> is true, the size of the symbols drawn for <I>elemName</I> will change with scale of the X-axis and Y-axis. 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 drawn at its designated size (see the <B>-pixels</B> option). As the scale of the axes change, the symbol will be scaled according to the smaller of the X-axis and Y-axis scales. If <I>boolean</I> is false, the element's symbols are drawn at the designated size, regardless of axis scales. The default is <I>0</I>. </DD> <DT><B>-smooth <I>smooth</I></B> </DT> <DD>Specifies how connecting line segments are drawn between data points. <I>Smooth</I> can be either <I>linear</I>, <I>step</I>, <I>natural</I>, or <I>quadratic</I>. If <I>smooth</I> is <I>linear</I>, a single line segment is drawn, connecting both data points. When <I>smooth</I> is <I>step</I>, two line segments are drawn. The first is a horizontal line segment that steps the next X-coordinate. The second is a vertical line, moving to the next Y-coordinate. Both <I>natural</I> and <I>quadratic</I> generate multiple segments between data points. If <I>natural</I>, the segments are generated using a cubic spline. If <I>quadratic</I>, a quadratic spline is used. The default is <I>linear</I>. </DD> <DT><B>-styles <I>styleList</I></B> </DT> <DD>Specifies what pen to use based on the range of weights given. <I>StyleList</I> is a list of style specifications. Each style specification, in turn, is a list consisting of a pen name, and optionally a minimum and maximum range. Data points whose weight (see the <B>-weight</B> option) falls in this range, are drawn with this pen. If no range is specified it defaults to the index of the pen in the list. Note that this affects only symbol attributes. Line attributes, such as line width, dashes, etc. are ignored. </DD> <DT><B>-symbol <I>symbol</I></B> </DT> <DD>Specifies the symbol for data points. <I>Symbol</I> can be either <I>square</I>, <I>circle</I>, <I>diamond</I>, <I>plus</I>, <I>cross</I>, <I>splus</I>, <I>scross</I>, <I>triangle</I>, <I>""</I> (where no symbol is drawn), or a bitmap. Bitmaps are specified as "<I>source</I> ?<I>mask</I>?", where <I>source</I> is the name of the bitmap, and <I>mask</I> is the bitmap's optional mask. The default is <I>circle</I>. </DD> <DT><B>-trace <I>direction</I></B> </DT> <DD>Indicates whether connecting lines between data points (whose X-coordinate values are either increasing or decreasing) are drawn. <I>Direction</I> must be <I>increasing</I>, <I>decreasing</I>, or <I>both</I>. For example, if <I>direction</I> is <I>increasing</I>, connecting lines will be drawn only between those data points where X-coordinate values are monotonically increasing. If <I>direction</I> is <I>both</I>, connecting lines will be draw between all data points. The default is <I>both</I>. </DD> <DT><B>-weights <I>wVec</I></B> </DT> <DD>Specifies the weights of the individual data points. This, with the list pen styles (see the <B>-styles</B> option), controls how data points are drawn. <I>WVec</I> is the name of a BLT vector or a list of numeric expressions representing the weights for each data point. </DD> <DT><B>-xdata <I>xVec</I></B> </DT> <DD>Specifies the X-coordinates of the data. <I>XVec</I> is the name of a BLT vector or a list of numeric expressions. </DD> <DT><B>-ydata <I>yVec</I></B> </DT> <DD>Specifies the Y-coordinates of the data. <I>YVec</I> is the name of a BLT vector or a list of numeric expressions. </DD> </DL> <P> Element configuration options may also be set by the <B>option</B> command. The resource class is <I>Element</I>. The resource name is the name of the element. <BR> <CODE>option add *Graph.Element.symbol line<BR> option add *Graph.e1.symbol line<BR> </blockquote> <DL> <DT></CODE><P><I>pathName <B>element create <I>elemName</I></B></I> ?<I>option value</I>?... </DT> <DD>Creates a new element <I>elemName</I>. It's an error is an element <I>elemName</I> already exists. If additional arguments are present, they specify options valid for the element <B>configure</B> operation. </DD> <DT><I>pathName <B>element deactivate <I>elemName</I></B></I> ?<I>elemName</I>?... </DT> <DD>Deactivates all the elements matching <I>pattern</I>. Elements whose names match any of the patterns given are redrawn using their normal colors. </DD> <DT><I>pathName <B>element delete</B></I> ?<I>elemName</I>?... </DT> <DD>Deletes all the named elements. The graph is automatically redrawn. </DD> <DT><I>pathName <B>element exists <I>elemName</I></B></I> </DT> <DD>Returns <I>1</I> if an element <I>elemName</I> currently exists and <I>0</I> otherwise. </DD> <DT><I>pathName <B>element names </B></I>?<I>pattern</I>?... </DT> <DD>Returns the elements matching one or more pattern. If no <I>pattern</I> is given, the names of all elements is returned. </DD> <DT><I>pathName <B>element show</B></I> ?<I>nameList</I>? </DT> <DD>Queries or modifies the element display list. The element display list designates the elements drawn and in what order. <I>NameList</I> is a list of elements to be displayed in the order they are named. If there is no <I>nameList</I> argument, the current display list is returned. </DD> <DT><I>pathName <B>element type</B></I> <I>elemName</I> </DT> <DD>Returns the type of <I>elemName</I>. If the element is a bar element, the commands returns the string <I>"bar"</I>, otherwise it returns <I>"line"</I>. </DD> </DL> <H3><A NAME="sect11" HREF="#toc11"></CODE><P>Grid Component</A></H3> 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. <DL> <DT><I>pathName <B>grid cget <I>option</I></B></I> </DT> <DD>Returns the current value of the grid line configuration option given by <I>option</I>. <I>Option</I> may be any option described below for the grid <B>configure</B> operation. </DD> <DT><I>pathName <B>grid configure</B></I> ?<I>option value</I>?... </DT> <DD>Queries or modifies the configuration options for grid lines. If <I>option</I> isn't specified, a list describing all the current grid options for <I>pathName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the grid line option <I>option</I> is set to <I>value</I>. The following options are valid for grid lines. <blockquote></DD> <DT><B>-color <I>color</I></B> </DT> <DD>Sets the color of the grid lines. The default is <I>black</I>. </DD> <DT><B>-dashes <I>dashList</I></B> </DT> <DD>Sets the dash style of the grid lines. <I>DashList</I> is a list of up to 11 numbers that alternately represent the lengths of the dashes and gaps on the grid lines. Each number must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the grid will be solid lines. </DD> <DT><B>-hide <I>boolean</I></B> </DT> <DD>Indicates whether the grid should be drawn. If <I>boolean</I> is true, grid lines are not shown. The default is <I>yes</I>. </DD> <DT><B>-linewidth <I>pixels</I></B> </DT> <DD>Sets the width of grid lines. The default width is <I>1</I>. </DD> <DT><B>-mapx <I>xAxis</I></B> </DT> <DD>Specifies the X-axis to display grid lines. <I>XAxis</I> must be the name of an axis. The default is <I>x</I>. </DD> <DT><B>-mapy <I>yAxis</I></B> </DT> <DD>Specifies the Y-axis to display grid lines. <I>YAxis</I> must be the name of an axis. The default is <I>y</I>. </DD> <DT><B>-minor <I>boolean</I></B> </DT> <DD>Indicates whether the grid lines should be drawn for minor ticks. If <I>boolean</I> is true, the lines will appear at minor tick intervals. The default is <I>1</I>. </DD> </DL> <P> </blockquote> <H2><A NAME="sect12" HREF="#toc12">Speed Tips</A></H2> There may be cases where the graph needs to be drawn and updated as quickly as possible. If drawing speed becomes a big problem, here are a few tips to speed up displays. <UL> ·<LI>Try to minimize the number of data points. The more data points the looked at, the more work the graph must do. </LI>·<LI>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. </LI>·<LI>Data elements without symbols are drawn faster than with symbols. Set the data element's <B>-symbol</B> option to <I>none</I>. If you need to draw symbols, try using the simple symbols such as <I>splus</I> and <I>scross</I>. </LI>·<LI>Don't stipple or dash the element. Solid lines are much faster. </LI>·<LI>If you update data elements frequently, try turning off the widget's <B>-bufferelements</B> option. 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. </LI> </UL> <H2><A NAME="sect13" HREF="#toc13">Limitations</A></H2> Auto-scale routines do not use requested min/max limits as boundaries when the axis is logarithmically scaled. <P> 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. <H2><A NAME="sect14" HREF="#toc14">Future Incompatibility</A></H2> The <B>-mapped</B> options are obsoleted and will be removed. You can achieve the same results using the <B>-hide</B> option instead. <BR> <CODE># Works for now.<BR> .g legend configure -mapped no<BR> <P> # Instead use this.<BR> .g legend configure -hide yes <BR> <H2><A NAME="sect15" HREF="#toc15"></CODE><P>Keywords</A></H2> graph, widget <P> <HR><P> <A NAME="toc"><B>Table of Contents</B></A><P> <UL> <LI><A NAME="toc0" HREF="#sect0">Name</A></LI> <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI> <LI><A NAME="toc2" HREF="#sect2">Description</A></LI> <LI><A NAME="toc3" HREF="#sect3">Example</A></LI> <LI><A NAME="toc4" HREF="#sect4">Syntax</A></LI> <LI><A NAME="toc5" HREF="#sect5">Example</A></LI> <LI><A NAME="toc6" HREF="#sect6">Graph Operations</A></LI> <LI><A NAME="toc7" HREF="#sect7">Graph Components</A></LI> <UL> <LI><A NAME="toc8" HREF="#sect8">Axis Components</A></LI> <LI><A NAME="toc9" HREF="#sect9">Crosshairs Component</A></LI> <LI><A NAME="toc10" HREF="#sect10">Element Components</A></LI> <LI><A NAME="toc11" HREF="#sect11">Grid Component</A></LI> </UL> <LI><A NAME="toc12" HREF="#sect12">Speed Tips</A></LI> <LI><A NAME="toc13" HREF="#sect13">Limitations</A></LI> <LI><A NAME="toc14" HREF="#sect14">Future Incompatibility</A></LI> <LI><A NAME="toc15" HREF="#sect15">Keywords</A></LI> </UL> </BODY></HTML>