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