Debian Codegraph @

html/eps.html

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <!-- manual page source format generated by PolyglotMan v3.0.8+XFree86, -->
2 <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
3
4 <HTML>
5 <HEAD>
6 <TITLE>graph(n) manual page</TITLE>
7 </HEAD>
8 <BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
9 <A HREF="#toc">Table of Contents</A><P>
10
11 <H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
12 eps - Encapsulated PostScript canvas item.
13 <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
14 <I>canvas<B>
15 create eps <I>x y </I></B></I>?<I>option value</I>?...
16 <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
17 The <B>eps</B> canvas item lets you place
18 encapulated PostScript (EPS) on a canvas, controlling its size and placement.
19 The EPS item is displayed either as a solid rectangle or a preview image.
20 The preview image is designated in one of two ways: 1) the EPS file contains
21 an ASCII hexidecimal preview, or 2) a Tk photo image. When the canvas generates
22 PostScript output, the EPS will be inserted with the proper translation
23 and scaling to match that of the EPS item. So can use the canvas widget
24 as a page layout tool.
25 <H2><A NAME="sect3" HREF="#toc3">Example</A></H2>
26 Let's say you have for PostScript files of
27 four graphs which you want to tile two-by-two on a single page. Maybe you'd
28 like to annotate the graphs by putting a caption at the bottom of each
29 graph. <P>
30 Normally, you would have to resort to an external tool or write your
31 own PostScript program. The <B>eps</B> canvas item lets you do this through Tk's
32 canvas widget. An <B>eps</B> item displays an image (or rectangle) representing
33 the encapsulated PostScript file. It also scales and translates the EPS
34 file when the canvas is printed. <P>
35
36 <H2><A NAME="sect4" HREF="#toc4">Syntax</A></H2>
37 <BR>
38 <P>
39 <CODE><I>canvas <B>create eps <I>x y </I></B></I>?<I>option value</I>?...<BR>
40 </CODE><P>The <B>eps</B> item creates a new canvas item. <I>Canvas</I> is the name of a <B>canvas</B> widget.
41 You must supply the X-Y coordinate of the new eps item. How the coordinate
42 is exactly interpretered is controlled by the <B>-anchor</B> option (see below).
43 <P>
44 Additional options may be specified on the command line to configure aspects
45 of the eps item such as its color, stipple, and font. The following <I>option</I>
46 and <I>value</I> pairs are valid.
47 <DL>
48
49 <DT><B>-anchor <I>anchor</I></B> </DT>
50 <DD>Tells how to position the EPS item
51 relative to its X-Y coordinate. The default is <I>center</I>. </DD>
52
53 <DT><B>-background <I>color</I></B> </DT>
54 <DD>Sets
55 the background color of the EPS rectangle. </DD>
56
57 <DT><B>-borderwidth <I>pixels</I></B> </DT>
58 <DD>Sets the width
59 of the 3-D border around the outside edge of the item. The <B>-relief</B> option
60 determines if the border is to be drawn. The default is <I>0</I>. </DD>
61
62 <DT><B>-file <I>fileName</I></B>
63 </DT>
64 <DD>Specifies the name of the EPS file. The first line of an EPS file must
65 start with "%!PS" and contain a "EPS" version specification. The other
66 requirement is that there be a "%%BoundingBox:" entry which contains four
67 integers representing the lower-left and upper-right coordinates of the area
68 bounding the EPS. The default is <I>""</I>. </DD>
69
70 <DT><B>-font <I>fontName</I></B> </DT>
71 <DD>Specifies the font of
72 the title. The default is <I>*-Helvetica-Bold-R-Normal-*-18-180-*</I>. </DD>
73
74 <DT><B>-foreground <I>color</I></B>
75 </DT>
76 <DD>Specifies the foreground color of the EPS rectangle. The option matters
77 only when the <B>-stipple</B> option is set. The default is <I>white</I>. </DD>
78
79 <DT><B>-height <I>pixels</I></B>
80 </DT>
81 <DD>Specifies the height EPS item. If <I>pixels</I> is <I>0</I>, then the height is determined
82 from the PostScript "BoundingBox:" entry in the EPS file. The default is
83 <I>0</I>. </DD>
84
85 <DT><B>-image <I>photo</I></B> </DT>
86 <DD>Specifies the name of a Tk photo image to be displayed as
87 in the item as a preview image. This option overrides any preview specification
88 found in the EPS file. The default is <I>""</I>. </DD>
89
90 <DT><B>-justify <I>justify</I></B> </DT>
91 <DD>Specifies how the
92 title should be justified. This matters only when the title contains more
93 than one line of text. <I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>. The default
94 is <I>center</I>. </DD>
95
96 <DT><B>-relief <I>relief</I></B> </DT>
97 <DD>Specifies the 3-D effect for the EPS item. <I>Relief</I>
98 specifies how the item should appear relative to canvas; for example,
99 <I>raised</I> means the item should appear to protrude. The default is <I>flat</I>. </DD>
100
101 <DT><B>-shadowcolor
102 <I>color</I></B> </DT>
103 <DD>Specifies the color of the drop shadow used for the title. The option
104 with the <B>-shadowoffset</B> option control how the title's drop shadow appears.
105 The default is <I>grey</I>. </DD>
106
107 <DT><B>-shadowoffset <I>pixels</I></B> </DT>
108 <DD>Specifies the offset of the drop
109 shadow from the title's text. If <I>pixels</I> is <I>0</I>, no shadow will be seen. The
110 default is <I>0</I>. </DD>
111
112 <DT><B>-showimage <I>boolean</I></B> </DT>
113 <DD>Indicates whether to display the image preview
114 (if one exists), or a simple rectangle. The default is <I>yes</I>. </DD>
115
116 <DT><B>-stipple <I>bitmap</I></B>
117 </DT>
118 <DD>Specifies a bitmap to used to stipple the rectangle representing the EPS
119 item. The default is <I>""</I>. </DD>
120
121 <DT><B>-title <I>string</I></B> </DT>
122 <DD>Sets the title of the EPS item. If
123 <I>string</I> is <I>""</I>, then the title specified by the PostScript "Title:" entry
124 is used. You can set the string a single space to display no title. The
125 default is <I>""</I>. </DD>
126
127 <DT><B>-titleanchor <I>anchor</I></B> </DT>
128 <DD>Tells how to position the title within
129 EPS item. The default is <I>n</I>. </DD>
130
131 <DT><B>-titlecolor <I>color</I></B> </DT>
132 <DD>Specifies the color of the title.
133 The default is <I>white</I>. </DD>
134
135 <DT><B>-titlerotate <I>degrees</I></B> </DT>
136 <DD>Sets the rotation of the title.
137 <I>Degrees</I> is a real number representing the angle of rotation. The title
138 is first rotated in space and then placed according to the <B>-titleanchor</B>
139 position. The default rotation is <I>0.0</I>. </DD>
140
141 <DT><B>-width <I>pixels</I></B> </DT>
142 <DD>Specifies the width EPS
143 item. If <I>pixels</I> is <I>0</I>, then the width is determined from the PostScript
144 "BoundingBox:" entry in the EPS file. The default is <I>0</I>. <I>5i</I>. </DD>
145 </DL>
146
147 <H2><A NAME="sect5" HREF="#toc5">Example</A></H2>
148 The <B>graph</B>
149 command creates a new graph. <BR>
150 <CODE># Create a new graph. Plotting area is black.<BR>
151 graph .g -plotbackground black<BR>
152 </CODE><P>A new Tcl command <I>.g</I> is also created. This command can be used to query
153 and modify the graph. For example, to change the title of the graph to
154 "My Plot", you use the new command and the graph's <B>configure</B> operation. <BR>
155 <CODE># Change the title.<BR>
156 .g configure -title "My Plot"<BR>
157 </CODE><P>A graph has several components. To access a particular component you use
158 the component's name. For example, to add data elements, you use the new
159 command and the <B>element</B> component. <BR>
160 <CODE># Create a new element named "line1"<BR>
161 .g element create line1 \<BR>
162 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;-xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \<BR>
163 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;-ydata { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 <BR>
164 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;155.85 166.60 175.38 }<BR>
165 </CODE><P>The element's X and Y coordinates are specified using lists of numbers.
166 Alternately, BLT vectors could be used to hold the X-Y coordinates. <BR>
167 <CODE># Create two vectors and add them to the graph.<BR>
168 vector xVec yVec<BR>
169 xVec set { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 }<BR>
170 yVec set { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 <BR>
171 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;166.60 175.38 }<BR>
172 .g element create line1 -xdata xVec -ydata yVec<BR>
173 </CODE><P>The advantage of using vectors is that when you modify one, the graph is
174 automatically redrawn to display the new values. <BR>
175 <CODE># Change the X-Y coordinates of the first point.<BR>
176 set xVec(0) 0.18<BR>
177 set yVec(0) 25.18<BR>
178 </CODE><P>An element named <I>line1</I> is now created in <I>.g</I>. By default, the element's label
179 in the legend will be also <I>line1</I>. You can change the label, or specify no
180 legend entry, again using the element's <B>configure</B> operation. <BR>
181 <CODE># Don't display "line1" in the legend.<BR>
182 .g element configure line1 -label ""<BR>
183 </CODE><P>You can configure more than just the element's label. An element has many
184 attributes such as symbol type and size, dashed or solid lines, colors,
185 line width, etc. <BR>
186 <CODE>.g element configure line1 -symbol square -color red \<BR>
187 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;-dashes { 2 4 2 } -linewidth 2 -pixels 2c<BR>
188 </CODE><P>Four coordinate axes are automatically created: <I>x</I>, <I>x2</I>, <I>y</I>, and <I>y2</I>. And by
189 default, elements are mapped onto the axes <I>x</I> and <I>y</I>. This can be changed
190 with the <B>-mapx</B> and <B>-mapy</B> options. <BR>
191 <CODE># Map "line1" on the alternate Y-axis "y2".<BR>
192 .g element configure line1 -mapy y2<BR>
193 </CODE><P>Axes can be configured in many ways too. For example, you change the scale
194 of the Y-axis from linear to log using the <B>axis</B> component. <BR>
195 <CODE># Y-axis is log scale.<BR>
196 .g axis configure y -logscale yes<BR>
197 </CODE><P>One important way axes are used is to zoom in on a particular data region.
198 Zooming is done by simply specifying new axis limits using the <B>-min</B> and
199 <B>-max</B> configuration options. <BR>
200 <CODE>.g axis configure x -min 1.0 -max 1.5<BR>
201 .g axis configure y -min 12.0 -max 55.15<BR>
202 </CODE><P>To zoom interactively, you link the axis <B>configure</B> operations with some
203 user interaction (such as pressing the mouse button), using the <B>bind</B> command.
204 To convert between screen and graph coordinates, use the <B>invtransform</B>
205 operation. <BR>
206 <CODE># Click the button to set a new minimum <BR>
207 bind .g &lt;ButtonPress-1&gt; { <BR>
208 %W axis configure x -min [%W axis invtransform x %x]<BR>
209 %W axis configure x -min [%W axis invtransform x %y]<BR>
210 }<BR>
211 </CODE><P>By default, the limits of the axis are determined from data values. To reset
212 back to the default limits, set the <B>-min</B> and <B>-max</B> options to the empty value.
213 <BR>
214 <CODE># Reset the axes to autoscale again.<BR>
215 .g axis configure x -min {} -max {}<BR>
216 .g axis configure y -min {} -max {}<BR>
217 </CODE><P>By default, the legend is drawn in the right margin. You can change this
218 or any legend configuration options using the <B>legend</B> component. <BR>
219 <CODE># Configure the legend font, color, and relief<BR>
220 .g legend configure -position left -relief raised \<BR>
221 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;-font fixed -fg blue<BR>
222 </CODE><P>To prevent the legend from being displayed, turn on the <B>-hide</B> option. <BR>
223 <CODE># Don't display the legend.<BR>
224 .g legend configure -hide yes<BR>
225 </CODE><P>The <B>graph</B> widget has simple drawing procedures called markers. They can
226 be used to highlight or annotate data in the graph. The types of markers
227 available are bitmaps, images, polygons, lines, or windows. Markers can
228 be used, for example, to mark or brush points. In this example, is a text
229 marker that labels the data first point. Markers are created using the
230 <B>marker</B> component. <BR>
231 <CODE># Create a label for the first data point of "line1".<BR>
232 .g marker create text -name first_marker -coords { 0.2 26.18 } \<BR>
233 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;-text "start" -anchor se -xoffset -10 -yoffset -10<BR>
234 </CODE><P>This creates a text marker named <I>first_marker</I>. It will display the text
235 "start" near the coordinates of the first data point. The <B>-anchor</B>, <B>-xoffset</B>,
236 and <B>-yoffset</B> options are used to display the marker above and to the left
237 of the data point, so that the data point isn't covered by the marker. By
238 default, markers are drawn last, on top of data. You can change this with
239 the <B>-under</B> option. <BR>
240 <CODE># Draw the label before elements are drawn.<BR>
241 .g marker configure first_marker -under yes<BR>
242 </CODE><P>You can add cross hairs or grid lines using the <B>crosshairs</B> and <B>grid</B> components.
243 <BR>
244 <CODE># Display both cross hairs and grid lines.<BR>
245 .g crosshairs configure -hide no -color red<BR>
246 .g grid configure -hide no -dashes { 2 2 }<BR>
247 </CODE><P>Finally, to get hardcopy of the graph, use the <B>postscript</B> component. <BR>
248 <CODE># Print the graph into file "file.ps"<BR>
249 .g postscript output file.ps -maxpect yes -decorations no<BR>
250 </CODE><P>This generates a file <I>file.ps</I> containing the encapsulated PostScript of
251 the graph. The option <B>-maxpect</B> says to scale the plot to the size of the
252 page. Turning off the <B>-decorations</B> option denotes that no borders or color
253 backgrounds should be drawn (i.e. the background of the margins, legend,
254 and plotting area will be white).
255 <H2><A NAME="sect6" HREF="#toc6">Graph Operations</A></H2>
256
257 <DL>
258
259 <DT><I>pathName <B>axis <I>operation
260 </I></B></I>?<I>arg</I>?... </DT>
261 <DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT>
262 section. </DD>
263
264 <DT><I>pathName <B>bar <I>elemName </I></B></I>?<I>option value</I>?...
265 </DT>
266 <DD>Creates a new barchart element <I>elemName</I>. It's an error if an element <I>elemName</I>
267 already exists. See the manual for <B>barchart</B> for details about what <I>option</I>
268 and <I>value</I> pairs are valid. </DD>
269
270 <DT><I>pathName <B>cget</B></I> <I>option</I> </DT>
271 <DD>Returns the current value
272 of the configuration option given by <I>option</I>. <I>Option</I> may be any option described
273 below for the <B>configure</B> operation. </DD>
274
275 <DT><I>pathName <B>configure </B></I>?<I>option value</I>?... </DT>
276 <DD>Queries
277 or modifies the configuration options of the graph. If <I>option</I> isn't specified,
278 a list describing the current options for <I>pathName</I> is returned. If <I>option</I>
279 is specified, but not <I>value</I>, then a list describing <I>option</I> is returned.
280 If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair,
281 the option <I>option</I> is set to <I>value</I>. The following options are valid. <blockquote></DD>
282
283 <DT><B>-background
284 <I>color</I></B> </DT>
285 <DD>Sets the background color. This includes the margins and legend, but
286 not the plotting area. </DD>
287
288 <DT><B>-borderwidth <I>pixels</I></B> </DT>
289 <DD>Sets the width of the 3-D border
290 around the outside edge of the widget. The <B>-relief</B> option determines if
291 the border is to be drawn. The default is <I>2</I>. </DD>
292
293 <DT><B>-bottommargin <I>pixels</I></B> </DT>
294 <DD>Specifies
295 the size of the margin below the X-coordinate axis. If <I>pixels</I> is <I>0</I>, the
296 size of the margin is selected automatically. The default is <I>0</I>. </DD>
297
298 <DT><B>-bufferelements
299 <I>boolean</I></B> </DT>
300 <DD>Indicates whether an internal pixmap to buffer the display of data
301 elements should be used. If <I>boolean</I> is true, data elements are drawn to
302 an internal pixmap. This option is especially useful when the graph is
303 redrawn frequently while the remains data unchanged (for example, moving
304 a marker across the plot). See the <FONT SIZE=-1><B>SPEED TIPS</B></FONT>
305 section. The default is <I>1</I>.
306 </DD>
307
308 <DT><B>-cursor <I>cursor</I></B> </DT>
309 <DD>Specifies the widget's cursor. The default cursor is <I>crosshair</I>.
310 </DD>
311
312 <DT><B>-font <I>fontName</I></B> </DT>
313 <DD>Specifies the font of the graph title. The default is <I>*-Helvetica-Bold-R-Normal-*-18-180-*</I>.
314 </DD>
315
316 <DT><B>-halo <I>pixels</I></B> </DT>
317 <DD>Specifies a maximum distance to consider when searching for
318 the closest data point (see the element's <B>closest</B> operation below). Data
319 points further than <I>pixels</I> away are ignored. The default is <I>0.5i</I>. </DD>
320
321 <DT><B>-height
322 <I>pixels</I></B> </DT>
323 <DD>Specifies the requested height of widget. The default is <I>4i</I>. </DD>
324
325 <DT><B>-invertxy
326 <I>boolean</I></B> </DT>
327 <DD>Indicates whether the placement X-axis and Y-axis should be inverted.
328 If <I>boolean</I> is true, the X and Y axes are swapped. The default is <I>0</I>. </DD>
329
330 <DT><B>-justify
331 <I>justify</I></B> </DT>
332 <DD>Specifies how the title should be justified. This matters only
333 when the title contains more than one line of text. <I>Justify</I> must be <I>left</I>,
334 <I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD>
335
336 <DT><B>-leftmargin <I>pixels</I></B> </DT>
337 <DD>Sets the size
338 of the margin from the left edge of the window to the Y-coordinate axis.
339 If <I>pixels</I> is <I>0</I>, the size is calculated automatically. The default is <I>0</I>.
340 </DD>
341
342 <DT><B>-plotbackground <I>color</I></B> </DT>
343 <DD>Specifies the background color of the plotting area.
344 The default is <I>white</I>. </DD>
345
346 <DT><B>-plotborderwidth <I>pixels</I></B> </DT>
347 <DD>Sets the width of the 3-D border
348 around the plotting area. The <B>-plotrelief</B> option determines if a border
349 is drawn. The default is <I>2</I>. </DD>
350
351 <DT><B>-plotpadx <I>pad</I></B> </DT>
352 <DD>Sets the amount of padding to be
353 added to the left and right sides of the plotting area. <I>Pad</I> can be a list
354 of one or two screen distances. If <I>pad</I> has two elements, the left side
355 of the plotting area entry is padded by the first distance and the right
356 side by the second. If <I>pad</I> is just one distance, both the left and right
357 sides are padded evenly. The default is <I>8</I>. </DD>
358
359 <DT><B>-plotpady <I>pad</I></B> </DT>
360 <DD>Sets the amount
361 of padding to be added to the top and bottom of the plotting area. <I>Pad</I>
362 can be a list of one or two screen distances. If <I>pad</I> has two elements,
363 the top of the plotting area is padded by the first distance and the bottom
364 by the second. If <I>pad</I> is just one distance, both the top and bottom are
365 padded evenly. The default is <I>8</I>. </DD>
366
367 <DT><B>-plotrelief <I>relief</I></B> </DT>
368 <DD>Specifies the 3-D effect
369 for the plotting area. <I>Relief</I> specifies how the interior of the plotting
370 area should appear relative to rest of the graph; for example, <I>raised</I> means
371 the plot should appear to protrude from the graph, relative to the surface
372 of the graph. The default is <I>sunken</I>. </DD>
373
374 <DT><B>-relief <I>relief</I></B> </DT>
375 <DD>Specifies the 3-D effect
376 for the graph widget. <I>Relief</I> specifies how the graph should appear relative
377 to widget it is packed into; for example, <I>raised</I> means the graph should
378 appear to protrude. The default is <I>flat</I>. </DD>
379
380 <DT><B>-rightmargin <I>pixels</I></B> </DT>
381 <DD>Sets the size
382 of margin from the plotting area to the right edge of the window. By default,
383 the legend is drawn in this margin. If <I>pixels</I> is than 1, the margin size
384 is selected automatically. </DD>
385
386 <DT><B>-takefocus</B> <I>focus</I> </DT>
387 <DD>Provides information used when
388 moving the focus from window to window via keyboard traversal (e.g., Tab
389 and Shift-Tab). If <I>focus</I> is <I>0</I>, this means that this window should be skipped
390 entirely during keyboard traversal. <I>1</I> means that the this window should
391 always receive the input focus. An empty value means that the traversal
392 scripts make the decision whether to focus on the window. The default is
393 <I>""</I>. </DD>
394
395 <DT><B>-tile <I>image</I></B> </DT>
396 <DD>Specifies a tiled background for the widget. If <I>image</I> isn't
397 <I>""</I>, the background is tiled using <I>image</I>. Otherwise, the normal background
398 color is drawn (see the <B>-background</B> option). <I>Image</I> must be an image created
399 using the Tk <B>image</B> command. The default is <I>""</I>. </DD>
400
401 <DT><B>-title <I>text</I></B> </DT>
402 <DD>Sets the title
403 to <I>text</I>. If <I>text</I> is <I>""</I>, no title will be displayed. </DD>
404
405 <DT><B>-topmargin <I>pixels</I></B> </DT>
406 <DD>Specifies
407 the size of the margin above the x2 axis. If <I>pixels</I> is <I>0</I>, the margin size
408 is calculated automatically. </DD>
409
410 <DT><B>-width <I>pixels</I></B> </DT>
411 <DD>Specifies the requested width
412 of the widget. The default is <I>5i</I>. </DD>
413 </DL>
414 </blockquote>
415
416 <DL>
417
418 <DT><I>pathName <B>crosshairs <I>operation </I></B></I>?<I>arg</I>? </DT>
419 <DD>See
420 the <FONT SIZE=-1><B>CROSSHAIRS COMPONENT</B></FONT>
421 section. </DD>
422
423 <DT><I>pathName <B>element <I>operation </I></B></I>?<I>arg</I>?... </DT>
424 <DD>See
425 the <FONT SIZE=-1><B>ELEMENT COMPONENTS</B></FONT>
426 section. </DD>
427
428 <DT><I>pathName <B>extents <I>item</I></B></I> </DT>
429 <DD>Reports the size
430 of a particular items in the graph. <I>Item</I> must be either <I>leftmargin</I>, <I>rightmargin</I>,
431 <I>topmargin</I>, <I>bottommargin</I>, <I>plotwidth</I>, or <I>plotheight</I>. </DD>
432
433 <DT><I>pathName <B>grid <I>operation
434 </I></B></I>?<I>arg</I>?... </DT>
435 <DD>See the <FONT SIZE=-1><B>GRID COMPONENT</B></FONT>
436 section. </DD>
437
438 <DT><I>pathName <B>invtransform <I>winX winY</I></B></I>
439 </DT>
440 <DD>Performs an inverse coordinate transformation, mapping window coordinates
441 back to graph coordinates, using the standard X-axis and Y-axis. Returns a
442 list of containing the X-Y y graph coordinates. </DD>
443
444 <DT><I>pathName <B>inside <I>x y</I></B></I> </DT>
445 <DD>Returns
446 <I>1</I> is the designated screen coordinate (<I>x</I> and <I>y</I>) is inside the plotting
447 area and <I>0</I> otherwise. </DD>
448
449 <DT><I>pathName <B>legend <I>operation </I></B></I>?<I>arg</I>?... </DT>
450 <DD>See the <FONT SIZE=-1><B>LEGEND COMPONENT</B></FONT>
451
452 section. </DD>
453
454 <DT><I>pathName <B>line<B> operation arg</B></B></I>... </DT>
455 <DD>The operation is the same as <B>element</B>.
456 </DD>
457
458 <DT><I>pathName <B>marker <I>operation </I></B></I>?<I>arg</I>?... </DT>
459 <DD>See the <FONT SIZE=-1><B>MARKER COMPONENTS</B></FONT>
460 section. </DD>
461
462 <DT><I>pathName
463 <B>postscript <I>operation </I></B></I>?<I>arg</I>?... </DT>
464 <DD>See the <FONT SIZE=-1><B>POSTSCRIPT COMPONENT</B></FONT>
465 section. </DD>
466
467 <DT><I>pathName
468 <B>snap <I>photoName</I></B></I> </DT>
469 <DD>Takes a snapshot of the graph and stores the contents in
470 the photo image <I>photoName</I>. <I>PhotoName</I> is the name of a Tk photo image that
471 must already exist. </DD>
472
473 <DT><I>pathName <B>transform <I>x y</I></B></I> </DT>
474 <DD>Performs a coordinate transformation,
475 mapping graph coordinates to window coordinates, using the standard X-axis
476 and Y-axis. Returns a list containing the X-Y screen coordinates. </DD>
477
478 <DT><I>pathName
479 <B>xaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
480 <DD></DD>
481
482 <DT><I>pathName <B>x2axis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
483 <DD></DD>
484
485 <DT><I>pathName <B>yaxis <I>operation</I></B></I>
486 ?<I>arg</I>?... </DT>
487 <DD></DD>
488
489 <DT><I>pathName <B>y2axis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
490 <DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT>
491 section.
492 </DD>
493 </DL>
494
495 <H2><A NAME="sect7" HREF="#toc7">Graph Components</A></H2>
496 A graph is composed of several components: coordinate axes,
497 data elements, legend, grid, cross hairs, postscript, and annotation markers.
498 Instead of one big set of configuration options and operations, the graph
499 is partitioned, where each component has its own configuration options
500 and operations that specifically control that aspect or part of the graph.
501
502 <H3><A NAME="sect8" HREF="#toc8">Axis Components</A></H3>
503 Four coordinate axes are automatically created: two X-coordinate
504 axes (<I>x</I> and <I>x2</I>) and two Y-coordinate axes (<I>y</I>, and <I>y2</I>). By default, the axis
505 <I>x</I> is located in the bottom margin, <I>y</I> in the left margin, <I>x2</I> in the top
506 margin, and <I>y2</I> in the right margin. <P>
507 An axis consists of the axis line, title,
508 major and minor ticks, and tick labels. Major ticks are drawn at uniform
509 intervals along the axis. Each tick is labeled with its coordinate value.
510 Minor ticks are drawn at uniform intervals within major ticks. <P>
511 The range
512 of the axis controls what region of data is plotted. Data points outside
513 the minimum and maximum limits of the axis are not plotted. By default,
514 the minimum and maximum limits are determined from the data, but you can
515 reset either limit. <P>
516 You can create and use several axes. To create an axis,
517 invoke the axis component and its create operation. <BR>
518 <CODE># Create a new axis called "tempAxis"<BR>
519 .g axis create tempAxis<BR>
520 </CODE><P>You map data elements to an axis using the element's -mapy and -mapx configuration
521 options. They specify the coordinate axes an element is mapped onto. <BR>
522 <CODE># Now map the tempAxis data to this axis.<BR>
523 .g element create "e1" -xdata $x -ydata $y -mapy tempAxis<BR>
524 </CODE><P>While you can create many axes, only four can be displayed simultaneously.
525 They are drawn in each of the margins surrounding the plotting area. The
526 axes <I>x</I> and <I>y</I> are drawn in the bottom and left margins. The axes <I>x2</I> and <I>y2</I>
527 are drawn in top and right margins. Only <I>x</I> and <I>y</I> are shown by default. Note
528 that the axes can have different scales. <P>
529 To display a different axis, you
530 invoke one of the following components: <B>xaxis</B>, <B>yaxis</B>, <B>x2axis</B>, and <B>y2axis</B>.
531 The <B>use</B> operation designates the axis to be drawn in the corresponding
532 margin: <B>xaxis</B> in the bottom, <B>yaxis</B> in the left, <B>x2axis</B> in the top, and
533 <B>y2axis</B> in the right. <BR>
534 <CODE># Display the axis tempAxis in the left margin.<BR>
535 .g yaxis use tempAxis<BR>
536 <P>
537 </CODE><P>You can configure axes in many ways. The axis scale can be linear or logarithmic.
538 The values along the axis can either monotonically increase or decrease.
539 If you need custom tick labels, you can specify a Tcl procedure to format
540 the label any way you wish. You can control how ticks are drawn, by changing
541 the major tick interval or the number of minor ticks. You can define non-uniform
542 tick intervals, such as for time-series plots. <P>
543
544 <DL>
545
546 <DT><I>pathName <B>axis <B>cget <I>axisName
547 <I>option</I></I></B></B></I> </DT>
548 <DD>Returns the current value of the option given by <I>option</I> for <I>axisName</I>.
549 <I>Option</I> may be any option described below for the axis <B>configure</B> operation.
550 </DD>
551
552 <DT><I>pathName <B>axis <B>configure <I>axisName </I></B></B></I>?<I>axisName</I>?... ?<I>option value</I>?... </DT>
553 <DD>Queries or modifies
554 the configuration options of <I>axisName</I>. Several axes can be changed. If <I>option</I>
555 isn't specified, a list describing all the current options for <I>axisName</I>
556 is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing
557 <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified,
558 then for each pair, the axis option <I>option</I> is set to <I>value</I>. The following
559 options are valid for axes. <blockquote></DD>
560
561 <DT><B>-color <I>color</I></B> </DT>
562 <DD>Sets the color of the axis and tick
563 labels. The default is <I>black</I>. </DD>
564
565 <DT><B>-command <I>prefix</I></B> </DT>
566 <DD>Specifies a Tcl command to be
567 invoked when formatting the axis tick labels. <I>Prefix</I> is a string containing
568 the name of a Tcl proc and any extra arguments for the procedure. This
569 command is invoked for each major tick on the axis. Two additional arguments
570 are passed to the procedure: the pathname of the widget and the current
571 the numeric value of the tick. The procedure returns the formatted tick
572 label. If <I>""</I> is returned, no label will appear next to the tick. You can
573 get the standard tick labels again by setting <I>prefix</I> to <I>""</I>. The default
574 is <I>""</I>. <P>
575 Please note that this procedure is invoked while the graph is redrawn.
576 You may query configuration options. But do not them, because this can
577 have unexpected results. </DD>
578
579 <DT><B>-descending <I>boolean</I></B> </DT>
580 <DD>Indicates whether the values
581 along the axis are monotonically increasing or decreasing. If <I>boolean</I> is
582 true, the axis values will be decreasing. The default is <I>0</I>. </DD>
583
584 <DT><B>-hide <I>boolean</I></B>
585 </DT>
586 <DD>Indicates whether the axis is displayed. </DD>
587
588 <DT><B>-justify <I>justify</I></B> </DT>
589 <DD>Specifies how
590 the axis title should be justified. This matters only when the axis title
591 contains more than one line of text. <I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>.
592 The default is <I>center</I>. </DD>
593
594 <DT><B>-limits <I>formatStr</I></B> </DT>
595 <DD>Specifies a printf-like description
596 to format the minimum and maximum limits of the axis. The limits are displayed
597 at the top/bottom or left/right sides of the plotting area. <I>FormatStr</I> is
598 a list of one or two format descriptions. If one description is supplied,
599 both the minimum and maximum limits are formatted in the same way. If two,
600 the first designates the format for the minimum limit, the second for the
601 maximum. If <I>""</I> is given as either description, then the that limit will
602 not be displayed. The default is <I>""</I>. </DD>
603
604 <DT><B>-linewidth <I>pixels</I></B> </DT>
605 <DD>Sets the width of
606 the axis and tick lines. The default is <I>1</I> pixel. </DD>
607
608 <DT><B>-logscale <I>boolean</I></B> </DT>
609 <DD>Indicates
610 whether the scale of the axis is logarithmic or linear. If <I>boolean</I> is true,
611 the axis is logarithmic. The default scale is linear. </DD>
612
613 <DT><B>-loose <I>boolean</I></B> </DT>
614 <DD>Indicates
615 whether the limits of the axis should fit the data points tightly, at the
616 outermost data points, or loosely, at the outer tick intervals. This is
617 relevant only when the axis limit is automatically calculated. If <I>boolean</I>
618 is true, the axis range is "loose". The default is <I>0</I>. </DD>
619
620 <DT><B>-majorticks <I>majorList</I></B>
621 </DT>
622 <DD>Specifies where to display major axis ticks. You can use this option to
623 display ticks at non-uniform intervals. <I>MajorList</I> is a list of axis coordinates
624 designating the location of major ticks. No minor ticks are drawn. If <I>majorList</I>
625 is <I>""</I>, major ticks will be automatically computed. The default is <I>""</I>. </DD>
626
627 <DT><B>-max
628 <I>value</I></B> </DT>
629 <DD>Sets the maximum limit of <I>axisName</I>. Any data point greater than
630 <I>value</I> is not displayed. If <I>value</I> is <I>""</I>, the maximum limit is calculated
631 using the largest data value. The default is <I>""</I>. </DD>
632
633 <DT><B>-min <I>value</I></B> </DT>
634 <DD>Sets the minimum
635 limit of <I>axisName</I>. Any data point less than <I>value</I> is not displayed. If
636 <I>value</I> is <I>""</I>, the minimum limit is calculated using the smallest data value.
637 The default is <I>""</I>. </DD>
638
639 <DT><B>-minorticks <I>minorList</I></B> </DT>
640 <DD>Specifies where to display minor
641 axis ticks. You can use this option to display minor ticks at non-uniform
642 intervals. <I>MinorList</I> is a list of real values, ranging from 0.0 to 1.0, designating
643 the placement of a minor tick. No minor ticks are drawn if the <B>-majortick</B>
644 option is also set. If <I>minorList</I> is <I>""</I>, minor ticks will be automatically
645 computed. The default is <I>""</I>. </DD>
646
647 <DT><B>-rotate <I>theta</I></B> </DT>
648 <DD>Specifies the how many degrees
649 to rotate the axis tick labels. <I>Theta</I> is a real value representing the number
650 of degrees to rotate the tick labels. The default is <I>0.0</I> degrees. </DD>
651
652 <DT><B>-showticks
653 <I>boolean</I></B> </DT>
654 <DD>Indicates whether axis ticks should be drawn. If <I>boolean</I> is true,
655 ticks are drawn. If false, only the axis line is drawn. The default is <I>1</I>.
656 </DD>
657
658 <DT><B>-stepsize <I>value</I></B> </DT>
659 <DD>Specifies the interval between major axis ticks. If <I>value</I>
660 isn't a valid interval (must be less than the axis range), the request
661 is ignored and the step size is automatically calculated. </DD>
662
663 <DT><B>-subdivisions <I>number</I></B>
664 </DT>
665 <DD>Indicates how many minor axis ticks are to be drawn. For example, if <I>number</I>
666 is two, only one minor tick is drawn. If <I>number</I> is one, no minor ticks
667 are displayed. The default is <I>2</I>. </DD>
668
669 <DT><B>-tickfont <I>fontName</I></B> </DT>
670 <DD>Specifies the font for
671 axis tick labels. The default is <I>*-Courier-Bold-R-Normal-*-100-*</I>. </DD>
672
673 <DT><B>-ticklength <I>pixels</I></B>
674 </DT>
675 <DD>Sets the length of major and minor ticks (minor ticks are half the length
676 of major ticks). If <I>pixels</I> is less than zero, the axis will be inverted
677 with ticks drawn pointing towards the plot. The default is <I>0.1i</I>. </DD>
678
679 <DT><B>-title <I>text</I></B>
680 </DT>
681 <DD>Sets the title of the axis. If <I>text</I> is <I>""</I>, no axis title will be displayed.
682 </DD>
683
684 <DT><B>-titlecolor <I>color</I></B> </DT>
685 <DD>Sets the color of the axis title. The default is <I>black</I>.
686 </DD>
687
688 <DT><B>-titlefont <I>fontName</I></B> </DT>
689 <DD>Specifies the font for axis title. The default is <I>*-Helvetica-Bold-R-Normal-*-14-140-*</I>.
690 </DD>
691 </DL>
692 <P>
693 Axis configuration options may be also be set by the <B>option</B> command. The
694 resource class is <I>Axis</I>. The resource names are the names of the axes (such
695 as <I>x</I> or <I>x2</I>). <BR>
696 <CODE>option add *Graph.Axis.Color blue<BR>
697 option add *Graph.x.LogScale true<BR>
698 option add *Graph.x2.LogScale false<BR>
699 </blockquote>
700
701 <DL>
702
703 <DT></CODE><P><I>pathName <B>axis <B>create <I>axisName </I></B></B></I>?<I>option value</I>?... </DT>
704 <DD>Creates a new axis by the
705 name <I>axisName</I>. No axis by the same name can already exist. <I>Option</I> and <I>value</I>
706 are described in above in the axis <B>configure</B> operation. </DD>
707
708 <DT><I>pathName <B>axis <B>delete
709 </B></B></I>?<I>axisName</I>?... </DT>
710 <DD>Deletes the named axes. An axis is not really deleted until it
711 is not longer in use, so it's safe to delete axes mapped to elements. </DD>
712
713 <DT><I>pathName
714 <B>axis invtransform <I>axisName value</I></B></I> </DT>
715 <DD>Performs the inverse transformation, changing
716 the screen coordinate <I>value</I> to a graph coordinate, mapping the value mapped
717 to <I>axisName</I>. Returns the graph coordinate. </DD>
718
719 <DT><I>pathName <B>axis limits <I>axisName</I></B></I>
720 </DT>
721 <DD>Returns a list of the minimum and maximum limits for <I>axisName</I>. The order
722 of the list is <I>min max</I>. </DD>
723
724 <DT><I>pathName <B>axis names </B></I>?<I>pattern</I>?... </DT>
725 <DD>Returns a list of
726 axes matching zero or more patterns. If no <I>pattern</I> argument is give, the
727 names of all axes are returned. </DD>
728
729 <DT><I>pathName <B>axis transform <I>axisName value</I></B></I> </DT>
730 <DD>Transforms
731 the coordinate <I>value</I> to a screen coordinate by mapping the it to <I>axisName</I>.
732 Returns the transformed screen coordinate. </DD>
733 </DL>
734 <P>
735 Only four axes can be displayed
736 simultaneously. By default, they are <I>x</I>, <I>y</I>, <I>x2</I>, and <I>y2</I>. You can swap in
737 a different axis with <B>use</B> operation of the special axis components: <B>xaxis</B>,
738 <B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B>. <BR>
739 <CODE>.g create axis temp<BR>
740 .g create axis time<BR>
741 ...<BR>
742 .g xaxis use temp<BR>
743 .g yaxis use time<BR>
744 </CODE><P>Only the axes specified for use are displayed on the screen. <P>
745 The <B>xaxis</B>,
746 <B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B> components operate on an axis location rather
747 than a specific axis like the more general <B>axis</B> component does. The <B>xaxis</B>
748 component manages the X-axis located in the bottom margin (whatever axis
749 that happens to be). Likewise, <B>yaxis</B> uses the Y-axis in the left margin,
750 <B>x2axis</B> the top X-axis, and <B>y2axis</B> the right Y-axis. <P>
751 They implicitly control
752 the axis that is currently using to that location. By default, <B>xaxis</B> uses
753 the <I>x</I> axis, <B>yaxis</B> uses <I>y</I>, <B>x2axis</B> uses <I>x2</I>, and <B>y2axis</B> uses <I>y2</I>. These components
754 can be more convenient to use than always determining what axes are current
755 being displayed by the graph. <P>
756 The following operations are available for
757 axes. They mirror exactly the operations of the <B>axis</B> component. The <I>axis</I>
758 argument must be <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>, or <B>y2axis</B>.
759 <DL>
760
761 <DT><I>pathName <I>axis <B>cget <I>option</I></B></I></I>
762 </DT>
763 <DD></DD>
764
765 <DT><I>pathName <I>axis <B>configure </B></I></I>?<I>option value</I>?... </DT>
766 <DD></DD>
767
768 <DT><I>pathName <I>axis<B> invtransform <I>value</I></B></I></I>
769 </DT>
770 <DD></DD>
771
772 <DT><I>pathName <I>axis <B>limits</B></I></I> </DT>
773 <DD></DD>
774
775 <DT><I>pathName <I>axis<B> transform <I>value</I></B></I></I> </DT>
776 <DD></DD>
777
778 <DT><I>pathName <I>axis<B> use </B></I></I>?<I>axisName</I>?
779 </DT>
780 <DD>Designates the axis <I>axisName</I> is to be displayed at this location. <I>AxisName</I>
781 can not be already in use at another location. This command returns the
782 name of the axis currently using this location. </DD>
783 </DL>
784
785 <H3><A NAME="sect9" HREF="#toc9">Crosshairs Component</A></H3>
786 Cross
787 hairs consist of two intersecting lines (one vertical and one horizontal)
788 drawn completely across the plotting area. They are used to position the
789 mouse in relation to the coordinate axes. Cross hairs differ from line
790 markers in that they are implemented using XOR drawing primitives. This
791 means that they can be quickly drawn and erased without redrawing the entire
792 graph. <P>
793 The following operations are available for cross hairs:
794 <DL>
795
796 <DT><I>pathName
797 <B>crosshairs cget <I>option</I></B></I> </DT>
798 <DD>Returns the current value of the cross hairs configuration
799 option given by <I>option</I>. <I>Option</I> may be any option described below for the
800 cross hairs <B>configure</B> operation. </DD>
801
802 <DT><I>pathName <B>crosshairs configure </B></I>?<I>option value</I>?...
803 </DT>
804 <DD>Queries or modifies the configuration options of the cross hairs. If
805 <I>option</I> isn't specified, a list describing all the current options for the
806 cross hairs is returned. If <I>option</I> is specified, but not <I>value</I>, then a
807 list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs
808 are specified, then for each pair, the cross hairs option <I>option</I> is set
809 to <I>value</I>. The following options are available for cross hairs. <blockquote></DD>
810
811 <DT><B>-color <I>color</I></B>
812 </DT>
813 <DD>Sets the color of the cross hairs. The default is <I>black</I>. </DD>
814
815 <DT><B>-dashes <I>dashList</I></B>
816 </DT>
817 <DD>Sets the dash style of the cross hairs. <I>DashList</I> is a list of up to 11 numbers
818 that alternately represent the lengths of the dashes and gaps on the cross
819 hair lines. Each number must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the
820 cross hairs will be solid lines. </DD>
821
822 <DT><B>-hide <I>boolean</I></B> </DT>
823 <DD>Indicates whether cross hairs
824 are drawn. If <I>boolean</I> is true, cross hairs are not drawn. The default is
825 <I>yes</I>. </DD>
826
827 <DT><B>-linewidth <I>pixels</I></B> </DT>
828 <DD>Set the width of the cross hair lines. The default
829 is <I>1</I>. </DD>
830
831 <DT><B>-position <I>pos</I></B> </DT>
832 <DD>Specifies the screen position where the cross hairs
833 intersect. <I>Pos</I> must be in the form "<I>@x,y</I>", where <I>x</I> and <I>y</I> are the window
834 coordinates of the intersection. </DD>
835 </DL>
836 <P>
837 Cross hairs configuration options may be
838 also be set by the <B>option</B> command. The resource name and class are <I>crosshairs</I>
839 and <I>Crosshairs</I> respectively. <BR>
840 <CODE>option add *Graph.Crosshairs.LineWidth 2<BR>
841 option add *Graph.Crosshairs.Color red<BR>
842 </blockquote>
843
844 <DL>
845
846 <DT></CODE><P><I>pathName <B>crosshairs off</B></I> </DT>
847 <DD>Turns off the cross hairs. </DD>
848
849 <DT><I>pathName <B>crosshairs
850 on</B></I> </DT>
851 <DD>Turns on the display of the cross hairs. </DD>
852
853 <DT><I>pathName <B>crosshairs toggle</B></I>
854 </DT>
855 <DD>Toggles the current state of the cross hairs, alternately mapping and unmapping
856 the cross hairs. </DD>
857 </DL>
858
859 <H3><A NAME="sect10" HREF="#toc10">Element Components</A></H3>
860 A data element represents a set of data.
861 It contains x and y vectors containing the coordinates of the data points.
862 Elements can be displayed with a symbol at each data point and lines connecting
863 the points. Elements also control the appearance of the data, such as the
864 symbol type, line width, color etc. <P>
865 When new data elements are created,
866 they are automatically added to a list of displayed elements. The display
867 list controls what elements are drawn and in what order. <P>
868 The following
869 operations are available for elements.
870 <DL>
871
872 <DT><I>pathName <B>element activate <I>elemName
873 </I></B></I>?<I>index</I>?... </DT>
874 <DD>Specifies the data points of element <I>elemName</I> to be drawn using
875 active foreground and background colors. <I>ElemName</I> is the name of the element
876 and <I>index</I> is a number representing the index of the data point. If no indices
877 are present then all data points become active. </DD>
878
879 <DT><I>pathName <B>element cget <I>elemName
880 <I>option</I></I></B></I> </DT>
881 <DD>Returns the current value of the element configuration option given
882 by <I>option</I>. <I>Option</I> may be any of the options described below for the element
883 <B>configure</B> operation. </DD>
884
885 <DT><I>pathName <B>element closest <I>x y</I></B></I> <I>varName</I> ?<I>option value</I>?...
886 ?<I>elemName</I>?... </DT>
887 <DD>Finds the data point closest to the window coordinates <I>x</I> and
888 <I>y</I> in the element <I>elemName</I>. <I>ElemName</I> is the name of an element, that must
889 not be hidden. If no elements are specified, then all visible elements
890 are searched. It returns via the array variable <I>varName</I> the name of the
891 closest element, the index of its closest point, and the graph coordinates
892 of the point. Returns <I>0</I>, if no data point within the threshold distance
893 can be found, otherwise <I>1</I> is returned. The following <I>option</I>-<I>value</I> pairs
894 are available. <blockquote></DD>
895
896 <DT><B>-halo <I>pixels</I></B> </DT>
897 <DD>Specifies a threshold distance where selected
898 data points are ignored. <I>Pixels</I> is a valid screen distance, such as <I>2</I> or
899 <I>1.2i</I>. If this option isn't specified, then it defaults to the value of the
900 graph's <B>-halo</B> option. </DD>
901
902 <DT><B>-interpolate <I>boolean</I></B> </DT>
903 <DD>Indicates that both the data points
904 and interpolated points along the line segment formed should be considered.
905 If <I>boolean</I> is true, the closest line segment will be selected instead
906 of the closest point. If this option isn't specified, <I>boolean</I> defaults to
907 <I>0</I>. </DD>
908 </DL>
909 </blockquote>
910
911 <DL>
912
913 <DT><I>pathName <B>element configure <I>elemName </I></B></I>?<I>elemName</I>... ?<I>option value</I>?... </DT>
914 <DD>Queries
915 or modifies the configuration options for elements. Several elements can
916 be modified at the same time. If <I>option</I> isn't specified, a list describing
917 all the current options for <I>elemName</I> is returned. If <I>option</I> is specified,
918 but not <I>value</I>, then a list describing the option <I>option</I> is returned. If
919 one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair, the
920 element option <I>option</I> is set to <I>value</I>. The following options are valid
921 for elements. <blockquote></DD>
922
923 <DT><B>-activepen <I>penName</I></B> </DT>
924 <DD>Specifies pen to use to draw active element.
925 If <I>penName</I> is <I>""</I>, no active elements will be drawn. The default is <I>activeLine</I>.
926 </DD>
927
928 <DT><B>-color <I>color</I></B> </DT>
929 <DD>Sets the color of the traces connecting the data points.
930 </DD>
931
932 <DT><B>-dashes <I>dashList</I></B> </DT>
933 <DD>Sets the dash style of element line. <I>DashList</I> is a list
934 of up to 11 numbers that alternately represent the lengths of the dashes
935 and gaps on the element line. Each number must be between 1 and 255. If
936 <I>dashList</I> is <I>""</I>, the lines will be solid. </DD>
937
938 <DT><B>-data <I>coordList</I></B> </DT>
939 <DD>Specifies the X-Y
940 coordinates of the data. <I>CoordList</I> is a list of numeric expressions representing
941 the X-Y coordinate pairs of each data point. </DD>
942
943 <DT><B>-fill <I>color</I></B> </DT>
944 <DD>Sets the interior
945 color of symbols. If <I>color</I> is <I>""</I>, then the interior of the symbol is transparent.
946 If <I>color</I> is <I>defcolor</I>, then the color will be the same as the <B>-color</B> option.
947 The default is <I>defcolor</I>. </DD>
948
949 <DT><B>-hide <I>boolean</I></B> </DT>
950 <DD>Indicates whether the element is
951 displayed. The default is <I>no</I>. </DD>
952
953 <DT><B>-label <I>text</I></B> </DT>
954 <DD>Sets the element's label in the
955 legend. If <I>text</I> is <I>""</I>, the element will have no entry in the legend. The
956 default label is the element's name. </DD>
957
958 <DT><B>-linewidth <I>pixels</I></B> </DT>
959 <DD>Sets the width of
960 the connecting lines between data points. If <I>pixels</I> is <I>0</I>, no connecting
961 lines will be drawn between symbols. The default is <I>0</I>. </DD>
962
963 <DT><B>-mapx <I>xAxis</I></B> </DT>
964 <DD>Selects
965 the X-axis to map the element's X-coordinates onto. <I>XAxis</I> must be the name
966 of an axis. The default is <I>x</I>. </DD>
967
968 <DT><B>-mapy <I>yAxis</I></B> </DT>
969 <DD>Selects the Y-axis to map the element's
970 Y-coordinates onto. <I>YAxis</I> must be the name of an axis. The default is <I>y</I>. </DD>
971
972 <DT><B>-offdash
973 <I>color</I></B> </DT>
974 <DD>Sets the color of the stripes when traces are dashed (see the <B>-dashes</B>
975 option). If <I>color</I> is <I>""</I>, then the "off" pixels will represent gaps instead
976 of stripes. If <I>color</I> is <I>defcolor</I>, then the color will be the same as the
977 <B>-color</B> option. The default is <I>defcolor</I>. </DD>
978
979 <DT><B>-outline <I>color</I></B> </DT>
980 <DD>Sets the color or
981 the outline around each symbol. If <I>color</I> is <I>""</I>, then no outline is drawn.
982 If <I>color</I> is <I>defcolor</I>, then the color will be the same as the <B>-color</B> option.
983 The default is <I>defcolor</I>. </DD>
984
985 <DT><B>-outlinewidth <I>pixels</I></B> </DT>
986 <DD>Sets the width of the outline
987 bordering each symbol. If <I>pixels</I> is <I>0</I>, no outline will be drawn. The default
988 is <I>1</I>. </DD>
989
990 <DT><B>-pixels <I>pixels</I></B> </DT>
991 <DD>Sets the size of symbols. If <I>pixels</I> is <I>0</I>, no symbols
992 will be drawn. The default is <I>0.125i</I>. </DD>
993
994 <DT><B>-scalesymbols <I>boolean</I></B> </DT>
995 <DD>If <I>boolean</I> is
996 true, the size of the symbols drawn for <I>elemName</I> will change with scale
997 of the X-axis and Y-axis. At the time this option is set, the current ranges
998 of the axes are saved as the normalized scales (i.e scale factor is 1.0)
999 and the element is drawn at its designated size (see the <B>-pixels</B> option).
1000 As the scale of the axes change, the symbol will be scaled according to
1001 the smaller of the X-axis and Y-axis scales. If <I>boolean</I> is false, the element's
1002 symbols are drawn at the designated size, regardless of axis scales. The
1003 default is <I>0</I>. </DD>
1004
1005 <DT><B>-smooth <I>smooth</I></B> </DT>
1006 <DD>Specifies how connecting line segments are
1007 drawn between data points. <I>Smooth</I> can be either <I>linear</I>, <I>step</I>, <I>natural</I>, or
1008 <I>quadratic</I>. If <I>smooth</I> is <I>linear</I>, a single line segment is drawn, connecting
1009 both data points. When <I>smooth</I> is <I>step</I>, two line segments are drawn. The first
1010 is a horizontal line segment that steps the next X-coordinate. The second
1011 is a vertical line, moving to the next Y-coordinate. Both <I>natural</I> and <I>quadratic</I>
1012 generate multiple segments between data points. If <I>natural</I>, the segments
1013 are generated using a cubic spline. If <I>quadratic</I>, a quadratic spline is
1014 used. The default is <I>linear</I>. </DD>
1015
1016 <DT><B>-styles <I>styleList</I></B> </DT>
1017 <DD>Specifies what pen to use
1018 based on the range of weights given. <I>StyleList</I> is a list of style specifications.
1019 Each style specification, in turn, is a list consisting of a pen name,
1020 and optionally a minimum and maximum range. Data points whose weight (see
1021 the <B>-weight</B> option) falls in this range, are drawn with this pen. If no
1022 range is specified it defaults to the index of the pen in the list. Note
1023 that this affects only symbol attributes. Line attributes, such as line
1024 width, dashes, etc. are ignored. </DD>
1025
1026 <DT><B>-symbol <I>symbol</I></B> </DT>
1027 <DD>Specifies the symbol for
1028 data points. <I>Symbol</I> can be either <I>square</I>, <I>circle</I>, <I>diamond</I>, <I>plus</I>, <I>cross</I>,
1029 <I>splus</I>, <I>scross</I>, <I>triangle</I>, <I>""</I> (where no symbol is drawn), or a bitmap. Bitmaps
1030 are specified as "<I>source</I> ?<I>mask</I>?", where <I>source</I> is the name of the bitmap,
1031 and <I>mask</I> is the bitmap's optional mask. The default is <I>circle</I>. </DD>
1032
1033 <DT><B>-trace <I>direction</I></B>
1034 </DT>
1035 <DD>Indicates whether connecting lines between data points (whose X-coordinate
1036 values are either increasing or decreasing) are drawn. <I>Direction</I> must
1037 be <I>increasing</I>, <I>decreasing</I>, or <I>both</I>. For example, if <I>direction</I> is <I>increasing</I>,
1038 connecting lines will be drawn only between those data points where X-coordinate
1039 values are monotonically increasing. If <I>direction</I> is <I>both</I>, connecting lines
1040 will be draw between all data points. The default is <I>both</I>. </DD>
1041
1042 <DT><B>-weights <I>wVec</I></B>
1043 </DT>
1044 <DD>Specifies the weights of the individual data points. This, with the list
1045 pen styles (see the <B>-styles</B> option), controls how data points are drawn.
1046 <I>WVec</I> is the name of a BLT vector or a list of numeric expressions representing
1047 the weights for each data point. </DD>
1048
1049 <DT><B>-xdata <I>xVec</I></B> </DT>
1050 <DD>Specifies the X-coordinates
1051 of the data. <I>XVec</I> is the name of a BLT vector or a list of numeric expressions.
1052 </DD>
1053
1054 <DT><B>-ydata <I>yVec</I></B> </DT>
1055 <DD>Specifies the Y-coordinates of the data. <I>YVec</I> is the name of
1056 a BLT vector or a list of numeric expressions. </DD>
1057 </DL>
1058 <P>
1059 Element configuration options
1060 may also be set by the <B>option</B> command. The resource class is <I>Element</I>. The
1061 resource name is the name of the element. <BR>
1062 <CODE>option add *Graph.Element.symbol line<BR>
1063 option add *Graph.e1.symbol line<BR>
1064 </blockquote>
1065
1066 <DL>
1067
1068 <DT></CODE><P><I>pathName <B>element create <I>elemName</I></B></I> ?<I>option value</I>?... </DT>
1069 <DD>Creates a new element <I>elemName</I>.
1070 It's an error is an element <I>elemName</I> already exists. If additional arguments
1071 are present, they specify options valid for the element <B>configure</B> operation.
1072 </DD>
1073
1074 <DT><I>pathName <B>element deactivate <I>elemName</I></B></I> ?<I>elemName</I>?... </DT>
1075 <DD>Deactivates all the elements
1076 matching <I>pattern</I>. Elements whose names match any of the patterns given are
1077 redrawn using their normal colors. </DD>
1078
1079 <DT><I>pathName <B>element delete</B></I> ?<I>elemName</I>?... </DT>
1080 <DD>Deletes
1081 all the named elements. The graph is automatically redrawn. </DD>
1082
1083 <DT><I>pathName <B>element
1084 exists <I>elemName</I></B></I> </DT>
1085 <DD>Returns <I>1</I> if an element <I>elemName</I> currently exists and <I>0</I>
1086 otherwise. </DD>
1087
1088 <DT><I>pathName <B>element names </B></I>?<I>pattern</I>?... </DT>
1089 <DD>Returns the elements matching
1090 one or more pattern. If no <I>pattern</I> is given, the names of all elements
1091 is returned. </DD>
1092
1093 <DT><I>pathName <B>element show</B></I> ?<I>nameList</I>? </DT>
1094 <DD>Queries or modifies the
1095 element display list. The element display list designates the elements
1096 drawn and in what order. <I>NameList</I> is a list of elements to be displayed
1097 in the order they are named. If there is no <I>nameList</I> argument, the current
1098 display list is returned. </DD>
1099
1100 <DT><I>pathName <B>element type</B></I> <I>elemName</I> </DT>
1101 <DD>Returns the type
1102 of <I>elemName</I>. If the element is a bar element, the commands returns the
1103 string <I>"bar"</I>, otherwise it returns <I>"line"</I>. </DD>
1104 </DL>
1105
1106 <H3><A NAME="sect11" HREF="#toc11"></CODE><P>Grid Component</A></H3>
1107 Grid lines extend
1108 from the major and minor ticks of each axis horizontally or vertically
1109 across the plotting area. The following operations are available for grid
1110 lines.
1111 <DL>
1112
1113 <DT><I>pathName <B>grid cget <I>option</I></B></I> </DT>
1114 <DD>Returns the current value of the grid line
1115 configuration option given by <I>option</I>. <I>Option</I> may be any option described
1116 below for the grid <B>configure</B> operation. </DD>
1117
1118 <DT><I>pathName <B>grid configure</B></I> ?<I>option
1119 value</I>?... </DT>
1120 <DD>Queries or modifies the configuration options for grid lines. If
1121 <I>option</I> isn't specified, a list describing all the current grid options for
1122 <I>pathName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list
1123 describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are
1124 specified, then for each pair, the grid line option <I>option</I> is set to <I>value</I>.
1125 The following options are valid for grid lines. <blockquote></DD>
1126
1127 <DT><B>-color <I>color</I></B> </DT>
1128 <DD>Sets the color
1129 of the grid lines. The default is <I>black</I>. </DD>
1130
1131 <DT><B>-dashes <I>dashList</I></B> </DT>
1132 <DD>Sets the dash style
1133 of the grid lines. <I>DashList</I> is a list of up to 11 numbers that alternately
1134 represent the lengths of the dashes and gaps on the grid lines. Each number
1135 must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the grid will be solid lines.
1136 </DD>
1137
1138 <DT><B>-hide <I>boolean</I></B> </DT>
1139 <DD>Indicates whether the grid should be drawn. If <I>boolean</I> is true,
1140 grid lines are not shown. The default is <I>yes</I>. </DD>
1141
1142 <DT><B>-linewidth <I>pixels</I></B> </DT>
1143 <DD>Sets the width
1144 of grid lines. The default width is <I>1</I>. </DD>
1145
1146 <DT><B>-mapx <I>xAxis</I></B> </DT>
1147 <DD>Specifies the X-axis to
1148 display grid lines. <I>XAxis</I> must be the name of an axis. The default is <I>x</I>.
1149 </DD>
1150
1151 <DT><B>-mapy <I>yAxis</I></B> </DT>
1152 <DD>Specifies the Y-axis to display grid lines. <I>YAxis</I> must be the
1153 name of an axis. The default is <I>y</I>. </DD>
1154
1155 <DT><B>-minor <I>boolean</I></B> </DT>
1156 <DD>Indicates whether the grid
1157 lines should be drawn for minor ticks. If <I>boolean</I> is true, the lines will
1158 appear at minor tick intervals. The default is <I>1</I>. </DD>
1159 </DL>
1160 <P>
1161 </blockquote>
1162
1163 <H2><A NAME="sect12" HREF="#toc12">Speed Tips</A></H2>
1164 There may be
1165 cases where the graph needs to be drawn and updated as quickly as possible.
1166 If drawing speed becomes a big problem, here are a few tips to speed up
1167 displays.
1168 <UL>
1169 &#183;<LI>Try to minimize the number of data points. The more data points
1170 the looked at, the more work the graph must do. </LI>&#183;<LI>If your data is generated
1171 as floating point values, the time required to convert the data values
1172 to and from ASCII strings can be significant, especially when there any
1173 many data points. You can avoid the redundant string-to-decimal conversions
1174 using the C API to BLT vectors. </LI>&#183;<LI>Data elements without symbols are drawn
1175 faster than with symbols. Set the data element's <B>-symbol</B> option to <I>none</I>. If
1176 you need to draw symbols, try using the simple symbols such as <I>splus</I> and
1177 <I>scross</I>. </LI>&#183;<LI>Don't stipple or dash the element. Solid lines are much faster. </LI>&#183;<LI>If
1178 you update data elements frequently, try turning off the widget's <B>-bufferelements</B>
1179 option. When the graph is first displayed, it draws data elements into
1180 an internal pixmap. The pixmap acts as a cache, so that when the graph
1181 needs to be redrawn again, and the data elements or coordinate axes haven't
1182 changed, the pixmap is simply copied to the screen. This is especially
1183 useful when you are using markers to highlight points and regions on the
1184 graph. But if the graph is updated frequently, changing either the element
1185 data or coordinate axes, the buffering becomes redundant. </LI>
1186 </UL>
1187
1188 <H2><A NAME="sect13" HREF="#toc13">Limitations</A></H2>
1189 Auto-scale
1190 routines do not use requested min/max limits as boundaries when the axis
1191 is logarithmically scaled. <P>
1192 The PostScript output generated for polygons
1193 with more than 1500 points may exceed the limits of some printers (See
1194 PostScript Language Reference Manual, page 568). The work-around is to break
1195 the polygon into separate pieces.
1196 <H2><A NAME="sect14" HREF="#toc14">Future Incompatibility</A></H2>
1197 The <B>-mapped</B> options
1198 are obsoleted and will be removed. You can achieve the same results using
1199 the <B>-hide</B> option instead. <BR>
1200 <CODE># Works for now.<BR>
1201 .g legend configure -mapped no<BR>
1202 <P>
1203 # Instead use this.<BR>
1204 .g legend configure -hide yes <BR>
1205
1206 <H2><A NAME="sect15" HREF="#toc15"></CODE><P>Keywords</A></H2>
1207 graph, widget <P>
1208
1209 <HR><P>
1210 <A NAME="toc"><B>Table of Contents</B></A><P>
1211 <UL>
1212 <LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
1213 <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
1214 <LI><A NAME="toc2" HREF="#sect2">Description</A></LI>
1215 <LI><A NAME="toc3" HREF="#sect3">Example</A></LI>
1216 <LI><A NAME="toc4" HREF="#sect4">Syntax</A></LI>
1217 <LI><A NAME="toc5" HREF="#sect5">Example</A></LI>
1218 <LI><A NAME="toc6" HREF="#sect6">Graph Operations</A></LI>
1219 <LI><A NAME="toc7" HREF="#sect7">Graph Components</A></LI>
1220 <UL>
1221 <LI><A NAME="toc8" HREF="#sect8">Axis Components</A></LI>
1222 <LI><A NAME="toc9" HREF="#sect9">Crosshairs Component</A></LI>
1223 <LI><A NAME="toc10" HREF="#sect10">Element Components</A></LI>
1224 <LI><A NAME="toc11" HREF="#sect11">Grid Component</A></LI>
1225 </UL>
1226 <LI><A NAME="toc12" HREF="#sect12">Speed Tips</A></LI>
1227 <LI><A NAME="toc13" HREF="#sect13">Limitations</A></LI>
1228 <LI><A NAME="toc14" HREF="#sect14">Future Incompatibility</A></LI>
1229 <LI><A NAME="toc15" HREF="#sect15">Keywords</A></LI>
1230 </UL>
1231 </BODY></HTML>