Debian Codegraph @

man/graph.mann

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