Debian Codegraph @

man/barchart.mann

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