Debian Codegraph @

html/graph.html

raw symbols SCIP
1
2 <!-- manual page source format generated by PolyglotMan v3.0.9, -->
3 <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
4
5 <HTML>
6 <HEAD>
7 <TITLE>graph(n) manual page</TITLE><!--#include virtual="/man/maninc.html"-->
8 </HEAD>
9 <BODY bgcolor=white>
10 <A HREF="#toc">Table of Contents</A><P>
11
12 <H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
13 graph - 2D graph for plotting
14 X-Y coordinate data.
15 <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
16 <B>graph<I> <I>pathName </I></I></B>?<I>option value</I>?...
17 <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
18 The
19 <B>graph</B> command creates a graph for plotting two-dimensional data (X-Y coordinates).
20 It has many configurable components: coordinate axes, elements, legend,
21 grid lines, cross hairs, etc. They allow you to customize the look and
22 feel of the graph.
23 <H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2>
24 The <B>graph</B> command creates a new window for
25 plotting two-dimensional data (X-Y coordinates). Data points are plotted
26 in a rectangular area displayed in the center of the new window. This is
27 the <I>plotting area</I>. The coordinate axes are drawn in the margins around
28 the plotting area. By default, the legend is displayed in the right margin.
29 The title is displayed in top margin. <P>
30 The <B>graph</B> widget is composed of several
31 components: coordinate axes, data elements, legend, grid, cross hairs,
32 pens, postscript, and annotation markers.
33 <DL>
34
35 <DT>axis </DT>
36 <DD>The graph has four standard
37 axes (x, x2, y, and y2), but you can create and display any number
38 of axes. Axes control what region of data is displayed and how the data
39 is scaled. Each axis consists of the axis line, title, major and minor ticks,
40 and tick labels. Tick labels display the value at each major tick. </DD>
41
42 <DT>crosshairs
43 </DT>
44 <DD>Cross hairs are used to position the mouse pointer relative to the X and
45 Y coordinate axes. Two perpendicular lines, intersecting at the current
46 location of the mouse, extend across the plotting area to the coordinate
47 axes. </DD>
48
49 <DT>element </DT>
50 <DD>An element represents a set of data points. Elements can
51 be plotted with a symbol at each data point and lines connecting the points.
52 The appearance of the element, such as its symbol, line width, and color
53 is configurable. </DD>
54
55 <DT>grid </DT>
56 <DD>Extends the major and minor ticks of the X-axis and/or
57 Y-axis across the plotting area. </DD>
58
59 <DT>legend </DT>
60 <DD>The legend displays the name
61 and symbol of each data element. The legend can be drawn in any margin
62 or in the plotting area. </DD>
63
64 <DT>marker </DT>
65 <DD>Markers are used annotate or highlight
66 areas of the graph. For example, you could use a polygon marker to fill
67 an area under a curve, or a text marker to label a particular data point.
68 Markers come in various forms: text strings, bitmaps, connected line
69 segments, images, polygons, or embedded widgets. </DD>
70
71 <DT>pen </DT>
72 <DD>Pens define attributes
73 (both symbol and line style) for elements. Data elements use pens to specify
74 how they should be drawn. A data element may use many pens at once. Here,
75 the particular pen used for a data point is determined from each element's
76 weight vector (see the element's <B>-weight</B> and <B>-style</B> options). </DD>
77
78 <DT>postscript
79 </DT>
80 <DD>The widget can generate encapsulated PostScript output. This component has
81 several options to configure how the PostScript is generated. </DD>
82 </DL>
83
84 <H2><A NAME="sect4" HREF="#toc4">Syntax</A></H2>
85 <BR>
86 <P>
87 <CODE><B>graph <I>pathName </I></B>?<I>option value</I>?...<BR>
88 </CODE>The <B>graph</B> command creates a new window <I>pathName</I> and makes it into a <B>graph</B>
89 widget. At the time this command is invoked, there must not exist a window
90 named <I>pathName</I>, but <I>pathName</I>'s parent must exist. Additional options may
91 be specified on the command line or in the option database to configure
92 aspects of the graph such as its colors and font. See the <B>configure</B> operation
93 below for the exact details about what <I>option</I> and <I>value</I> pairs are valid.
94 <P>
95 If successful, <B>graph</B> returns the path name of the widget. It also creates
96 a new Tcl command by the same name. You can use this command to invoke
97 various operations that query or modify the graph. The general form is:
98 <BR>
99 <P>
100 <CODE><I>pathName <I>operation</I></I> ?<I>arg</I>?...<BR>
101 </CODE>Both <I>operation</I> and its arguments determine the exact behavior of the command.
102 The operations available for the graph are described in the <FONT SIZE=-1><B>GRAPH OPERATIONS</B></FONT>
103
104 section. <P>
105 The command can also be used to access components of the graph.
106 <BR>
107 <P>
108 <CODE><I>pathName component operation</I> ?<I>arg</I>?...<BR>
109 </CODE>The operation, now located after the name of the component, is the function
110 to be performed on that component. Each component has its own set of operations
111 that manipulate that component. They will be described below in their own
112 sections.
113 <H2><A NAME="sect5" HREF="#toc5">Example</A></H2>
114 The <B>graph</B> command creates a new graph. <BR>
115 <CODE># Create a new graph. Plotting area is black.<BR>
116 graph .g -plotbackground black<BR>
117 </CODE>A new Tcl command .g is also created. This command can be used to query
118 and modify the graph. For example, to change the title of the graph to
119 "My Plot", you use the new command and the graph's <B>configure</B> operation. <BR>
120 <CODE># Change the title.<BR>
121 .g configure -title "My Plot"<BR>
122 </CODE>A graph has several components. To access a particular component you use
123 the component's name. For example, to add data elements, you use the new
124 command and the <B>element</B> component. <BR>
125 <CODE># Create a new element named "line1"<BR>
126 .g element create line1 \<BR>
127 <tt> </tt>&nbsp;<tt> </tt>&nbsp;-xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \<BR>
128 <tt> </tt>&nbsp;<tt> </tt>&nbsp;-ydata { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 <BR>
129 <tt> </tt>&nbsp;<tt> </tt>&nbsp;<tt> </tt>&nbsp;<tt> </tt>&nbsp;155.85 166.60 175.38 }<BR>
130 </CODE>The element's X-Y coordinates are specified using lists of numbers. Alternately,
131 BLT vectors could be used to hold the X-Y coordinates. <BR>
132 <CODE># Create two vectors and add them to the graph.<BR>
133 vector xVec yVec<BR>
134 xVec set { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 }<BR>
135 yVec set { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 <BR>
136 <tt> </tt>&nbsp;<tt> </tt>&nbsp;166.60 175.38 }<BR>
137 .g element create line1 -xdata xVec -ydata yVec<BR>
138 </CODE>The advantage of using vectors is that when you modify one, the graph is
139 automatically redrawn to reflect the new values. <BR>
140 <CODE># Change the y coordinate of the first point.<BR>
141 set yVector(0) 25.18<BR>
142 </CODE>An element named e1 is now created in .b. It is automatically added
143 to the display list of elements. You can use this list to control in what
144 order elements are displayed. To query or reset the element display list,
145 you use the element's <B>show</B> operation. <BR>
146 <CODE># Get the current display list <BR>
147 set elemList [.b element show]<BR>
148 # Remove the first element so it won't be displayed.<BR>
149 .b element show [lrange $elemList 0 end]<BR>
150 </CODE>The element will be displayed by as many bars as there are data points
151 (in this case there are ten). The bars will be drawn centered at the x-coordinate
152 of the data point. All the bars will have the same attributes (colors,
153 stipple, etc). The width of each bar is by default one unit. You can change
154 this with using the <B>-barwidth</B> option. <BR>
155 <CODE># Change the X-Y coordinates of the first point.<BR>
156 set xVec(0) 0.18<BR>
157 set yVec(0) 25.18<BR>
158 </CODE>An element named line1 is now created in .g. By default, the element's
159 label in the legend will be also line1. You can change the label, or specify
160 no legend entry, again using the element's <B>configure</B> operation. <BR>
161 <CODE># Don't display "line1" in the legend.<BR>
162 .g element configure line1 -label ""<BR>
163 </CODE>You can configure more than just the element's label. An element has many
164 attributes such as symbol type and size, dashed or solid lines, colors,
165 line width, etc. <BR>
166 <CODE>.g element configure line1 -symbol square -color red \<BR>
167 <tt> </tt>&nbsp;<tt> </tt>&nbsp;-dashes { 2 4 2 } -linewidth 2 -pixels 2c<BR>
168 </CODE>Four coordinate axes are automatically created: x, x2, y, and y2.
169 And by default, elements are mapped onto the axes x and y. This can
170 be changed with the <B>-mapx</B> and <B>-mapy</B> options. <BR>
171 <CODE># Map "line1" on the alternate Y-axis "y2".<BR>
172 .g element configure line1 -mapy y2<BR>
173 </CODE>Axes can be configured in many ways too. For example, you change the scale
174 of the Y-axis from linear to log using the <B>axis</B> component. <BR>
175 <CODE># Y-axis is log scale.<BR>
176 .g axis configure y -logscale yes<BR>
177 </CODE>One important way axes are used is to zoom in on a particular data region.
178 Zooming is done by simply specifying new axis limits using the <B>-min</B> and
179 <B>-max</B> configuration options. <BR>
180 <CODE>.g axis configure x -min 1.0 -max 1.5<BR>
181 .g axis configure y -min 12.0 -max 55.15<BR>
182 </CODE>To zoom interactively, you link the <B>axis configure</B> operations with some
183 user interaction (such as pressing the mouse button), using the <B>bind</B> command.
184 To convert between screen and graph coordinates, use the <B>invtransform</B>
185 operation. <BR>
186 <CODE># Click the button to set a new minimum <BR>
187 bind .g &lt;ButtonPress-1&gt; { <BR>
188 %W axis configure x -min [%W axis invtransform x %x]<BR>
189 %W axis configure x -min [%W axis invtransform x %y]<BR>
190 }<BR>
191 </CODE>By default, the limits of the axis are determined from data values. To reset
192 back to the default limits, set the <B>-min</B> and <B>-max</B> options to the empty value.
193 <BR>
194 <CODE># Reset the axes to autoscale again.<BR>
195 .g axis configure x -min {} -max {}<BR>
196 .g axis configure y -min {} -max {}<BR>
197 </CODE>By default, the legend is drawn in the right margin. You can change this
198 or any legend configuration options using the <B>legend</B> component. <BR>
199 <CODE># Configure the legend font, color, and relief<BR>
200 .g legend configure -position left -relief raised \<BR>
201 <tt> </tt>&nbsp;<tt> </tt>&nbsp;-font fixed -fg blue<BR>
202 </CODE>To prevent the legend from being displayed, turn on the <B>-hide</B> option. <BR>
203 <CODE># Don't display the legend.<BR>
204 .g legend configure -hide yes<BR>
205 </CODE>The <B>graph</B> widget has simple drawing procedures called markers. They can
206 be used to highlight or annotate data in the graph. The types of markers
207 available are bitmaps, images, polygons, lines, or windows. Markers can
208 be used, for example, to mark or brush points. In this example, is a text
209 marker that labels the data first point. Markers are created using the
210 <B>marker</B> component. <BR>
211 <CODE># Create a label for the first data point of "line1".<BR>
212 .g marker create text -name first_marker -coords { 0.2 26.18 } \<BR>
213 <tt> </tt>&nbsp;<tt> </tt>&nbsp;-text "start" -anchor se -xoffset -10 -yoffset -10<BR>
214 </CODE>This creates a text marker named first_marker. It will display the text
215 "start" near the coordinates of the first data point. The <B>-anchor</B>, <B>-xoffset</B>,
216 and <B>-yoffset</B> options are used to display the marker above and to the left
217 of the data point, so that the data point isn't covered by the marker. By
218 default, markers are drawn last, on top of data. You can change this with
219 the <B>-under</B> option. <BR>
220 <CODE># Draw the label before elements are drawn.<BR>
221 .g marker configure first_marker -under yes<BR>
222 </CODE>You can add cross hairs or grid lines using the <B>crosshairs</B> and <B>grid</B> components.
223 <BR>
224 <CODE># Display both cross hairs and grid lines.<BR>
225 .g crosshairs configure -hide no -color red<BR>
226 .g grid configure -hide no -dashes { 2 2 }<BR>
227 # Set up a binding to reposition the crosshairs.<BR>
228 bind .g &lt;Motion&gt; {<BR>
229 .g crosshairs configure -position @%x,%y<BR>
230 }<BR>
231 </CODE>The crosshairs are repositioned as the mouse pointer is moved in the graph.
232 The pointer X-Y coordinates define the center of the crosshairs. <P>
233 Finally,
234 to get hardcopy of the graph, use the <B>postscript</B> component. <BR>
235 <CODE># Print the graph into file "file.ps"<BR>
236 .g postscript output file.ps -maxpect yes -decorations no<BR>
237 </CODE>This generates a file file.ps containing the encapsulated PostScript of
238 the graph. The option <B>-maxpect</B> says to scale the plot to the size of the
239 page. Turning off the <B>-decorations</B> option denotes that no borders or color
240 backgrounds should be drawn (i.e. the background of the margins, legend,
241 and plotting area will be white).
242 <H2><A NAME="sect6" HREF="#toc6">Graph Operations</A></H2>
243
244 <DL>
245
246 <DT><I>pathName <B>axis <I>operation
247 </I></B></I>?<I>arg</I>?... </DT>
248 <DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT>
249 section. </DD>
250
251 <DT><I>pathName <B>bar <I>elemName </I></B></I>?<I>option value</I>?...
252 </DT>
253 <DD>Creates a new barchart element <I>elemName</I>. It's an error if an element <I>elemName</I>
254 already exists. See the manual for <B>barchart</B> for details about what <I>option</I>
255 and <I>value</I> pairs are valid. </DD>
256
257 <DT><I>pathName <B>cget</B></I> <I>option</I> </DT>
258 <DD>Returns the current value
259 of the configuration option given by <I>option</I>. <I>Option</I> may be any option described
260 below for the <B>configure</B> operation. </DD>
261
262 <DT><I>pathName <B>configure </B></I>?<I>option value</I>?... </DT>
263 <DD>Queries
264 or modifies the configuration options of the graph. If <I>option</I> isn't specified,
265 a list describing the current options for <I>pathName</I> is returned. If <I>option</I>
266 is specified, but not <I>value</I>, then a list describing <I>option</I> is returned.
267 If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair,
268 the option <I>option</I> is set to <I>value</I>. The following options are valid. <blockquote></DD>
269
270 <DT><B>-aspect
271 <I>width/height</I></B> </DT>
272 <DD>Force a fixed aspect ratio of <I>width/height</I>, a floating point
273 number. </DD>
274
275 <DT><B>-background <I>color</I></B> </DT>
276 <DD>Sets the background color. This includes the margins
277 and legend, but not the plotting area. </DD>
278
279 <DT><B>-borderwidth <I>pixels</I></B> </DT>
280 <DD>Sets the width
281 of the 3-D border around the outside edge of the widget. The <B>-relief</B> option
282 determines if the border is to be drawn. The default is 2. </DD>
283
284 <DT><B>-bottommargin
285 <I>pixels</I></B> </DT>
286 <DD>If non-zero, overrides the computed size of the margin extending
287 below the X-coordinate axis. If <I>pixels</I> is 0, the automatically computed
288 size is used. The default is 0. </DD>
289
290 <DT><B>-bufferelements <I>boolean</I></B> </DT>
291 <DD>Indicates whether
292 an internal pixmap to buffer the display of data elements should be used.
293 If <I>boolean</I> is true, data elements are drawn to an internal pixmap. This
294 option is especially useful when the graph is redrawn frequently while
295 the remains data unchanged (for example, moving a marker across the plot).
296 See the <FONT SIZE=-1><B>SPEED TIPS</B></FONT>
297 section. The default is 1. </DD>
298
299 <DT><B>-cursor <I>cursor</I></B> </DT>
300 <DD>Specifies
301 the widget's cursor. The default cursor is crosshair. </DD>
302
303 <DT><B>-font <I>fontName</I></B> </DT>
304 <DD>Specifies
305 the font of the graph title. The default is *-Helvetica-Bold-R-Normal-*-18-180-*.
306 </DD>
307
308 <DT><B>-halo <I>pixels</I></B> </DT>
309 <DD>Specifies a maximum distance to consider when searching for
310 the closest data point (see the element's <B>closest</B> operation below). Data
311 points further than <I>pixels</I> away are ignored. The default is 0.5i. </DD>
312
313 <DT><B>-height
314 <I>pixels</I></B> </DT>
315 <DD>Specifies the requested height of widget. The default is 4i. </DD>
316
317 <DT><B>-invertxy
318 <I>boolean</I></B> </DT>
319 <DD>Indicates whether the placement X-axis and Y-axis should be inverted.
320 If <I>boolean</I> is true, the X and Y axes are swapped. The default is 0. </DD>
321
322 <DT><B>-justify
323 <I>justify</I></B> </DT>
324 <DD>Specifies how the title should be justified. This matters only
325 when the title contains more than one line of text. <I>Justify</I> must be left,
326 right, or center. The default is center. </DD>
327
328 <DT><B>-leftmargin <I>pixels</I></B> </DT>
329 <DD>If non-zero,
330 overrides the computed size of the margin extending from the left edge
331 of the window to the Y-coordinate axis. If <I>pixels</I> is 0, the automatically
332 computed size is used. The default is 0. </DD>
333
334 <DT><B>-plotbackground <I>color</I></B> </DT>
335 <DD>Specifies
336 the background color of the plotting area. The default is white. </DD>
337
338 <DT><B>-plotborderwidth
339 <I>pixels</I></B> </DT>
340 <DD>Sets the width of the 3-D border around the plotting area. The <B>-plotrelief</B>
341 option determines if a border is drawn. The default is 2. </DD>
342
343 <DT><B>-plotpadx <I>pad</I></B>
344 </DT>
345 <DD>Sets the amount of padding to be added to the left and right sides of the
346 plotting area. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I>
347 has two elements, the left side of the plotting area entry is padded by
348 the first distance and the right side by the second. If <I>pad</I> is just one
349 distance, both the left and right sides are padded evenly. The default
350 is 8. </DD>
351
352 <DT><B>-plotpady <I>pad</I></B> </DT>
353 <DD>Sets the amount of padding to be added to the top and
354 bottom of the plotting area. <I>Pad</I> can be a list of one or two screen distances.
355 If <I>pad</I> has two elements, the top of the plotting area is padded by the
356 first distance and the bottom by the second. If <I>pad</I> is just one distance,
357 both the top and bottom are padded evenly. The default is 8. </DD>
358
359 <DT><B>-plotrelief
360 <I>relief</I></B> </DT>
361 <DD>Specifies the 3-D effect for the plotting area. <I>Relief</I> specifies
362 how the interior of the plotting area should appear relative to rest of
363 the graph; for example, raised means the plot should appear to protrude
364 from the graph, relative to the surface of the graph. The default is sunken.
365 </DD>
366
367 <DT><B>-relief <I>relief</I></B> </DT>
368 <DD>Specifies the 3-D effect for the graph widget. <I>Relief</I> specifies
369 how the graph should appear relative to widget it is packed into; for example,
370 raised means the graph should appear to protrude. The default is flat.
371 </DD>
372
373 <DT><B>-rightmargin <I>pixels</I></B> </DT>
374 <DD>If non-zero, overrides the computed size of the margin
375 extending from the plotting area to the right edge of the window. By default,
376 the legend is drawn in this margin. If <I>pixels</I> is 0, the automatically
377 computed size is used. The default is 0. </DD>
378
379 <DT><B>-takefocus</B> <I>focus</I> </DT>
380 <DD>Provides information
381 used when moving the focus from window to window via keyboard traversal
382 (e.g., Tab and Shift-Tab). If <I>focus</I> is 0, this means that this window should
383 be skipped entirely during keyboard traversal. 1 means that the this
384 window should always receive the input focus. An empty value means that
385 the traversal scripts make the decision whether to focus on the window.
386 The default is "". </DD>
387
388 <DT><B>-tile <I>image</I></B> </DT>
389 <DD>Specifies a tiled background for the widget.
390 If <I>image</I> isn't "", the background is tiled using <I>image</I>. Otherwise, the
391 normal background color is drawn (see the <B>-background</B> option). <I>Image</I> must
392 be an image created using the Tk <B>image</B> command. The default is "". </DD>
393
394 <DT><B>-title
395 <I>text</I></B> </DT>
396 <DD>Sets the title to <I>text</I>. If <I>text</I> is "", no title will be displayed.
397 </DD>
398
399 <DT><B>-topmargin <I>pixels</I></B> </DT>
400 <DD>If non-zero, overrides the computed size of the margin
401 above the x2 axis. If <I>pixels</I> is 0, the automatically computed size is
402 used. The default is 0. </DD>
403
404 <DT><B>-width <I>pixels</I></B> </DT>
405 <DD>Specifies the requested width of
406 the widget. The default is 5i. </DD>
407 </DL>
408 </blockquote>
409
410 <DL>
411
412 <DT><I>pathName <B>crosshairs <I>operation </I></B></I>?<I>arg</I>? </DT>
413 <DD>See
414 the <FONT SIZE=-1><B>CROSSHAIRS COMPONENT</B></FONT>
415 section. </DD>
416
417 <DT><I>pathName <B>element <I>operation </I></B></I>?<I>arg</I>?... </DT>
418 <DD>See
419 the <FONT SIZE=-1><B>ELEMENT COMPONENTS</B></FONT>
420 section. </DD>
421
422 <DT><I>pathName <B>extents <I>item</I></B></I> </DT>
423 <DD>Returns the size
424 of a particular item in the graph. <I>Item</I> must be either leftmargin, rightmargin,
425 topmargin, bottommargin, plotwidth, or plotheight. </DD>
426
427 <DT><I>pathName <B>grid
428 <I>operation </I></B></I>?<I>arg</I>?... </DT>
429 <DD>See the <FONT SIZE=-1><B>GRID COMPONENT</B></FONT>
430 section. </DD>
431
432 <DT><I>pathName <B>invtransform
433 <I>winX winY</I></B></I> </DT>
434 <DD>Performs an inverse coordinate transformation, mapping window
435 coordinates back to graph coordinates, using the standard X-axis and Y-axis.
436 Returns a list of containing the X-Y graph coordinates. </DD>
437
438 <DT><I>pathName <B>inside <I>x
439 y</I></B></I> </DT>
440 <DD>Returns 1 is the designated screen coordinate (<I>x</I> and <I>y</I>) is inside the
441 plotting area and 0 otherwise. </DD>
442
443 <DT><I>pathName <B>legend <I>operation </I></B></I>?<I>arg</I>?... </DT>
444 <DD>See the
445 <FONT SIZE=-1><B>LEGEND COMPONENT</B></FONT>
446 section. </DD>
447
448 <DT><I>pathName <B>line<B> operation arg</B></B></I>... </DT>
449 <DD>The operation is
450 the same as <B>element</B>. </DD>
451
452 <DT><I>pathName <B>marker <I>operation </I></B></I>?<I>arg</I>?... </DT>
453 <DD>See the <FONT SIZE=-1><B>MARKER COMPONENTS</B></FONT>
454
455 section. </DD>
456
457 <DT><I>pathName <B>postscript <I>operation </I></B></I>?<I>arg</I>?... </DT>
458 <DD>See the <FONT SIZE=-1><B>POSTSCRIPT COMPONENT</B></FONT>
459
460 section. </DD>
461
462 <DT><I>pathName <B>snap </B></I>?<I>switches</I>? <I>outputName</I> </DT>
463 <DD>Takes a snapshot of the graph,
464 saving the output in <I>outputName</I>. The following switches are available. <blockquote></DD>
465
466 <DT><B>-format</B>
467 <I>format</I> </DT>
468 <DD>Specifies how the snapshot is output. <I>Format</I> may be one of the following
469 listed below. The default is photo. <blockquote></DD>
470
471 <DT>photo </DT>
472 <DD>Saves a Tk photo image. <I>OutputName</I>
473 represents the name of a Tk photo image that must already have been created.
474 </DD>
475
476 <DT>wmf </DT>
477 <DD>Saves an Aldus Placeable Metafile. <I>OutputName</I> represents the filename
478 where the metafile is written. If <I>outputName</I> is CLIPBOARD, then output
479 is written directly to the Windows clipboard. This format is available
480 only under Microsoft Windows. </DD>
481
482 <DT>emf </DT>
483 <DD>Saves an Enhanced Metafile. <I>OutputName</I>
484 represents the filename where the metafile is written. If <I>outputName</I> is
485 CLIPBOARD, then output is written directly to the Windows clipboard.
486 This format is available only under Microsoft Windows. </DD>
487 </DL>
488 </blockquote>
489
490 <DL>
491
492 <DT><B>-height</B> <I>size</I> </DT>
493 <DD>Specifies
494 the height of the graph. <I>Size</I> is a screen distance. The graph will be redrawn
495 using this dimension, rather than its current window height. </DD>
496
497 <DT><B>-width</B> <I>size</I>
498 </DT>
499 <DD>Specifies the width of the graph. <I>Size</I> is a screen distance. The graph will
500 be redrawn using this dimension, rather than its current window width. </DD>
501 </DL>
502 </blockquote>
503
504 <DL>
505
506 <DT><I>pathName
507 <B>transform <I>x y</I></B></I> </DT>
508 <DD>Performs a coordinate transformation, mapping graph coordinates
509 to window coordinates, using the standard X-axis and Y-axis. Returns a list
510 containing the X-Y screen coordinates. </DD>
511
512 <DT><I>pathName <B>xaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
513 <DD></DD>
514
515 <DT><I>pathName
516 <B>x2axis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
517 <DD></DD>
518
519 <DT><I>pathName <B>yaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
520 <DD></DD>
521
522 <DT><I>pathName <B>y2axis
523 <I>operation</I></B></I> ?<I>arg</I>?... </DT>
524 <DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT>
525 section. </DD>
526 </DL>
527
528 <H2><A NAME="sect7" HREF="#toc7">Graph Components</A></H2>
529 A graph
530 is composed of several components: coordinate axes, data elements, legend,
531 grid, cross hairs, postscript, and annotation markers. Instead of one big
532 set of configuration options and operations, the graph is partitioned,
533 where each component has its own configuration options and operations that
534 specifically control that aspect or part of the graph.
535 <H3><A NAME="sect8" HREF="#toc8">Axis Components</A></H3>
536 Four
537 coordinate axes are automatically created: two X-coordinate axes (x and
538 x2) and two Y-coordinate axes (y, and y2). By default, the axis x
539 is located in the bottom margin, y in the left margin, x2 in the top
540 margin, and y2 in the right margin. <P>
541 An axis consists of the axis line,
542 title, major and minor ticks, and tick labels. Major ticks are drawn at
543 uniform intervals along the axis. Each tick is labeled with its coordinate
544 value. Minor ticks are drawn at uniform intervals within major ticks.
545 <P>
546 The range of the axis controls what region of data is plotted. Data points
547 outside the minimum and maximum limits of the axis are not plotted. By
548 default, the minimum and maximum limits are determined from the data, but
549 you can reset either limit. <P>
550 You can have several axes. To create an axis,
551 invoke the axis component and its create operation. <BR>
552 <CODE># Create a new axis called "tempAxis"<BR>
553 .g axis create tempAxis<BR>
554 </CODE>You map data elements to an axis using the element's -mapy and -mapx configuration
555 options. They specify the coordinate axes an element is mapped onto. <BR>
556 <CODE># Now map the tempAxis data to this axis.<BR>
557 .g element create "e1" -xdata $x -ydata $y -mapy tempAxis<BR>
558 </CODE>Any number of axes can be displayed simultaneously. They are drawn in the
559 margins surrounding the plotting area. The default axes x and y are
560 drawn in the bottom and left margins. The axes x2 and y2 are drawn in
561 top and right margins. By default, only x and y are shown. Note that
562 the axes can have different scales. <P>
563 To display a different axis or more
564 than one axis, you invoke one of the following components: <B>xaxis</B>, <B>yaxis</B>,
565 <B>x2axis</B>, and <B>y2axis</B>. Each component has a <B>use</B> operation that designates
566 the axis (or axes) to be drawn in that corresponding margin: <B>xaxis</B> in the
567 bottom, <B>yaxis</B> in the left, <B>x2axis</B> in the top, and <B>y2axis</B> in the right. <BR>
568 <CODE># Display the axis tempAxis in the left margin.<BR>
569 .g yaxis use tempAxis<BR>
570 </CODE>The <B>use</B> operation takes a list of axis names as its last argument. This
571 is the list of axes to be drawn in this margin. <P>
572 You can configure axes in
573 many ways. The axis scale can be linear or logarithmic. The values along
574 the axis can either monotonically increase or decrease. If you need custom
575 tick labels, you can specify a Tcl procedure to format the label any way
576 you wish. You can control how ticks are drawn, by changing the major tick
577 interval or the number of minor ticks. You can define non-uniform tick intervals,
578 such as for time-series plots. <P>
579
580 <DL>
581
582 <DT><I>pathName <B>axis bind <I>tagName</I></B></I> ?<I>sequence</I>? ?<I>command</I>?
583 </DT>
584 <DD>Associates <I>command</I> with <I>tagName</I> such that whenever the event sequence
585 given by <I>sequence</I> occurs for an axis with this tag, <I>command</I> will be invoked.
586 The syntax is similar to the <B>bind</B> command except that it operates on
587 graph axes, rather than widgets. See the <B>bind</B> manual entry for complete
588 details on <I>sequence</I> and the substitutions performed on <I>command</I> before
589 invoking it. <P>
590 If all arguments are specified then a new binding is created,
591 replacing any existing binding for the same <I>sequence</I> and <I>tagName</I>. If the
592 first character of <I>command</I> is + then <I>command</I> augments an existing binding
593 rather than replacing it. If no <I>command</I> argument is provided then the command
594 currently associated with <I>tagName</I> and <I>sequence</I> (it's an error occurs if
595 there's no such binding) is returned. If both <I>command</I> and <I>sequence</I> are
596 missing then a list of all the event sequences for which bindings have
597 been defined for <I>tagName</I>. </DD>
598
599 <DT><I>pathName <B>axis <B>cget <I>axisName <I>option</I></I></B></B></I> </DT>
600 <DD>Returns the
601 current value of the option given by <I>option</I> for <I>axisName</I>. <I>Option</I> may be
602 any option described below for the axis <B>configure</B> operation. </DD>
603
604 <DT><I>pathName <B>axis
605 <B>configure <I>axisName </I></B></B></I>?<I>axisName</I>?... ?<I>option value</I>?... </DT>
606 <DD>Queries or modifies the configuration
607 options of <I>axisName</I>. Several axes can be changed. If <I>option</I> isn't specified,
608 a list describing all the current options for <I>axisName</I> is returned. If
609 <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is returned.
610 If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair,
611 the axis option <I>option</I> is set to <I>value</I>. The following options are valid
612 for axes. <blockquote></DD>
613
614 <DT><B>-bindtags <I>tagList</I></B> </DT>
615 <DD>Specifies the binding tags for the axis. <I>TagList</I>
616 is a list of binding tag names. The tags and their order will determine
617 how events for axes are handled. Each tag in the list matching the current
618 event sequence will have its Tcl command executed. Implicitly the name
619 of the element is always the first tag in the list. The default value is
620 all. </DD>
621
622 <DT><B>-color <I>color</I></B> </DT>
623 <DD>Sets the color of the axis and tick labels. The default
624 is black. </DD>
625
626 <DT><B>-command <I>prefix</I></B> </DT>
627 <DD>Specifies a Tcl command to be invoked when formatting
628 the axis tick labels. <I>Prefix</I> is a string containing the name of a Tcl proc
629 and any extra arguments for the procedure. This command is invoked for
630 each major tick on the axis. Two additional arguments are passed to the
631 procedure: the pathname of the widget and the current the numeric value
632 of the tick. The procedure returns the formatted tick label. If "" is
633 returned, no label will appear next to the tick. You can get the standard
634 tick labels again by setting <I>prefix</I> to "". The default is "". <P>
635 Please
636 note that this procedure is invoked while the graph is redrawn. You may
637 query configuration options. But do not them, because this can have unexpected
638 results. </DD>
639
640 <DT><B>-descending <I>boolean</I></B> </DT>
641 <DD>Indicates whether the values along the axis
642 are monotonically increasing or decreasing. If <I>boolean</I> is true, the axis
643 values will be decreasing. The default is 0. </DD>
644
645 <DT><B>-hide <I>boolean</I></B> </DT>
646 <DD>Indicates if
647 the axis is displayed. If <I>boolean</I> is false the axis will be displayed. Any
648 element mapped to the axis is displayed regardless. The default value is
649 0. </DD>
650
651 <DT><B>-justify <I>justify</I></B> </DT>
652 <DD>Specifies how the axis title should be justified. This
653 matters only when the axis title contains more than one line of text. <I>Justify</I>
654 must be left, right, or center. The default is center. </DD>
655
656 <DT><B>-limits <I>formatStr</I></B>
657 </DT>
658 <DD>Specifies a printf-like description to format the minimum and maximum limits
659 of the axis. The limits are displayed at the top/bottom or left/right sides
660 of the plotting area. <I>FormatStr</I> is a list of one or two format descriptions.
661 If one description is supplied, both the minimum and maximum limits are
662 formatted in the same way. If two, the first designates the format for
663 the minimum limit, the second for the maximum. If "" is given as either
664 description, then the that limit will not be displayed. The default is
665 "". </DD>
666
667 <DT><B>-linewidth <I>pixels</I></B> </DT>
668 <DD>Sets the width of the axis and tick lines. The default
669 is 1 pixel. </DD>
670
671 <DT><B>-logscale <I>boolean</I></B> </DT>
672 <DD>Indicates whether the scale of the axis is
673 logarithmic or linear. If <I>boolean</I> is true, the axis is logarithmic. The
674 default scale is linear. </DD>
675
676 <DT><B>-loose <I>boolean</I></B> </DT>
677 <DD>Indicates whether the limits of the
678 axis should fit the data points tightly, at the outermost data points,
679 or loosely, at the outer tick intervals. If the axis limit is set with the
680 -min or -max option, the axes are displayed tightly. If <I>boolean</I> is true, the
681 axis range is "loose". The default is 0. </DD>
682
683 <DT><B>-majorticks <I>majorList</I></B> </DT>
684 <DD>Specifies
685 where to display major axis ticks. You can use this option to display ticks
686 at non-uniform intervals. <I>MajorList</I> is a list of axis coordinates designating
687 the location of major ticks. No minor ticks are drawn. If <I>majorList</I> is
688 "", major ticks will be automatically computed. The default is "". </DD>
689
690 <DT><B>-max
691 <I>value</I></B> </DT>
692 <DD>Sets the maximum limit of <I>axisName</I>. Any data point greater than
693 <I>value</I> is not displayed. If <I>value</I> is "", the maximum limit is calculated
694 using the largest data value. The default is "". </DD>
695
696 <DT><B>-min <I>value</I></B> </DT>
697 <DD>Sets the minimum
698 limit of <I>axisName</I>. Any data point less than <I>value</I> is not displayed. If
699 <I>value</I> is "", the minimum limit is calculated using the smallest data
700 value. The default is "". </DD>
701
702 <DT><B>-minorticks <I>minorList</I></B> </DT>
703 <DD>Specifies where to display
704 minor axis ticks. You can use this option to display minor ticks at non-uniform
705 intervals. <I>MinorList</I> is a list of real values, ranging from 0.0 to 1.0, designating
706 the placement of a minor tick. No minor ticks are drawn if the <B>-majortick</B>
707 option is also set. If <I>minorList</I> is "", minor ticks will be automatically
708 computed. The default is "". </DD>
709
710 <DT><B>-rotate <I>theta</I></B> </DT>
711 <DD>Specifies the how many degrees
712 to rotate the axis tick labels. <I>Theta</I> is a real value representing the number
713 of degrees to rotate the tick labels. The default is 0.0 degrees. </DD>
714
715 <DT><B>-scrollcommand
716 <I>command</I></B> </DT>
717 <DD>Specify the prefix for a command used to communicate with scrollbars
718 for this axis, such as <I>.sbar set</I>. </DD>
719
720 <DT><B>-scrollmax <I>value</I></B> </DT>
721 <DD>Sets the maximum limit
722 of the axis scroll region. If <I>value</I> is "", the maximum limit is calculated
723 using the largest data value. The default is "". </DD>
724
725 <DT><B>-scrollmin <I>value</I></B> </DT>
726 <DD>Sets
727 the minimum limit of axis scroll region. If <I>value</I> is "", the minimum
728 limit is calculated using the smallest data value. The default is "".
729 </DD>
730
731 <DT><B>-showticks <I>boolean</I></B> </DT>
732 <DD>Indicates whether axis ticks should be drawn. If <I>boolean</I>
733 is true, ticks are drawn. If false, only the axis line is drawn. The default
734 is 1. </DD>
735
736 <DT><B>-stepsize <I>value</I></B> </DT>
737 <DD>Specifies the interval between major axis ticks.
738 If <I>value</I> isn't a valid interval (must be less than the axis range), the
739 request is ignored and the step size is automatically calculated. </DD>
740
741 <DT><B>-subdivisions
742 <I>number</I></B> </DT>
743 <DD>Indicates how many minor axis ticks are to be drawn. For example,
744 if <I>number</I> is two, only one minor tick is drawn. If <I>number</I> is one, no minor
745 ticks are displayed. The default is 2. </DD>
746
747 <DT><B>-tickfont <I>fontName</I></B> </DT>
748 <DD>Specifies the
749 font for axis tick labels. The default is *-Courier-Bold-R-Normal-*-100-*. </DD>
750
751 <DT><B>-ticklength
752 <I>pixels</I></B> </DT>
753 <DD>Sets the length of major and minor ticks (minor ticks are half the
754 length of major ticks). If <I>pixels</I> is less than zero, the axis will be inverted
755 with ticks drawn pointing towards the plot. The default is 0.1i. </DD>
756
757 <DT><B>-title
758 <I>text</I></B> </DT>
759 <DD>Sets the title of the axis. If <I>text</I> is "", no axis title will be
760 displayed. </DD>
761
762 <DT><B>-titlealternate <I>boolean</I></B> </DT>
763 <DD>Indicates to display the axis title
764 in its alternate location. Normally the axis title is centered along the
765 axis. This option places the axis either to the right (horizontal axes)
766 or above (vertical axes) the axis. The default is 0. </DD>
767
768 <DT><B>-titlecolor <I>color</I></B>
769 </DT>
770 <DD>Sets the color of the axis title. The default is black. </DD>
771
772 <DT><B>-titlefont <I>fontName</I></B>
773 </DT>
774 <DD>Specifies the font for axis title. The default is *-Helvetica-Bold-R-Normal-*-14-140-*.
775 </DD>
776 </DL>
777 <P>
778 Axis configuration options may be also be set by the <B>option</B> command. The
779 resource class is Axis. The resource names are the names of the axes
780 (such as x or x2). <BR>
781 <CODE>option add *Graph.Axis.Color blue<BR>
782 option add *Graph.x.LogScale true<BR>
783 option add *Graph.x2.LogScale false<BR>
784 </blockquote>
785
786 <DL>
787
788 <DT></CODE><I>pathName <B>axis <B>create <I>axisName </I></B></B></I>?<I>option value</I>?... </DT>
789 <DD>Creates a new axis by the
790 name <I>axisName</I>. No axis by the same name can already exist. <I>Option</I> and <I>value</I>
791 are described in above in the axis <B>configure</B> operation. </DD>
792
793 <DT><I>pathName <B>axis <B>delete
794 </B></B></I>?<I>axisName</I>?... </DT>
795 <DD>Deletes the named axes. An axis is not really deleted until it
796 is not longer in use, so it's safe to delete axes mapped to elements. </DD>
797
798 <DT><I>pathName
799 <B>axis invtransform <I>axisName value</I></B></I> </DT>
800 <DD>Performs the inverse transformation, changing
801 the screen coordinate <I>value</I> to a graph coordinate, mapping the value mapped
802 to <I>axisName</I>. Returns the graph coordinate. </DD>
803
804 <DT><I>pathName <B>axis limits <I>axisName</I></B></I>
805 </DT>
806 <DD>Returns a list of the minimum and maximum limits for <I>axisName</I>. The order
807 of the list is min max. </DD>
808
809 <DT><I>pathName <B>axis names </B></I>?<I>pattern</I>?... </DT>
810 <DD>Returns a list of
811 axes matching zero or more patterns. If no <I>pattern</I> argument is give, the
812 names of all axes are returned. </DD>
813
814 <DT><I>pathName <B>axis transform <I>axisName value</I></B></I> </DT>
815 <DD>Transforms
816 the coordinate <I>value</I> to a screen coordinate by mapping the it to <I>axisName</I>.
817 Returns the transformed screen coordinate. </DD>
818
819 <DT><I>pathName <B>axis view <I>axisName</I></B></I>
820 </DT>
821 <DD>Change the viewable area of this axis. Use as an argument to a scrollbar's
822 "<I>-command</I>". </DD>
823 </DL>
824 <P>
825 The default axes are x, y, x2, and y2. But you can display
826 more than four axes simultaneously. You can also swap in a different axis
827 with <B>use</B> operation of the special axis components: <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>,
828 and <B>y2axis</B>. <BR>
829 <CODE>.g create axis temp<BR>
830 .g create axis time<BR>
831 ...<BR>
832 .g xaxis use temp<BR>
833 .g yaxis use time<BR>
834 </CODE>Only the axes specified for use are displayed on the screen. <P>
835 The <B>xaxis</B>,
836 <B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B> components operate on an axis location rather
837 than a specific axis like the more general <B>axis</B> component does. They implicitly
838 control the axis that is currently using to that location. By default,
839 <B>xaxis</B> uses the x axis, <B>yaxis</B> uses y, <B>x2axis</B> uses x2, and <B>y2axis</B> uses
840 y2. When more than one axis is displayed in a margin, it represents the
841 first axis displayed. <P>
842 The following operations are available for axes. They
843 mirror exactly the operations of the <B>axis</B> component. The <I>axis</I> argument
844 must be <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>, or <B>y2axis</B>. This feature is deprecated since
845 more than one axis can now be used a margin. You should only use the <B>xaxis</B>,
846 <B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B> components with the <B>use</B> operation. For all other
847 operations, use the general <B>axis</B> component instead.
848 <DL>
849
850 <DT><I>pathName <I>axis <B>cget <I>option</I></B></I></I>
851 </DT>
852 <DD></DD>
853
854 <DT><I>pathName <I>axis <B>configure </B></I></I>?<I>option value</I>?... </DT>
855 <DD></DD>
856
857 <DT><I>pathName <I>axis<B> invtransform <I>value</I></B></I></I>
858 </DT>
859 <DD></DD>
860
861 <DT><I>pathName <I>axis <B>limits</B></I></I> </DT>
862 <DD></DD>
863
864 <DT><I>pathName <I>axis<B> transform <I>value</I></B></I></I> </DT>
865 <DD></DD>
866
867 <DT><I>pathName <I>axis<B> use </B></I></I>?<I>axisName</I>?
868 </DT>
869 <DD>Designates the axis <I>axisName</I> is to be displayed at this location. <I>AxisName</I>
870 can not be already in use at another location. This command returns the
871 name of the axis currently using this location. </DD>
872 </DL>
873
874 <H3><A NAME="sect9" HREF="#toc9">Crosshairs Component</A></H3>
875 Cross
876 hairs consist of two intersecting lines (one vertical and one horizontal)
877 drawn completely across the plotting area. They are used to position the
878 mouse in relation to the coordinate axes. Cross hairs differ from line
879 markers in that they are implemented using XOR drawing primitives. This
880 means that they can be quickly drawn and erased without redrawing the entire
881 graph. Note that crosshair are enabled by calling <B>Blt_Crosshairs</B> and turned
882 off by calling <B>Blt_ResetCrosshairs</B>. Similarly call <B>Blt_ZoomStack</B> for zooming.
883 <P>
884 The following operations are available for cross hairs:
885 <DL>
886
887 <DT><I>pathName <B>crosshairs
888 cget <I>option</I></B></I> </DT>
889 <DD>Returns the current value of the cross hairs configuration
890 option given by <I>option</I>. <I>Option</I> may be any option described below for the
891 cross hairs <B>configure</B> operation. </DD>
892
893 <DT><I>pathName <B>crosshairs configure </B></I>?<I>option value</I>?...
894 </DT>
895 <DD>Queries or modifies the configuration options of the cross hairs. If
896 <I>option</I> isn't specified, a list describing all the current options for the
897 cross hairs is returned. If <I>option</I> is specified, but not <I>value</I>, then a
898 list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs
899 are specified, then for each pair, the cross hairs option <I>option</I> is set
900 to <I>value</I>. The following options are available for cross hairs. <blockquote></DD>
901
902 <DT><B>-color <I>color</I></B>
903 </DT>
904 <DD>Sets the color of the cross hairs. The default is black. </DD>
905
906 <DT><B>-dashes <I>dashList</I></B>
907 </DT>
908 <DD>Sets the dash style of the cross hairs. <I>DashList</I> is a list of up to 11 numbers
909 that alternately represent the lengths of the dashes and gaps on the cross
910 hair lines. Each number must be between 1 and 255. If <I>dashList</I> is "",
911 the cross hairs will be solid lines. </DD>
912
913 <DT><B>-hide <I>boolean</I></B> </DT>
914 <DD>Indicates whether cross
915 hairs are drawn. If <I>boolean</I> is true, cross hairs are not drawn. The default
916 is yes. </DD>
917
918 <DT><B>-linewidth <I>pixels</I></B> </DT>
919 <DD>Set the width of the cross hair lines. The default
920 is 1. </DD>
921
922 <DT><B>-position <I>pos</I></B> </DT>
923 <DD>Specifies the screen position where the cross hairs
924 intersect. <I>Pos</I> must be in the form "<I>@x,y</I>", where <I>x</I> and <I>y</I> are the window
925 coordinates of the intersection. </DD>
926 </DL>
927 <P>
928 Cross hairs configuration options may be
929 also be set by the <B>option</B> command. The resource name and class are crosshairs
930 and Crosshairs respectively. <BR>
931 <CODE>option add *Graph.Crosshairs.LineWidth 2<BR>
932 option add *Graph.Crosshairs.Color red<BR>
933 </blockquote>
934
935 <DL>
936
937 <DT></CODE><I>pathName <B>crosshairs off</B></I> </DT>
938 <DD>Turns off the cross hairs. </DD>
939
940 <DT><I>pathName <B>crosshairs
941 on</B></I> </DT>
942 <DD>Turns on the display of the cross hairs. </DD>
943
944 <DT><I>pathName <B>crosshairs toggle</B></I>
945 </DT>
946 <DD>Toggles the current state of the cross hairs, alternately mapping and unmapping
947 the cross hairs. </DD>
948 </DL>
949
950 <H3><A NAME="sect10" HREF="#toc10">Element Components</A></H3>
951 A data element represents a set of data.
952 It contains x and y vectors containing the coordinates of the data points.
953 Elements can be displayed with a symbol at each data point and lines connecting
954 the points. Elements also control the appearance of the data, such as the
955 symbol type, line width, color etc. <P>
956 When new data elements are created,
957 they are automatically added to a list of displayed elements. The display
958 list controls what elements are drawn and in what order. <P>
959 The following
960 operations are available for elements.
961 <DL>
962
963 <DT><I>pathName <B>element activate <I>elemName
964 </I></B></I>?<I>index</I>?... </DT>
965 <DD>Specifies the data points of element <I>elemName</I> to be drawn using
966 active foreground and background colors. <I>ElemName</I> is the name of the element
967 and <I>index</I> is a number representing the index of the data point. If no indices
968 are present then all data points become active. </DD>
969
970 <DT><I>pathName <B>element bind <I>tagName</I></B></I>
971 ?<I>sequence</I>? ?<I>command</I>? </DT>
972 <DD>Associates <I>command</I> with <I>tagName</I> such that whenever
973 the event sequence given by <I>sequence</I> occurs for an element with this tag,
974 <I>command</I> will be invoked. The syntax is similar to the <B>bind</B> command except
975 that it operates on graph elements, rather than widgets. See the <B>bind</B> manual
976 entry for complete details on <I>sequence</I> and the substitutions performed
977 on <I>command</I> before invoking it. <P>
978 If all arguments are specified then a
979 new binding is created, replacing any existing binding for the same <I>sequence</I>
980 and <I>tagName</I>. If the first character of <I>command</I> is + then <I>command</I> augments
981 an existing binding rather than replacing it. If no <I>command</I> argument is
982 provided then the command currently associated with <I>tagName</I> and <I>sequence</I>
983 (it's an error occurs if there's no such binding) is returned. If both <I>command</I>
984 and <I>sequence</I> are missing then a list of all the event sequences for which
985 bindings have been defined for <I>tagName</I>. </DD>
986
987 <DT><I>pathName <B>element cget <I>elemName
988 <I>option</I></I></B></I> </DT>
989 <DD>Returns the current value of the element configuration option given
990 by <I>option</I>. <I>Option</I> may be any of the options described below for the element
991 <B>configure</B> operation. </DD>
992
993 <DT><I>pathName <B>element closest <I>x y</I></B></I> <I>varName</I> ?<I>option value</I>?...
994 ?<I>elemName</I>?... </DT>
995 <DD><P>
996 Searches for the data point closest to the window coordinates
997 <I>x</I> and <I>y</I>. By default, all elements are searched. Hidden elements (see the
998 <B>-hide</B> option is false) are ignored. You can limit the search by specifying
999 only the elements you want to be considered. <I>ElemName</I> must be the name
1000 of an element that is not be hidden. <I>VarName</I> is the name of a Tcl array
1001 variable and will contain the search results: the name of the closest element,
1002 the index of the closest data point, and the graph coordinates of the point.
1003 Returns 0, if no data point within the threshold distance can be found,
1004 otherwise 1 is returned. The following <I>option</I>-<I>value</I> pairs are available.
1005 <blockquote></DD>
1006
1007 <DT><B>-along <I>direction</I></B> </DT>
1008 <DD>Search for the closest element using the following criteria:
1009 <blockquote></DD>
1010
1011 <DT>x </DT>
1012 <DD>Find closest element vertically from the given X-coordinate. </DD>
1013
1014 <DT>y </DT>
1015 <DD>Find
1016 the closest element horizontally from the given Y-coordinate. </DD>
1017
1018 <DT>both </DT>
1019 <DD>Find
1020 the closest element for the given point (using both the X and Y coordinates).
1021 </DD>
1022 </DL>
1023 </blockquote>
1024
1025 <DL>
1026
1027 <DT><B>-halo <I>pixels</I></B> </DT>
1028 <DD>Specifies a threshold distance where selected data points
1029 are ignored. <I>Pixels</I> is a valid screen distance, such as 2 or 1.2i. If
1030 this option isn't specified, then it defaults to the value of the graph's
1031 <B>-halo</B> option. </DD>
1032
1033 <DT><B>-interpolate <I>string</I></B> </DT>
1034 <DD>Indicates whether to consider projections
1035 that lie along the line segments connecting data points when searching
1036 for the closest point. The default value is 0. The values for <I>string</I> are
1037 described below. <blockquote></DD>
1038
1039 <DT>no </DT>
1040 <DD>Search only for the closest data point. </DD>
1041
1042 <DT>yes </DT>
1043 <DD>Search
1044 includes projections that lie along the line segments connecting the data
1045 points. </DD>
1046 </DL>
1047 </blockquote>
1048 </blockquote>
1049
1050 <DL>
1051
1052 <DT><I>pathName <B>element configure <I>elemName </I></B></I>?<I>elemName</I>... ?<I>option value</I>?... </DT>
1053 <DD>Queries
1054 or modifies the configuration options for elements. Several elements can
1055 be modified at the same time. If <I>option</I> isn't specified, a list describing
1056 all the current options for <I>elemName</I> is returned. If <I>option</I> is specified,
1057 but not <I>value</I>, then a list describing the option <I>option</I> is returned. If
1058 one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the
1059 element option <I>option</I> is set to <I>value</I>. The following options are valid
1060 for elements. <blockquote></DD>
1061
1062 <DT><B>-activepen <I>penName</I></B> </DT>
1063 <DD>Specifies pen to use to draw active element.
1064 If <I>penName</I> is "", no active elements will be drawn. The default is
1065 activeLine. </DD>
1066
1067 <DT><B>-bindtags <I>tagList</I></B> </DT>
1068 <DD>Specifies the binding tags for the element.
1069 <I>TagList</I> is a list of binding tag names. The tags and their order will
1070 determine how events are handled for elements. Each tag in the list matching
1071 the current event sequence will have its Tcl command executed. Implicitly
1072 the name of the element is always the first tag in the list. The default
1073 value is all. </DD>
1074
1075 <DT><B>-color <I>color</I></B> </DT>
1076 <DD>Sets the color of the traces connecting the
1077 data points. </DD>
1078
1079 <DT><B>-dashes <I>dashList</I></B> </DT>
1080 <DD>Sets the dash style of element line. <I>DashList</I>
1081 is a list of up to 11 numbers that alternately represent the lengths of
1082 the dashes and gaps on the element line. Each number must be between 1
1083 and 255. If <I>dashList</I> is "", the lines will be solid. </DD>
1084
1085 <DT><B>-data <I>coordList</I></B> </DT>
1086 <DD>Specifies
1087 the X-Y coordinates of the data. <I>CoordList</I> is a list of numeric expressions
1088 representing the X-Y coordinate pairs of each data point. </DD>
1089
1090 <DT><B>-fill <I>color</I></B> </DT>
1091 <DD>Sets
1092 the interior color of symbols. If <I>color</I> is "", then the interior of the
1093 symbol is transparent. If <I>color</I> is defcolor, then the color will be the
1094 same as the <B>-color</B> option. The default is defcolor. </DD>
1095
1096 <DT><B>-hide <I>boolean</I></B> </DT>
1097 <DD>Indicates
1098 whether the element is displayed. The default is no. </DD>
1099
1100 <DT><B>-label <I>text</I></B> </DT>
1101 <DD>Sets
1102 the element's label in the legend. If <I>text</I> is "", the element will have
1103 no entry in the legend. The default label is the element's name. </DD>
1104
1105 <DT><B>-linewidth
1106 <I>pixels</I></B> </DT>
1107 <DD>Sets the width of the connecting lines between data points. If
1108 <I>pixels</I> is 0, no connecting lines will be drawn between symbols. The default
1109 is 0. </DD>
1110
1111 <DT><B>-mapx <I>xAxis</I></B> </DT>
1112 <DD>Selects the X-axis to map the element's X-coordinates onto.
1113 <I>XAxis</I> must be the name of an axis. The default is x. </DD>
1114
1115 <DT><B>-mapy <I>yAxis</I></B> </DT>
1116 <DD>Selects
1117 the Y-axis to map the element's Y-coordinates onto. <I>YAxis</I> must be the name
1118 of an axis. The default is y. </DD>
1119
1120 <DT><B>-offdash <I>color</I></B> </DT>
1121 <DD>Sets the color of the stripes
1122 when traces are dashed (see the <B>-dashes</B> option). If <I>color</I> is "", then
1123 the "off" pixels will represent gaps instead of stripes. If <I>color</I> is defcolor,
1124 then the color will be the same as the <B>-color</B> option. The default is defcolor.
1125 </DD>
1126
1127 <DT><B>-outline <I>color</I></B> </DT>
1128 <DD>Sets the color or the outline around each symbol. If <I>color</I>
1129 is "", then no outline is drawn. If <I>color</I> is defcolor, then the color
1130 will be the same as the <B>-color</B> option. The default is defcolor. </DD>
1131
1132 <DT><B>-pen <I>penname</I></B>
1133 </DT>
1134 <DD>Set the pen to use for this element. </DD>
1135
1136 <DT><B>-outlinewidth <I>pixels</I></B> </DT>
1137 <DD>Sets the width
1138 of the outline bordering each symbol. If <I>pixels</I> is 0, no outline will
1139 be drawn. The default is 1. </DD>
1140
1141 <DT><B>-pixels <I>pixels</I></B> </DT>
1142 <DD>Sets the size of symbols. If
1143 <I>pixels</I> is 0, no symbols will be drawn. The default is 0.125i. </DD>
1144
1145 <DT><B>-scalesymbols
1146 <I>boolean</I></B> </DT>
1147 <DD>If <I>boolean</I> is true, the size of the symbols drawn for <I>elemName</I>
1148 will change with scale of the X-axis and Y-axis. At the time this option is
1149 set, the current ranges of the axes are saved as the normalized scales
1150 (i.e scale factor is 1.0) and the element is drawn at its designated size
1151 (see the <B>-pixels</B> option). As the scale of the axes change, the symbol will
1152 be scaled according to the smaller of the X-axis and Y-axis scales. If <I>boolean</I>
1153 is false, the element's symbols are drawn at the designated size, regardless
1154 of axis scales. The default is 0. </DD>
1155
1156 <DT><B>-smooth <I>smooth</I></B> </DT>
1157 <DD>Specifies how connecting
1158 line segments are drawn between data points. <I>Smooth</I> can be either linear,
1159 step, natural, or quadratic. If <I>smooth</I> is linear, a single line
1160 segment is drawn, connecting both data points. When <I>smooth</I> is step, two
1161 line segments are drawn. The first is a horizontal line segment that steps
1162 the next X-coordinate. The second is a vertical line, moving to the next
1163 Y-coordinate. Both <I>natural</I> and <I>quadratic</I> generate multiple segments between
1164 data points. If <I>natural</I>, the segments are generated using a cubic spline.
1165 If <I>quadratic</I>, a quadratic spline is used. The default is <I>linear</I>. </DD>
1166
1167 <DT><B>-styles
1168 <I>styleList</I></B> </DT>
1169 <DD>Specifies what pen to use based on the range of weights given.
1170 <I>StyleList</I> is a list of style specifications. Each style specification, in
1171 turn, is a list consisting of a pen name, and optionally a minimum and
1172 maximum range. Data points whose weight (see the <B>-weight</B> option) falls in
1173 this range, are drawn with this pen. If no range is specified it defaults
1174 to the index of the pen in the list. Note that this affects only symbol
1175 attributes. Line attributes, such as line width, dashes, etc. are ignored.
1176 </DD>
1177
1178 <DT><B>-symbol <I>symbol</I></B> </DT>
1179 <DD>Specifies the symbol for data points. <I>Symbol</I> can be either
1180 square, circle, diamond, plus, cross, splus, scross, triangle,
1181 "" (where no symbol is drawn), or a bitmap. Bitmaps are specified as
1182 "<I>source</I> ?<I>mask</I>?", where <I>source</I> is the name of the bitmap, and <I>mask</I> is the
1183 bitmap's optional mask. The default is circle. </DD>
1184
1185 <DT><B>-trace <I>direction</I></B> </DT>
1186 <DD>Indicates
1187 whether connecting lines between data points (whose X-coordinate values
1188 are either increasing or decreasing) are drawn. <I>Direction</I> must be increasing,
1189 decreasing, or both. For example, if <I>direction</I> is increasing, connecting
1190 lines will be drawn only between those data points where X-coordinate values
1191 are monotonically increasing. If <I>direction</I> is both, connecting lines
1192 will be draw between all data points. The default is both. </DD>
1193
1194 <DT><B>-weights <I>wVec</I></B>
1195 </DT>
1196 <DD>Specifies the weights of the individual data points. This, with the list
1197 pen styles (see the <B>-styles</B> option), controls how data points are drawn.
1198 <I>WVec</I> is the name of a BLT vector or a list of numeric expressions representing
1199 the weights for each data point. </DD>
1200
1201 <DT><B>-xdata <I>xVec</I></B> </DT>
1202 <DD>Specifies the X-coordinates
1203 of the data. <I>XVec</I> is the name of a BLT vector or a list of numeric expressions.
1204 </DD>
1205
1206 <DT><B>-ydata <I>yVec</I></B> </DT>
1207 <DD>Specifies the Y-coordinates of the data. <I>YVec</I> is the name of
1208 a BLT vector or a list of numeric expressions. </DD>
1209 </DL>
1210 <P>
1211 Element configuration options
1212 may also be set by the <B>option</B> command. The resource class is Element.
1213 The resource name is the name of the element. <BR>
1214 <CODE>option add *Graph.Element.symbol line<BR>
1215 option add *Graph.e1.symbol line<BR>
1216 </blockquote>
1217
1218 <DL>
1219
1220 <DT></CODE><I>pathName <B>element create <I>elemName</I></B></I> ?<I>option value</I>?... </DT>
1221 <DD>Creates a new element <I>elemName</I>.
1222 It's an error is an element <I>elemName</I> already exists. If additional arguments
1223 are present, they specify options valid for the element <B>configure</B> operation.
1224 </DD>
1225
1226 <DT><I>pathName <B>element deactivate <I>elemName</I></B></I> ?<I>elemName</I>?... </DT>
1227 <DD>Deactivates all the elements
1228 matching <I>pattern</I>. Elements whose names match any of the patterns given are
1229 redrawn using their normal colors. </DD>
1230
1231 <DT><I>pathName <B>element delete</B></I> ?<I>elemName</I>?... </DT>
1232 <DD>Deletes
1233 all the named elements. The graph is automatically redrawn. </DD>
1234
1235 <DT><I>pathName <B>element
1236 exists <I>elemName</I></B></I> </DT>
1237 <DD>Returns 1 if an element <I>elemName</I> currently exists and
1238 0 otherwise. </DD>
1239
1240 <DT><I>pathName <B>element names </B></I>?<I>pattern</I>?... </DT>
1241 <DD>Returns the elements matching
1242 one or more pattern. If no <I>pattern</I> is given, the names of all elements
1243 is returned. </DD>
1244
1245 <DT><I>pathName <B>element show</B></I> ?<I>nameList</I>? </DT>
1246 <DD>Queries or modifies the
1247 element display list. The element display list designates the elements
1248 drawn and in what order. <I>NameList</I> is a list of elements to be displayed
1249 in the order they are named. If there is no <I>nameList</I> argument, the current
1250 display list is returned. </DD>
1251
1252 <DT><I>pathName <B>element type</B></I> <I>elemName</I> </DT>
1253 <DD>Returns the type
1254 of <I>elemName</I>. If the element is a bar element, the commands returns the
1255 string "bar", otherwise it returns "line". </DD>
1256 </DL>
1257
1258 <H3><A NAME="sect11" HREF="#toc11"></CODE>Grid Component</A></H3>
1259 Grid lines
1260 extend from the major and minor ticks of each axis horizontally or vertically
1261 across the plotting area. The following operations are available for grid
1262 lines.
1263 <DL>
1264
1265 <DT><I>pathName <B>grid cget <I>option</I></B></I> </DT>
1266 <DD>Returns the current value of the grid line
1267 configuration option given by <I>option</I>. <I>Option</I> may be any option described
1268 below for the grid <B>configure</B> operation. </DD>
1269
1270 <DT><I>pathName <B>grid configure</B></I> ?<I>option
1271 value</I>?... </DT>
1272 <DD>Queries or modifies the configuration options for grid lines. If
1273 <I>option</I> isn't specified, a list describing all the current grid options for
1274 <I>pathName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list
1275 describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are
1276 specified, then for each pair, the grid line option <I>option</I> is set to <I>value</I>.
1277 The following options are valid for grid lines. <blockquote></DD>
1278
1279 <DT><B>-color <I>color</I></B> </DT>
1280 <DD>Sets the color
1281 of the grid lines. The default is black. </DD>
1282
1283 <DT><B>-dashes <I>dashList</I></B> </DT>
1284 <DD>Sets the dash
1285 style of the grid lines. <I>DashList</I> is a list of up to 11 numbers that alternately
1286 represent the lengths of the dashes and gaps on the grid lines. Each number
1287 must be between 1 and 255. If <I>dashList</I> is "", the grid will be solid lines.
1288 </DD>
1289
1290 <DT><B>-hide <I>boolean</I></B> </DT>
1291 <DD>Indicates whether the grid should be drawn. If <I>boolean</I> is true,
1292 grid lines are not shown. The default is yes. </DD>
1293
1294 <DT><B>-linewidth <I>pixels</I></B> </DT>
1295 <DD>Sets the
1296 width of grid lines. The default width is 1. </DD>
1297
1298 <DT><B>-mapx <I>xAxis</I></B> </DT>
1299 <DD>Specifies the
1300 X-axis to display grid lines. <I>XAxis</I> must be the name of an axis or ""
1301 for no grid lines. The default is "". </DD>
1302
1303 <DT><B>-mapy <I>yAxis</I></B> </DT>
1304 <DD>Specifies the Y-axis
1305 to display grid lines. <I>YAxis</I> must be the name of an axis or "" for no
1306 grid lines. The default is y. </DD>
1307
1308 <DT><B>-minor <I>boolean</I></B> </DT>
1309 <DD>Indicates whether the grid
1310 lines should be drawn for minor ticks. If <I>boolean</I> is true, the lines will
1311 appear at minor tick intervals. The default is 1. </DD>
1312 </DL>
1313 <P>
1314 Grid configuration options
1315 may also be set by the <B>option</B> command. The resource name and class are
1316 grid and Grid respectively. <BR>
1317 <CODE>option add *Graph.grid.LineWidth 2<BR>
1318 option add *Graph.Grid.Color black<BR>
1319
1320 <DL>
1321
1322 <DT></CODE><B>-raised <I>boolean</I></B> </DT>
1323 <DD>Grid is to be raised or drawn over elements. </DD>
1324 </DL>
1325 </blockquote>
1326
1327 <DL>
1328
1329 <DT><I>pathName <B>grid
1330 off</B></I> </DT>
1331 <DD>Turns off the display the grid lines. </DD>
1332
1333 <DT><I>pathName <B>grid on</B></I> </DT>
1334 <DD>Turns on the
1335 display the grid lines. </DD>
1336
1337 <DT><I>pathName <B>grid toggle</B></I> </DT>
1338 <DD>Toggles the display of the
1339 grid. </DD>
1340 </DL>
1341
1342 <H3><A NAME="sect12" HREF="#toc12">Legend Component</A></H3>
1343 The legend displays a list of the data elements.
1344 Each entry consists of the element's symbol and label. The legend can appear
1345 in any margin (the default location is in the right margin). It can also
1346 be positioned anywhere within the plotting area. <P>
1347 The following operations
1348 are valid for the legend.
1349 <DL>
1350
1351 <DT><I>pathName <B>legend activate <I>pattern</I></B></I>... </DT>
1352 <DD>Selects legend
1353 entries to be drawn using the active legend colors and relief. All entries
1354 whose element names match <I>pattern</I> are selected. To be selected, the element
1355 name must match only one <I>pattern</I>. </DD>
1356
1357 <DT><I>pathName <B>legend bind <I>tagName</I></B></I> ?<I>sequence</I>?
1358 ?<I>command</I>? </DT>
1359 <DD>Associates <I>command</I> with <I>tagName</I> such that whenever the event
1360 sequence given by <I>sequence</I> occurs for a legend entry with this tag, <I>command</I>
1361 will be invoked. Implicitly the element names in the entry are tags. The
1362 syntax is similar to the <B>bind</B> command except that it operates on legend
1363 entries, rather than widgets. See the <B>bind</B> manual entry for complete details
1364 on <I>sequence</I> and the substitutions performed on <I>command</I> before invoking
1365 it. <P>
1366 If all arguments are specified then a new binding is created, replacing
1367 any existing binding for the same <I>sequence</I> and <I>tagName</I>. If the first character
1368 of <I>command</I> is + then <I>command</I> augments an existing binding rather than
1369 replacing it. If no <I>command</I> argument is provided then the command currently
1370 associated with <I>tagName</I> and <I>sequence</I> (it's an error occurs if there's no
1371 such binding) is returned. If both <I>command</I> and <I>sequence</I> are missing then
1372 a list of all the event sequences for which bindings have been defined
1373 for <I>tagName</I>. </DD>
1374
1375 <DT><I>pathName <B>legend cget <I>option</I></B></I> </DT>
1376 <DD>Returns the current value of a
1377 legend configuration option. <I>Option</I> may be any option described below in
1378 the legend <B>configure</B> operation. </DD>
1379
1380 <DT><I>pathName <B>legend configure </B></I>?<I>option value</I>?...
1381 </DT>
1382 <DD>Queries or modifies the configuration options for the legend. If <I>option</I>
1383 isn't specified, a list describing the current legend options for <I>pathName</I>
1384 is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing
1385 <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified,
1386 then for each pair, the legend option <I>option</I> is set to <I>value</I>. The following
1387 options are valid for the legend. <blockquote></DD>
1388
1389 <DT><B>-activebackground <I>color</I></B> </DT>
1390 <DD>Sets the background
1391 color for active legend entries. All legend entries marked active (see
1392 the legend <B>activate</B> operation) are drawn using this background color. </DD>
1393
1394 <DT><B>-activeborderwidth
1395 <I>pixels</I></B> </DT>
1396 <DD>Sets the width of the 3-D border around the outside edge of the active
1397 legend entries. The default is 2. </DD>
1398
1399 <DT><B>-activeforeground <I>color</I></B> </DT>
1400 <DD>Sets the foreground
1401 color for active legend entries. All legend entries marked as active (see
1402 the legend <B>activate</B> operation) are drawn using this foreground color. </DD>
1403
1404 <DT><B>-activerelief
1405 <I>relief</I></B> </DT>
1406 <DD>Specifies the 3-D effect desired for active legend entries. <I>Relief</I>
1407 denotes how the interior of the entry should appear relative to the legend;
1408 for example, raised means the entry should appear to protrude from the
1409 legend, relative to the surface of the legend. The default is flat. </DD>
1410
1411 <DT><B>-anchor
1412 <I>anchor</I></B> </DT>
1413 <DD>Tells how to position the legend relative to the positioning point
1414 for the legend. This is dependent on the value of the <B>-position</B> option.
1415 The default is center. <blockquote></DD>
1416
1417 <DT>left or right </DT>
1418 <DD>The anchor describes how to position
1419 the legend vertically. </DD>
1420
1421 <DT>top or bottom </DT>
1422 <DD>The anchor describes how to position
1423 the legend horizontally. </DD>
1424
1425 <DT>@x,y </DT>
1426 <DD>The anchor specifies how to position the
1427 legend relative to the positioning point. For example, if <I>anchor</I> is center
1428 then the legend is centered on the point; if <I>anchor</I> is n then the legend
1429 will be drawn such that the top center point of the rectangular region
1430 occupied by the legend will be at the positioning point. </DD>
1431
1432 <DT>plotarea </DT>
1433 <DD>The
1434 anchor specifies how to position the legend relative to the plotting area.
1435 For example, if <I>anchor</I> is center then the legend is centered in the plotting
1436 area; if <I>anchor</I> is ne then the legend will be drawn such that occupies
1437 the upper right corner of the plotting area. </DD>
1438 </DL>
1439 </blockquote>
1440
1441 <DL>
1442
1443 <DT><B>-background <I>color</I></B> </DT>
1444 <DD>Sets the background
1445 color of the legend. If <I>color</I> is "", the legend background with be transparent.
1446 </DD>
1447
1448 <DT><B>-bindtags <I>tagList</I></B> </DT>
1449 <DD>Specifies the binding tags for legend entries. <I>TagList</I>
1450 is a list of binding tag names. The tags and their order will determine
1451 how events are handled for legend entries. Each tag in the list matching
1452 the current event sequence will have its Tcl command executed. The default
1453 value is all. </DD>
1454
1455 <DT><B>-borderwidth <I>pixels</I></B> </DT>
1456 <DD>Sets the width of the 3-D border around
1457 the outside edge of the legend (if such border is being drawn; the <B>relief</B>
1458 option determines this). The default is 2 pixels. </DD>
1459
1460 <DT><B>-font <I>fontName</I></B> </DT>
1461 <DD><I>FontName</I>
1462 specifies a font to use when drawing the labels of each element into the
1463 legend. The default is *-Helvetica-Bold-R-Normal-*-12-120-*. </DD>
1464
1465 <DT><B>-foreground <I>color</I></B>
1466 </DT>
1467 <DD>Sets the foreground color of the text drawn for the element's label. The
1468 default is black. </DD>
1469
1470 <DT><B>-hide <I>boolean</I></B> </DT>
1471 <DD>Indicates whether the legend should be
1472 displayed. If <I>boolean</I> is true, the legend will not be draw. The default
1473 is no. </DD>
1474
1475 <DT><B>-ipadx <I>pad</I></B> </DT>
1476 <DD>Sets the amount of internal padding to be added to the
1477 width of each legend entry. <I>Pad</I> can be a list of one or two screen distances.
1478 If <I>pad</I> has two elements, the left side of the legend entry is padded by
1479 the first distance and the right side by the second. If <I>pad</I> is just one
1480 distance, both the left and right sides are padded evenly. The default
1481 is 2. </DD>
1482
1483 <DT><B>-ipady <I>pad</I></B> </DT>
1484 <DD>Sets an amount of internal padding to be added to the
1485 height of each legend entry. <I>Pad</I> can be a list of one or two screen distances.
1486 If <I>pad</I> has two elements, the top of the entry is padded by the first distance
1487 and the bottom by the second. If <I>pad</I> is just one distance, both the top
1488 and bottom of the entry are padded evenly. The default is 2. </DD>
1489
1490 <DT><B>-padx <I>pad</I></B> </DT>
1491 <DD>Sets
1492 the padding to the left and right exteriors of the legend. <I>Pad</I> can be a
1493 list of one or two screen distances. If <I>pad</I> has two elements, the left
1494 side of the legend is padded by the first distance and the right side by
1495 the second. If <I>pad</I> has just one distance, both the left and right sides
1496 are padded evenly. The default is 4. </DD>
1497
1498 <DT><B>-pady <I>pad</I></B> </DT>
1499 <DD>Sets the padding above and
1500 below the legend. <I>Pad</I> can be a list of one or two screen distances. If
1501 <I>pad</I> has two elements, the area above the legend is padded by the first
1502 distance and the area below by the second. If <I>pad</I> is just one distance,
1503 both the top and bottom areas are padded evenly. The default is 0. </DD>
1504
1505 <DT><B>-position
1506 <I>pos</I></B> </DT>
1507 <DD>Specifies where the legend is drawn. The <B>-anchor</B> option also affects
1508 where the legend is positioned. If <I>pos</I> is left, left, top, or bottom,
1509 the legend is drawn in the specified margin. If <I>pos</I> is plotarea, then
1510 the legend is drawn inside the plotting area at a particular anchor. If
1511 <I>pos</I> is in the form "<I>@x,y</I>", where <I>x</I> and <I>y</I> are the window coordinates, the
1512 legend is drawn in the plotting area at the specified coordinates. The
1513 default is right. </DD>
1514
1515 <DT><B>-raised <I>boolean</I></B> </DT>
1516 <DD>Indicates whether the legend is above
1517 or below the data elements. This matters only if the legend is in the plotting
1518 area. If <I>boolean</I> is true, the legend will be drawn on top of any elements
1519 that may overlap it. The default is no. </DD>
1520
1521 <DT><B>-relief <I>relief</I></B> </DT>
1522 <DD>Specifies the 3-D
1523 effect for the border around the legend. <I>Relief</I> specifies how the interior
1524 of the legend should appear relative to the graph; for example, raised
1525 means the legend should appear to protrude from the graph, relative to
1526 the surface of the graph. The default is sunken. </DD>
1527 </DL>
1528 <P>
1529 Legend configuration
1530 options may also be set by the <B>option</B> command. The resource name and class
1531 are legend and Legend respectively. <BR>
1532 <CODE>option add *Graph.legend.Foreground blue<BR>
1533 option add *Graph.Legend.Relief raised<BR>
1534 </blockquote>
1535
1536 <DL>
1537
1538 <DT></CODE><I>pathName <B>legend deactivate <I>pattern</I></B></I>... </DT>
1539 <DD>Selects legend entries to be drawn using
1540 the normal legend colors and relief. All entries whose element names match
1541 <I>pattern</I> are selected. To be selected, the element name must match only
1542 one <I>pattern</I>. </DD>
1543
1544 <DT><I>pathName <B>legend get <I>pos</I></B></I> </DT>
1545 <DD>Returns the name of the element whose
1546 entry is at the screen position <I>pos</I> in the legend. <I>Pos</I> must be in the form
1547 "<I>@x,y</I>", where <I>x</I> and <I>y</I> are window coordinates. If the given coordinates
1548 do not lie over a legend entry, "" is returned. </DD>
1549 </DL>
1550
1551 <H3><A NAME="sect13" HREF="#toc13">Pen Components</A></H3>
1552 Pens define
1553 attributes (both symbol and line style) for elements. Pens mirror the configuration
1554 options of data elements that pertain to how symbols and lines are drawn.
1555 Data elements use pens to determine how they are drawn. A data element
1556 may use several pens at once. In this case, the pen used for a particular
1557 data point is determined from each element's weight vector (see the element's
1558 <B>-weight</B> and <B>-style</B> options). <P>
1559 One pen, called activeLine, is automatically
1560 created. It's used as the default active pen for elements. So you can change
1561 the active attributes for all elements by simply reconfiguring this pen.
1562 <BR>
1563 <CODE>.g pen configure "activeLine" -color green<BR>
1564 </CODE>You can create and use several pens. To create a pen, invoke the pen component
1565 and its create operation. <BR>
1566 <CODE>.g pen create myPen<BR>
1567 </CODE>You map pens to a data element using either the element's <B>-pen</B> or <B>-activepen</B>
1568 options. <BR>
1569 <CODE>.g element create "line1" -xdata $x -ydata $tempData \<BR>
1570 -pen myPen<BR>
1571 </CODE>An element can use several pens at once. This is done by specifying the
1572 name of the pen in the element's style list (see the <B>-styles</B> option). <BR>
1573 <CODE>.g element configure "line1" -styles { myPen 2.0 3.0 }<BR>
1574 </CODE>This says that any data point with a weight between 2.0 and 3.0 is to be
1575 drawn using the pen myPen. All other points are drawn with the element's
1576 default attributes. <P>
1577 The following operations are available for pen components.
1578 <P>
1579
1580 <DL>
1581
1582 <DT><I>pathName <B>pen <B>cget <I>penName <I>option</I></I></B></B></I> </DT>
1583 <DD>Returns the current value of the option
1584 given by <I>option</I> for <I>penName</I>. <I>Option</I> may be any option described below for
1585 the pen <B>configure</B> operation. </DD>
1586
1587 <DT><I>pathName <B>pen <B>configure <I>penName </I></B></B></I>?<I>penName</I>... ?<I>option
1588 value</I>?... </DT>
1589 <DD>Queries or modifies the configuration options of <I>penName</I>. Several
1590 pens can be modified at once. If <I>option</I> isn't specified, a list describing
1591 the current options for <I>penName</I> is returned. If <I>option</I> is specified, but
1592 not <I>value</I>, then a list describing <I>option</I> is returned. If one or more <I>option</I>
1593 and <I>value</I> pairs are specified, then for each pair, the pen option <I>option</I>
1594 is set to <I>value</I>. The following options are valid for pens. <blockquote></DD>
1595
1596 <DT><B>-color <I>color</I></B>
1597 </DT>
1598 <DD>Sets the color of the traces connecting the data points. </DD>
1599
1600 <DT><B>-dashes <I>dashList</I></B>
1601 </DT>
1602 <DD>Sets the dash style of element line. <I>DashList</I> is a list of up to 11 numbers
1603 that alternately represent the lengths of the dashes and gaps on the element
1604 line. Each number must be between 1 and 255. If <I>dashList</I> is "", the lines
1605 will be solid. </DD>
1606
1607 <DT><B>-fill <I>color</I></B> </DT>
1608 <DD>Sets the interior color of symbols. If <I>color</I>
1609 is "", then the interior of the symbol is transparent. If <I>color</I> is defcolor,
1610 then the color will be the same as the <B>-color</B> option. The default is defcolor.
1611 </DD>
1612
1613 <DT><B>-linewidth <I>pixels</I></B> </DT>
1614 <DD>Sets the width of the connecting lines between data points.
1615 If <I>pixels</I> is 0, no connecting lines will be drawn between symbols. The
1616 default is 0. </DD>
1617
1618 <DT><B>-offdash <I>color</I></B> </DT>
1619 <DD>Sets the color of the stripes when traces
1620 are dashed (see the <B>-dashes</B> option). If <I>color</I> is "", then the "off" pixels
1621 will represent gaps instead of stripes. If <I>color</I> is defcolor, then the
1622 color will be the same as the <B>-color</B> option. The default is defcolor. </DD>
1623
1624 <DT><B>-outline
1625 <I>color</I></B> </DT>
1626 <DD>Sets the color or the outline around each symbol. If <I>color</I> is "",
1627 then no outline is drawn. If <I>color</I> is defcolor, then the color will be
1628 the same as the <B>-color</B> option. The default is defcolor. </DD>
1629
1630 <DT><B>-outlinewidth <I>pixels</I></B>
1631 </DT>
1632 <DD>Sets the width of the outline bordering each symbol. If <I>pixels</I> is 0,
1633 no outline will be drawn. The default is 1. </DD>
1634
1635 <DT><B>-pixels <I>pixels</I></B> </DT>
1636 <DD>Sets the size
1637 of symbols. If <I>pixels</I> is 0, no symbols will be drawn. The default is
1638 0.125i. </DD>
1639
1640 <DT><B>-symbol <I>symbol</I></B> </DT>
1641 <DD>Specifies the symbol for data points. <I>Symbol</I> can
1642 be either square, circle, diamond, plus, cross, splus, scross,
1643 triangle, "" (where no symbol is drawn), or a bitmap. Bitmaps are specified
1644 as "<I>source</I> ?<I>mask</I>?", where <I>source</I> is the name of the bitmap, and <I>mask</I> is
1645 the bitmap's optional mask. The default is circle. </DD>
1646
1647 <DT><B>-type <I>elemType</I></B> </DT>
1648 <DD>Specifies
1649 the type of element the pen is to be used with. This option should only
1650 be employed when creating the pen. This is for those that wish to mix different
1651 types of elements (bars and lines) on the same graph. The default type
1652 is "line". </DD>
1653 </DL>
1654 <P>
1655 Pen configuration options may be also be set by the <B>option</B> command.
1656 The resource class is Pen. The resource names are the names of the pens.
1657 <BR>
1658 <CODE>option add *Graph.Pen.Color blue<BR>
1659 option add *Graph.activeLine.color green<BR>
1660 </blockquote>
1661
1662 <DL>
1663
1664 <DT></CODE><I>pathName <B>pen <B>create <I>penName </I></B></B></I>?<I>option value</I>?... </DT>
1665 <DD>Creates a new pen by the name
1666 <I>penName</I>. No pen by the same name can already exist. <I>Option</I> and <I>value</I> are
1667 described in above in the pen <B>configure</B> operation. </DD>
1668
1669 <DT><I>pathName <B>pen <B>delete
1670 </B></B></I>?<I>penName</I>?... </DT>
1671 <DD>Deletes the named pens. A pen is not really deleted until it is
1672 not longer in use, so it's safe to delete pens mapped to elements. </DD>
1673
1674 <DT><I>pathName
1675 <B>pen names </B></I>?<I>pattern</I>?... </DT>
1676 <DD>Returns a list of pens matching zero or more patterns.
1677 If no <I>pattern</I> argument is give, the names of all pens are returned. </DD>
1678 </DL>
1679
1680 <H3><A NAME="sect14" HREF="#toc14">PostScript
1681 Component</A></H3>
1682 The graph can generate encapsulated PostScript output. There are
1683 several configuration options you can specify to control how the plot will
1684 be generated. You can change the page dimensions and borders. The plot
1685 itself can be scaled, centered, or rotated to landscape. The PostScript
1686 output can be written directly to a file or returned through the interpreter.
1687 <P>
1688 The following postscript operations are available.
1689 <DL>
1690
1691 <DT><I>pathName <B>postscript cget
1692 <I>option</I></B></I> </DT>
1693 <DD>Returns the current value of the postscript option given by <I>option</I>.
1694 <I>Option</I> may be any option described below for the postscript <B>configure</B>
1695 operation. </DD>
1696
1697 <DT><I>pathName <B>postscript configure </B></I>?<I>option value</I>?... </DT>
1698 <DD>Queries or modifies
1699 the configuration options for PostScript generation. If <I>option</I> isn't specified,
1700 a list describing the current postscript options for <I>pathName</I> is returned.
1701 If <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is
1702 returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for
1703 each pair, the postscript option <I>option</I> is set to <I>value</I>. The following
1704 postscript options are available. <blockquote></DD>
1705
1706 <DT><B>-center <I>boolean</I></B> </DT>
1707 <DD>Indicates whether the plot
1708 should be centered on the PostScript page. If <I>boolean</I> is false, the plot
1709 will be placed in the upper left corner of the page. The default is 1.
1710 </DD>
1711
1712 <DT><B>-colormap <I>varName</I></B> </DT>
1713 <DD><I>VarName</I> must be the name of a global array variable that
1714 specifies a color mapping from the X color name to PostScript. Each element
1715 of <I>varName</I> must consist of PostScript code to set a particular color value
1716 (e.g. ``1.0 1.0 0.0 setrgbcolor''). When generating color information in PostScript,
1717 the array variable <I>varName</I> is checked if an element of the name as the
1718 color exists. If so, it uses its value as the PostScript command to set
1719 the color. If this option hasn't been specified, or if there isn't an entry
1720 in <I>varName</I> for a given color, then it uses the red, green, and blue intensities
1721 from the X color. </DD>
1722
1723 <DT><B>-colormode <I>mode</I></B> </DT>
1724 <DD>Specifies how to output color information.
1725 <I>Mode</I> must be either color (for full color output), gray (convert all
1726 colors to their gray-scale equivalents) or mono (convert foreground colors
1727 to black and background colors to white). The default mode is color.
1728 </DD>
1729
1730 <DT><B>-fontmap <I>varName</I></B> </DT>
1731 <DD><I>VarName</I> must be the name of a global array variable that
1732 specifies a font mapping from the X font name to PostScript. Each element
1733 of <I>varName</I> must consist of a Tcl list with one or two elements; the name
1734 and point size of a PostScript font. When outputting PostScript commands
1735 for a particular font, the array variable <I>varName</I> is checked to see if
1736 an element by the specified font exists. If there is such an element,
1737 then the font information contained in that element is used in the PostScript
1738 output. (If the point size is omitted from the list, the point size of
1739 the X font is used). Otherwise the X font is examined in an attempt to
1740 guess what PostScript font to use. This works only for fonts whose foundry
1741 property is <I>Adobe</I> (such as Times, Helvetica, Courier, etc.). If all of this
1742 fails then the font defaults to Helvetica-Bold. </DD>
1743
1744 <DT><B>-decorations <I>boolean</I></B> </DT>
1745 <DD>Indicates
1746 whether PostScript commands to generate color backgrounds and 3-D borders
1747 will be output. If <I>boolean</I> is false, the background will be white and
1748 no 3-D borders will be generated. The default is 1. </DD>
1749
1750 <DT><B>-height <I>pixels</I></B> </DT>
1751 <DD>Sets the
1752 height of the plot. This lets you print the graph with a height different
1753 from the one drawn on the screen. If <I>pixels</I> is 0, the height is the same
1754 as the widget's height. The default is 0. </DD>
1755
1756 <DT><B>-landscape <I>boolean</I></B> </DT>
1757 <DD>If <I>boolean</I> is
1758 true, this specifies the printed area is to be rotated 90 degrees. In non-rotated
1759 output the X-axis of the printed area runs along the short dimension of
1760 the page (``portrait'' orientation); in rotated output the X-axis runs along
1761 the long dimension of the page (``landscape'' orientation). Defaults to 0.
1762 </DD>
1763
1764 <DT><B>-maxpect <I>boolean</I></B> </DT>
1765 <DD>Indicates to scale the plot so that it fills the PostScript
1766 page. The aspect ratio of the graph is still retained. The default is 0.
1767 </DD>
1768
1769 <DT><B>-padx <I>pad</I></B> </DT>
1770 <DD>Sets the horizontal padding for the left and right page borders.
1771 The borders are exterior to the plot. <I>Pad</I> can be a list of one or two
1772 screen distances. If <I>pad</I> has two elements, the left border is padded by
1773 the first distance and the right border by the second. If <I>pad</I> has just
1774 one distance, both the left and right borders are padded evenly. The default
1775 is 1i. </DD>
1776
1777 <DT><B>-pady <I>pad</I></B> </DT>
1778 <DD>Sets the vertical padding for the top and bottom page
1779 borders. The borders are exterior to the plot. <I>Pad</I> can be a list of one
1780 or two screen distances. If <I>pad</I> has two elements, the top border is padded
1781 by the first distance and the bottom border by the second. If <I>pad</I> has just
1782 one distance, both the top and bottom borders are padded evenly. The default
1783 is 1i. </DD>
1784
1785 <DT><B>-paperheight <I>pixels</I></B> </DT>
1786 <DD>Sets the height of the postscript page. This
1787 can be used to select between different page sizes (letter, A4, etc). The
1788 default height is 11.0i. </DD>
1789
1790 <DT><B>-paperwidth <I>pixels</I></B> </DT>
1791 <DD>Sets the width of the postscript
1792 page. This can be used to select between different page sizes (letter,
1793 A4, etc). The default width is 8.5i. </DD>
1794
1795 <DT><B>-width <I>pixels</I></B> </DT>
1796 <DD>Sets the width of the
1797 plot. This lets you generate a plot of a width different from that of the
1798 widget. If <I>pixels</I> is 0, the width is the same as the widget's width. The
1799 default is 0. </DD>
1800 </DL>
1801 <P>
1802 Postscript configuration options may be also be set by the
1803 <B>option</B> command. The resource name and class are postscript and Postscript
1804 respectively. <BR>
1805 <CODE>option add *Graph.postscript.Decorations false<BR>
1806 option add *Graph.Postscript.Landscape true<BR>
1807 </blockquote>
1808
1809 <DL>
1810
1811 <DT></CODE><I>pathName <B>postscript output </B></I>?<I>fileName</I>? ?<I>option value</I>?... </DT>
1812 <DD>Outputs a file of
1813 encapsulated PostScript. If a <I>fileName</I> argument isn't present, the command
1814 returns the PostScript. If any <I>option-value</I> pairs are present, they set configuration
1815 options controlling how the PostScript is generated. <I>Option</I> and <I>value</I> can
1816 be anything accepted by the postscript <B>configure</B> operation above. </DD>
1817 </DL>
1818
1819 <H3><A NAME="sect15" HREF="#toc15">Marker
1820 Components</A></H3>
1821 Markers are simple drawing procedures used to annotate or highlight
1822 areas of the graph. Markers have various types: text strings, bitmaps,
1823 images, connected lines, windows, or polygons. They can be associated with
1824 a particular element, so that when the element is hidden or un-hidden, so
1825 is the marker. By default, markers are the last items drawn, so that data
1826 elements will appear in behind them. You can change this by configuring
1827 the <B>-under</B> option. <P>
1828 Markers, in contrast to elements, don't affect the scaling
1829 of the coordinate axes. They can also have <I>elastic</I> coordinates (specified
1830 by -Inf and Inf respectively) that translate into the minimum or maximum
1831 limit of the axis. For example, you can place a marker so it always remains
1832 in the lower left corner of the plotting area, by using the coordinates
1833 -Inf,-Inf. <P>
1834 The following operations are available for markers.
1835 <DL>
1836
1837 <DT><I>pathName
1838 <B>marker after <I>markerId</I></B></I> ?<I>afterId</I>? </DT>
1839 <DD>Changes the order of the markers, drawing
1840 the first marker after the second. If no second <I>afterId</I> argument is specified,
1841 the marker is placed at the end of the display list. This command can be
1842 used to control how markers are displayed since markers are drawn in the
1843 order of this display list. </DD>
1844
1845 <DT><I>pathName <B>marker before <I>markerId</I></B></I> ?<I>beforeId</I>? </DT>
1846 <DD>Changes
1847 the order of the markers, drawing the first marker before the second. If
1848 no second <I>beforeId</I> argument is specified, the marker is placed at the beginning
1849 of the display list. This command can be used to control how markers are
1850 displayed since markers are drawn in the order of this display list. </DD>
1851
1852 <DT><I>pathName
1853 <B>marker bind <I>tagName</I></B></I> ?<I>sequence</I>? ?<I>command</I>? </DT>
1854 <DD>Associates <I>command</I> with <I>tagName</I>
1855 such that whenever the event sequence given by <I>sequence</I> occurs for a marker
1856 with this tag, <I>command</I> will be invoked. The syntax is similar to the <B>bind</B>
1857 command except that it operates on graph markers, rather than widgets.
1858 See the <B>bind</B> manual entry for complete details on <I>sequence</I> and the substitutions
1859 performed on <I>command</I> before invoking it. <P>
1860 If all arguments are specified
1861 then a new binding is created, replacing any existing binding for the
1862 same <I>sequence</I> and <I>tagName</I>. If the first character of <I>command</I> is + then
1863 <I>command</I> augments an existing binding rather than replacing it. If no <I>command</I>
1864 argument is provided then the command currently associated with <I>tagName</I>
1865 and <I>sequence</I> (it's an error occurs if there's no such binding) is returned.
1866 If both <I>command</I> and <I>sequence</I> are missing then a list of all the event
1867 sequences for which bindings have been defined for <I>tagName</I>. </DD>
1868
1869 <DT><I>pathName <B>marker
1870 cget <I>option</I></B></I> </DT>
1871 <DD>Returns the current value of the marker configuration option
1872 given by <I>option</I>. <I>Option</I> may be any option described below in the <B>configure</B>
1873 operation. </DD>
1874
1875 <DT><I>pathName <B>marker configure <I>markerId</I></B></I> ?<I>option value</I>?... </DT>
1876 <DD>Queries or
1877 modifies the configuration options for markers. If <I>option</I> isn't specified,
1878 a list describing the current options for <I>markerId</I> is returned. If <I>option</I>
1879 is specified, but not <I>value</I>, then a list describing <I>option</I> is returned.
1880 If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair,
1881 the marker option <I>option</I> is set to <I>value</I>. <P>
1882 The following options are valid
1883 for all markers. Each type of marker also has its own type-specific options.
1884 They are described in the sections below. <blockquote></DD>
1885
1886 <DT><B>-bindtags <I>tagList</I></B> </DT>
1887 <DD>Specifies the
1888 binding tags for the marker. <I>TagList</I> is a list of binding tag names. The
1889 tags and their order will determine how events for markers are handled.
1890 Each tag in the list matching the current event sequence will have its
1891 Tcl command executed. Implicitly the name of the marker is always the
1892 first tag in the list. The default value is all. </DD>
1893
1894 <DT><B>-coords <I>coordList</I></B> </DT>
1895 <DD>Specifies
1896 the coordinates of the marker. <I>CoordList</I> is a list of graph coordinates.
1897 The number of coordinates required is dependent on the type of marker.
1898 Text, image, and window markers need only two coordinates (an X-Y coordinate).
1899 Bitmap markers can take either two or four coordinates (if four, they
1900 represent the corners of the bitmap). Line markers need at least four coordinates,
1901 polygons at least six. If <I>coordList</I> is "", the marker will not be displayed.
1902 The default is "". </DD>
1903
1904 <DT><B>-element <I>elemName</I></B> </DT>
1905 <DD>Links the marker with the element
1906 <I>elemName</I>. The marker is drawn only if the element is also currently displayed
1907 (see the element's <B>show</B> operation). If <I>elemName</I> is "", the marker is always
1908 drawn. The default is "". </DD>
1909
1910 <DT><B>-hide <I>boolean</I></B> </DT>
1911 <DD>Indicates whether the marker is
1912 drawn. If <I>boolean</I> is true, the marker is not drawn. The default is no.
1913 </DD>
1914
1915 <DT><B>-mapx <I>xAxis</I></B> </DT>
1916 <DD>Specifies the X-axis to map the marker's X-coordinates onto. <I>XAxis</I>
1917 must the name of an axis. The default is x. </DD>
1918
1919 <DT><B>-mapy <I>yAxis</I></B> </DT>
1920 <DD>Specifies the Y-axis
1921 to map the marker's Y-coordinates onto. <I>YAxis</I> must the name of an axis. The
1922 default is y. </DD>
1923
1924 <DT><B>-name <I>markerId</I></B> </DT>
1925 <DD>Changes the identifier for the marker. The
1926 identifier <I>markerId</I> can not already be used by another marker. If this
1927 option isn't specified, the marker's name is uniquely generated. </DD>
1928
1929 <DT><B>-under <I>boolean</I></B>
1930 </DT>
1931 <DD>Indicates whether the marker is drawn below/above data elements. If <I>boolean</I>
1932 is true, the marker is be drawn underneath the data element symbols and
1933 lines. Otherwise, the marker is drawn on top of the element. The default
1934 is 0. </DD>
1935
1936 <DT><B>-xoffset <I>pixels</I></B> </DT>
1937 <DD>Specifies a screen distance to offset the marker
1938 horizontally. <I>Pixels</I> is a valid screen distance, such as 2 or 1.2i. The
1939 default is 0. </DD>
1940
1941 <DT><B>-yoffset <I>pixels</I></B> </DT>
1942 <DD>Specifies a screen distance to offset the
1943 markers vertically. <I>Pixels</I> is a valid screen distance, such as 2 or 1.2i.
1944 The default is 0. </DD>
1945 </DL>
1946 <P>
1947 Marker configuration options may also be set by the
1948 <B>option</B> command. The resource class is either BitmapMarker, ImageMarker,
1949 LineMarker, PolygonMarker, TextMarker, or WindowMarker, depending
1950 on the type of marker. The resource name is the name of the marker. <BR>
1951 <CODE>option add *Graph.TextMarker.Foreground white<BR>
1952 option add *Graph.BitmapMarker.Foreground white<BR>
1953 option add *Graph.m1.Background blue<BR>
1954 </blockquote>
1955
1956 <DL>
1957
1958 <DT></CODE><I>pathName <B>marker create <I>type</I></B></I> ?<I>option value</I>?... </DT>
1959 <DD>Creates a marker of the selected
1960 type. <I>Type</I> may be either text, line, bitmap, image, polygon, or
1961 window. This command returns the marker identifier, used as the <I>markerId</I>
1962 argument in the other marker-related commands. If the <B>-name</B> option is used,
1963 this overrides the normal marker identifier. If the name provided is already
1964 used for another marker, the new marker will replace the old. </DD>
1965
1966 <DT><I>pathName <B>marker
1967 delete</B></I> ?<I>name</I>?... </DT>
1968 <DD>Removes one of more markers. The graph will automatically
1969 be redrawn without the marker.. </DD>
1970
1971 <DT><I>pathName <B>marker exists <I>markerId</I></B></I> </DT>
1972 <DD>Returns
1973 1 if the marker <I>markerId</I> exists and 0 otherwise. </DD>
1974
1975 <DT><I>pathName <B>marker names</B></I>
1976 ?<I>pattern</I>? </DT>
1977 <DD>Returns the names of all the markers that currently exist.
1978 If <I>pattern</I> is supplied, only those markers whose names match it will be
1979 returned. </DD>
1980
1981 <DT><I>pathName <B>marker type <I>markerId</I></B></I> </DT>
1982 <DD>Returns the type of the marker
1983 given by <I>markerId</I>, such as line or text. If <I>markerId</I> is not a valid
1984 a marker identifier, "" is returned. </DD>
1985 </DL>
1986
1987 <H3><A NAME="sect16" HREF="#toc16">Bitmap Markers</A></H3>
1988 A bitmap marker displays
1989 a bitmap. The size of the bitmap is controlled by the number of coordinates
1990 specified. If two coordinates, they specify the position of the top-left
1991 corner of the bitmap. The bitmap retains its normal width and height. If
1992 four coordinates, the first and second pairs of coordinates represent the
1993 corners of the bitmap. The bitmap will be stretched or reduced as necessary
1994 to fit into the bounding rectangle. <P>
1995 Bitmap markers are created with the
1996 marker's <B>create</B> operation in the form: <BR>
1997 <P>
1998 <CODE><I>pathName <B>marker create bitmap </B></I>?<I>option value</I>?...<BR>
1999 </CODE>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration options
2000 for the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's
2001 <B>configure</B> operation. <P>
2002 The following options are specific to bitmap markers:
2003
2004 <DL>
2005
2006 <DT><B>-background <I>color</I></B> </DT>
2007 <DD>Same as the <B>-fill</B> option. </DD>
2008
2009 <DT><B>-bitmap <I>bitmap</I></B> </DT>
2010 <DD>Specifies the bitmap
2011 to be displayed. If <I>bitmap</I> is "", the marker will not be displayed. The
2012 default is "". </DD>
2013
2014 <DT><B>-fill <I>color</I></B> </DT>
2015 <DD>Sets the background color of the bitmap. If
2016 <I>color</I> is the empty string, no background will be transparent. The default
2017 background color is "". </DD>
2018
2019 <DT><B>-foreground <I>color</I></B> </DT>
2020 <DD>Same as the <B>-outline</B> option. </DD>
2021
2022 <DT><B>-mask
2023 <I>mask</I></B> </DT>
2024 <DD>Specifies a mask for the bitmap to be displayed. This mask is a bitmap
2025 itself, denoting the pixels that are transparent. If <I>mask</I> is "", all
2026 pixels of the bitmap will be drawn. The default is "". </DD>
2027
2028 <DT><B>-outline <I>color</I></B> </DT>
2029 <DD>Sets
2030 the foreground color of the bitmap. The default value is black. </DD>
2031
2032 <DT><B>-rotate
2033 <I>theta</I></B> </DT>
2034 <DD>Sets the rotation of the bitmap. <I>Theta</I> is a real number representing
2035 the angle of rotation in degrees. The marker is first rotated and then
2036 placed according to its anchor position. The default rotation is 0.0. </DD>
2037 </DL>
2038
2039 <H3><A NAME="sect17" HREF="#toc17">Image
2040 Markers</A></H3>
2041 A image marker displays an image. Image markers are created with
2042 the marker's <B>create</B> operation in the form: <BR>
2043 <P>
2044 <CODE><I>pathName <B>marker create image </B></I>?<I>option value</I>?...<BR>
2045 </CODE>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
2046 the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's <B>configure</B>
2047 operation. <P>
2048 The following options are specific to image markers:
2049 <DL>
2050
2051 <DT><B>-anchor <I>anchor</I></B>
2052 </DT>
2053 <DD><I>Anchor</I> tells how to position the image relative to the positioning point
2054 for the image. For example, if <I>anchor</I> is center then the image is centered
2055 on the point; if <I>anchor</I> is n then the image will be drawn such that
2056 the top center point of the rectangular region occupied by the image will
2057 be at the positioning point. This option defaults to center. </DD>
2058
2059 <DT><B>-image <I>image</I></B>
2060 </DT>
2061 <DD>Specifies the image to be drawn. If <I>image</I> is "", the marker will not be
2062 drawn. The default is "". </DD>
2063 </DL>
2064
2065 <H3><A NAME="sect18" HREF="#toc18">Line Markers</A></H3>
2066 A line marker displays one or more
2067 connected line segments. Line markers are created with marker's <B>create</B> operation
2068 in the form: <BR>
2069 <P>
2070 <CODE><I>pathName <B>marker create line </B></I>?<I>option value</I>?...<BR>
2071 </CODE>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
2072 the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's <B>configure</B>
2073 operation. <P>
2074 The following options are specific to line markers:
2075 <DL>
2076
2077 <DT><B>-dashes <I>dashList</I></B>
2078 </DT>
2079 <DD>Sets the dash style of the line. <I>DashList</I> is a list of up to 11 numbers
2080 that alternately represent the lengths of the dashes and gaps on the line.
2081 Each number must be between 1 and 255. If <I>dashList</I> is "", the marker
2082 line will be solid. </DD>
2083
2084 <DT><B>-fill <I>color</I></B> </DT>
2085 <DD>Sets the background color of the line. This
2086 color is used with striped lines (see the <B>-fdashes</B> option). If <I>color</I> is the
2087 empty string, no background color is drawn (the line will be dashed, not
2088 striped). The default background color is "". </DD>
2089
2090 <DT><B>-linewidth <I>pixels</I></B> </DT>
2091 <DD>Sets the
2092 width of the lines. The default width is 0. </DD>
2093
2094 <DT><B>-outline <I>color</I></B> </DT>
2095 <DD>Sets the foreground
2096 color of the line. The default value is black. </DD>
2097
2098 <DT><B>-stipple <I>bitmap</I></B> </DT>
2099 <DD>Specifies
2100 a stipple pattern used to draw the line, rather than a solid line. <I>Bitmap</I>
2101 specifies a bitmap to use as the stipple pattern. If <I>bitmap</I> is "", then
2102 the line is drawn in a solid fashion. The default is "". </DD>
2103 </DL>
2104
2105 <H3><A NAME="sect19" HREF="#toc19">Polygon Markers</A></H3>
2106 A
2107 polygon marker displays a closed region described as two or more connected
2108 line segments. It is assumed the first and last points are connected. Polygon
2109 markers are created using the marker <B>create</B> operation in the form: <BR>
2110 <P>
2111 <CODE><I>pathName <B>marker create polygon </B></I>?<I>option value</I>?...<BR>
2112 </CODE>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
2113 the marker. These same <I>option</I>-<I>value</I> pairs may be used with the <B>marker configure</B>
2114 command to change the marker's configuration. The following options are supported
2115 for polygon markers:
2116 <DL>
2117
2118 <DT><B>-dashes <I>dashList</I></B> </DT>
2119 <DD>Sets the dash style of the outline
2120 of the polygon. <I>DashList</I> is a list of up to 11 numbers that alternately
2121 represent the lengths of the dashes and gaps on the outline. Each number
2122 must be between 1 and 255. If <I>dashList</I> is "", the outline will be a solid
2123 line. </DD>
2124
2125 <DT><B>-fill <I>color</I></B> </DT>
2126 <DD>Sets the fill color of the polygon. If <I>color</I> is "", then
2127 the interior of the polygon is transparent. The default is white. </DD>
2128
2129 <DT><B>-linewidth
2130 <I>pixels</I></B> </DT>
2131 <DD>Sets the width of the outline of the polygon. If <I>pixels</I> is zero,
2132 no outline is drawn. The default is 0. </DD>
2133
2134 <DT><B>-outline <I>color</I></B> </DT>
2135 <DD>Sets the color of
2136 the outline of the polygon. If the polygon is stippled (see the <B>-stipple</B>
2137 option), then this represents the foreground color of the stipple. The
2138 default is black. </DD>
2139
2140 <DT><B>-stipple <I>bitmap</I></B> </DT>
2141 <DD>Specifies that the polygon should be
2142 drawn with a stippled pattern rather than a solid color. <I>Bitmap</I> specifies
2143 a bitmap to use as the stipple pattern. If <I>bitmap</I> is "", then the polygon
2144 is filled with a solid color (if the <B>-fill</B> option is set). The default is
2145 "". </DD>
2146 </DL>
2147
2148 <H3><A NAME="sect20" HREF="#toc20">Text Markers</A></H3>
2149 A text marker displays a string of characters on one or
2150 more lines of text. Embedded newlines cause line breaks. They may be used
2151 to annotate regions of the graph. Text markers are created with the <B>create</B>
2152 operation in the form: <BR>
2153 <P>
2154 <CODE><I>pathName <B>marker create text </B></I>?<I>option value</I>?...<BR>
2155 </CODE>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option
2156 for the text marker. These same <I>option</I>-<I>value</I> pairs may be used with the
2157 marker's <B>configure</B> operation. <P>
2158 The following options are specific to text
2159 markers:
2160 <DL>
2161
2162 <DT><B>-anchor <I>anchor</I></B> </DT>
2163 <DD><I>Anchor</I> tells how to position the text relative to
2164 the positioning point for the text. For example, if <I>anchor</I> is center then
2165 the text is centered on the point; if <I>anchor</I> is n then the text will
2166 be drawn such that the top center point of the rectangular region occupied
2167 by the text will be at the positioning point. This default is center.
2168 </DD>
2169
2170 <DT><B>-background <I>color</I></B> </DT>
2171 <DD>Same as the <B>-fill</B> option. </DD>
2172
2173 <DT><B>-font <I>fontName</I></B> </DT>
2174 <DD>Specifies the font
2175 of the text. The default is *-Helvetica-Bold-R-Normal-*-120-*. </DD>
2176
2177 <DT><B>-fill <I>color</I></B> </DT>
2178 <DD>Sets
2179 the background color of the text. If <I>color</I> is the empty string, no background
2180 will be transparent. The default background color is "". </DD>
2181
2182 <DT><B>-foreground <I>color</I></B>
2183 </DT>
2184 <DD>Same as the <B>-outline</B> option. </DD>
2185
2186 <DT><B>-justify <I>justify</I></B> </DT>
2187 <DD>Specifies how the text should
2188 be justified. This matters only when the marker contains more than one
2189 line of text. <I>Justify</I> must be left, right, or center. The default
2190 is center. </DD>
2191
2192 <DT><B>-outline <I>color</I></B> </DT>
2193 <DD>Sets the color of the text. The default value
2194 is black. </DD>
2195
2196 <DT><B>-padx <I>pad</I></B> </DT>
2197 <DD>Sets the padding to the left and right exteriors of
2198 the text. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has two
2199 elements, the left side of the text is padded by the first distance and
2200 the right side by the second. If <I>pad</I> has just one distance, both the left
2201 and right sides are padded evenly. The default is 4. </DD>
2202
2203 <DT><B>-pady <I>pad</I></B> </DT>
2204 <DD>Sets the
2205 padding above and below the text. <I>Pad</I> can be a list of one or two screen
2206 distances. If <I>pad</I> has two elements, the area above the text is padded by
2207 the first distance and the area below by the second. If <I>pad</I> is just one
2208 distance, both the top and bottom areas are padded evenly. The default
2209 is 4. </DD>
2210
2211 <DT><B>-rotate <I>theta</I></B> </DT>
2212 <DD>Specifies the number of degrees to rotate the text.
2213 <I>Theta</I> is a real number representing the angle of rotation. The marker
2214 is first rotated along its center and is then drawn according to its anchor
2215 position. The default is 0.0. </DD>
2216
2217 <DT><B>-text <I>text</I></B> </DT>
2218 <DD>Specifies the text of the marker.
2219 The exact way the text is displayed may be affected by other options such
2220 as <B>-anchor</B> or <B>-rotate</B>. </DD>
2221 </DL>
2222
2223 <H3><A NAME="sect21" HREF="#toc21">Window Markers</A></H3>
2224 A window marker displays a widget at
2225 a given position. Window markers are created with the marker's <B>create</B> operation
2226 in the form: <BR>
2227 <P>
2228 <CODE><I>pathName <B>marker create window </B></I>?<I>option value</I>?...<BR>
2229 </CODE>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
2230 the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's <B>configure</B>
2231 command. <P>
2232 The following options are specific to window markers:
2233 <DL>
2234
2235 <DT><B>-anchor <I>anchor</I></B>
2236 </DT>
2237 <DD><I>Anchor</I> tells how to position the widget relative to the positioning point
2238 for the widget. For example, if <I>anchor</I> is center then the widget is centered
2239 on the point; if <I>anchor</I> is n then the widget will be displayed such that
2240 the top center point of the rectangular region occupied by the widget will
2241 be at the positioning point. This option defaults to center. </DD>
2242
2243 <DT><B>-height <I>pixels</I></B>
2244 </DT>
2245 <DD>Specifies the height to assign to the marker's window. If this option isn't
2246 specified, or if it is specified as "", then the window is given whatever
2247 height the widget requests internally. </DD>
2248
2249 <DT><B>-width <I>pixels</I></B> </DT>
2250 <DD>Specifies the width
2251 to assign to the marker's window. If this option isn't specified, or if it
2252 is specified as "", then the window is given whatever width the widget
2253 requests internally. </DD>
2254
2255 <DT><B>-window <I>pathName</I></B> </DT>
2256 <DD>Specifies the widget to be managed
2257 by the graph. <I>PathName</I> must be a child of the <B>graph</B> widget. </DD>
2258 </DL>
2259
2260 <H2><A NAME="sect22" HREF="#toc22">Graph Component
2261 Bindings</A></H2>
2262 Specific graph components, such as elements, markers and legend
2263 entries, can have a command trigger when event occurs in them, much like
2264 canvas items in Tk's canvas widget. Not all event sequences are valid. The
2265 only binding events that may be specified are those related to the mouse
2266 and keyboard (such as <B>Enter</B>, <B>Leave</B>, <B>ButtonPress</B>, <B>Motion</B>, and <B>KeyPress</B>).
2267 <P>
2268 Only one element or marker can be picked during an event. This means, that
2269 if the mouse is directly over both an element and a marker, only the uppermost
2270 component is selected. This isn't true for legend entries. Both a legend
2271 entry and an element (or marker) binding commands will be invoked if both
2272 items are picked. <P>
2273 It is possible for multiple bindings to match a particular
2274 event. This could occur, for example, if one binding is associated with
2275 the element name and another is associated with one of the element's tags
2276 (see the <B>-bindtags</B> option). When this occurs, all of the matching bindings
2277 are invoked. A binding associated with the element name is invoked first,
2278 followed by one binding for each of the element's bindtags. If there are
2279 multiple matching bindings for a single tag, then only the most specific
2280 binding is invoked. A continue command in a binding script terminates
2281 that script, and a break command terminates that script and skips any
2282 remaining scripts for the event, just as for the bind command. <P>
2283 The <B>-bindtags</B>
2284 option for these components controls addition tag names which can be matched.
2285 Implicitly elements and markers always have tags matching their names.
2286 Setting the value of the <B>-bindtags</B> option doesn't change this.
2287 <H2><A NAME="sect23" HREF="#toc23">C Language
2288 API</A></H2>
2289 You can manipulate data elements from the C language. There may be situations
2290 where it is too expensive to translate the data values from ASCII strings.
2291 Or you might want to read data in a special file format. <P>
2292 Data can manipulated
2293 from the C language using BLT vectors. You specify the X-Y data coordinates
2294 of an element as vectors and manipulate the vector from C. The graph will
2295 be redrawn automatically after the vectors are updated. <P>
2296 From Tcl, create
2297 the vectors and configure the element to use them. <BR>
2298 <CODE>vector X Y<BR>
2299 .g element configure line1 -xdata X -ydata Y<BR>
2300 </CODE>To set data points from C, you pass the values as arrays of doubles using
2301 the <B>Blt_ResetVector</B> call. The vector is reset with the new data and at
2302 the next idle point (when Tk re-enters its event loop), the graph will be
2303 redrawn automatically. <BR>
2304 <CODE>#include &lt;tcl.h&gt;<BR>
2305 #include &lt;blt.h&gt;<BR>
2306 <P>
2307 register int i;<BR>
2308 Blt_Vector *xVec, *yVec;<BR>
2309 double x[50], y[50];<BR>
2310 <P>
2311 /* Get the BLT vectors "X" and "Y" (created above from Tcl) */<BR>
2312 if ((Blt_GetVector(interp, "X", &amp;xVec) != TCL_OK) ||<BR>
2313 (Blt_GetVector(interp, "Y", &amp;yVec) != TCL_OK)) {<BR>
2314 return TCL_ERROR;<BR>
2315 }<BR>
2316 <P>
2317 for (i = 0; i &lt; 50; i++) {<BR>
2318 x[i] = i * 0.02;<BR>
2319 y[i] = sin(x[i]);<BR>
2320 }<tt> </tt>&nbsp;<tt> </tt>&nbsp;<BR>
2321 <P>
2322 /* Put the data into BLT vectors */<BR>
2323 if ((Blt_ResetVector(xVec, x, 50, 50, TCL_VOLATILE) != TCL_OK) ||<BR>
2324 (Blt_ResetVector(yVec, y, 50, 50, TCL_VOLATILE) != TCL_OK)) {<BR>
2325 return TCL_ERROR;<BR>
2326 }<BR>
2327 </CODE>See the <B>vector</B> manual page for more details.
2328 <H2><A NAME="sect24" HREF="#toc24">Speed Tips</A></H2>
2329 There may be cases
2330 where the graph needs to be drawn and updated as quickly as possible. If
2331 drawing speed becomes a big problem, here are a few tips to speed up displays.
2332
2333 <UL>
2334 <LI>Try to minimize the number of data points. The more data points the looked
2335 at, the more work the graph must do. </LI><LI>If your data is generated as floating
2336 point values, the time required to convert the data values to and from
2337 ASCII strings can be significant, especially when there any many data points.
2338 You can avoid the redundant string-to-decimal conversions using the C API
2339 to BLT vectors. </LI><LI>Data elements without symbols are drawn faster than with
2340 symbols. Set the data element's <B>-symbol</B> option to none. If you need to draw
2341 symbols, try using the simple symbols such as splus and scross. </LI><LI>Don't
2342 stipple or dash the element. Solid lines are much faster. </LI><LI>If you update
2343 data elements frequently, try turning off the widget's <B>-bufferelements</B> option.
2344 When the graph is first displayed, it draws data elements into an internal
2345 pixmap. The pixmap acts as a cache, so that when the graph needs to be
2346 redrawn again, and the data elements or coordinate axes haven't changed,
2347 the pixmap is simply copied to the screen. This is especially useful when
2348 you are using markers to highlight points and regions on the graph. But
2349 if the graph is updated frequently, changing either the element data or
2350 coordinate axes, the buffering becomes redundant. </LI>
2351 </UL>
2352
2353 <H2><A NAME="sect25" HREF="#toc25">Limitations</A></H2>
2354 Auto-scale routines
2355 do not use requested min/max limits as boundaries when the axis is logarithmically
2356 scaled. <P>
2357 The PostScript output generated for polygons with more than 1500
2358 points may exceed the limits of some printers (See PostScript Language
2359 Reference Manual, page 568). The work-around is to break the polygon into
2360 separate pieces.
2361 <H2><A NAME="sect26" HREF="#toc26">Keywords</A></H2>
2362 graph, widget <P>
2363
2364 <HR><P>
2365 <A NAME="toc"><B>Table of Contents</B></A><P>
2366 <UL>
2367 <LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
2368 <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
2369 <LI><A NAME="toc2" HREF="#sect2">Description</A></LI>
2370 <LI><A NAME="toc3" HREF="#sect3">Introduction</A></LI>
2371 <LI><A NAME="toc4" HREF="#sect4">Syntax</A></LI>
2372 <LI><A NAME="toc5" HREF="#sect5">Example</A></LI>
2373 <LI><A NAME="toc6" HREF="#sect6">Graph Operations</A></LI>
2374 <LI><A NAME="toc7" HREF="#sect7">Graph Components</A></LI>
2375 <UL>
2376 <LI><A NAME="toc8" HREF="#sect8">Axis Components</A></LI>
2377 <LI><A NAME="toc9" HREF="#sect9">Crosshairs Component</A></LI>
2378 <LI><A NAME="toc10" HREF="#sect10">Element Components</A></LI>
2379 <LI><A NAME="toc11" HREF="#sect11">Grid Component</A></LI>
2380 <LI><A NAME="toc12" HREF="#sect12">Legend Component</A></LI>
2381 <LI><A NAME="toc13" HREF="#sect13">Pen Components</A></LI>
2382 <LI><A NAME="toc14" HREF="#sect14">PostScript Component</A></LI>
2383 <LI><A NAME="toc15" HREF="#sect15">Marker Components</A></LI>
2384 <LI><A NAME="toc16" HREF="#sect16">Bitmap Markers</A></LI>
2385 <LI><A NAME="toc17" HREF="#sect17">Image Markers</A></LI>
2386 <LI><A NAME="toc18" HREF="#sect18">Line Markers</A></LI>
2387 <LI><A NAME="toc19" HREF="#sect19">Polygon Markers</A></LI>
2388 <LI><A NAME="toc20" HREF="#sect20">Text Markers</A></LI>
2389 <LI><A NAME="toc21" HREF="#sect21">Window Markers</A></LI>
2390 </UL>
2391 <LI><A NAME="toc22" HREF="#sect22">Graph Component Bindings</A></LI>
2392 <LI><A NAME="toc23" HREF="#sect23">C Language API</A></LI>
2393 <LI><A NAME="toc24" HREF="#sect24">Speed Tips</A></LI>
2394 <LI><A NAME="toc25" HREF="#sect25">Limitations</A></LI>
2395 <LI><A NAME="toc26" HREF="#sect26">Keywords</A></LI>
2396 </UL>
2397 </BODY></HTML>