Name
::vu::bargraph - Create and manipulate bargraph widgets
Synopsis
::vu::bargraph pathName ?options? -background -borderWidth -cur-sor -highlightbackground -highlightcolor -highlightthickness
- -font
- -foreground -orient -relief -takefocus
Widget-specific Options
In addition to the regularly-spaced ticks that can be controlled
with the -tickinterval option, arbitrarily-positioned labels
and/or ticks can be placed along the length of the bar. The
LabelList specifies positions, labels, and ticks along the
top [left] side of the bar for horizontal [vertical] bars. See
-blabels for the right or bottom side of the bar. The value
is a Tcl compound list: -alabels { {posn txt
?usetick?} ...} where posn is a value between the
minval and maxval of the widget, txt is a text
string to be drawn beside that position, and usetick is a
boolean flag which if set indicates that a tick mark should be
placed at posn.
This option does not affect the regularly-spaced ticks that are
con-trolled with the -tickinterval option. Example:
-alabels {{20 start 1} {40 halfway"} {60 end 1}} This will cause
labels to be written beside positions 20, 50, and 60. Ticks will
additionally be drawn at positions 20 and 60. The font used for the
-alabels text. Specifies the background color for the bar
region. Defaults to regular background color. Specifies the width
of a bar border. Default 2 pixels. Specifies the color in which the
bar-graph bars should be rendered. Defaults to red. Specifies the
relief of the bars. Must be a valid Tk relief value. Specifies
where the origin of the bar is. It should be a value between
-from and -to. Default is 0.0. Ticks are drawn as
offsets from -base. For example, -base 33.33 -tickinterval
10
will give tick marks at 33.33, 43.33, 53.33, ... Like
-alabels, except it is for the right [bottom] side of the
bar when the orientation is vertical [horizontal]. The font used
for the -blabels text. An inte-ger specifying how many
significant digits should be retained when con-verting the value of
the dial to a string. If the number is less than or equal to zero,
then the dial picks the smallest value that guaran-tees that every
possible dial position prints as a different string. Default is 6.
Specifies the starting value which be displayed at the bottom (or
the left of a horizontal bargraph) of a bargraph. If -from
is greater than -to then the bargraph will grow
backwards. Default is 0.0. Specifies the height in pixels a
bar should be when displaying the maximum value (i.e. the
maximum height of a bar). The option -length is a synonym
for -height. Default 100 pixels. This string is placed at
the top of the widget. Specifying the empty string will remove the
label. Defaults to {}. The bargraph can work in one of two modes:
if the modename is
“bargraphâ€, the bar grows from the
baseval to the current value. In mode
“sliderâ€, a slider of fixed width
travels along the bar area with its center point indicating the
current value. Specifies internal widget padding between central
bar and labels in the horizontal space. Default 2 pixels. Specifies
internal widget padding between central bar and labels in the
vertical space. Default 2 pix-els. Specifies whether labels for
i-from and -to will be displayed. Default is 1.
Specifies whether the current value to which the bar-graph is set
will be displayed. Default is 1. If the bargraph is in slider mode
(see -mode), the length of the slider (in pixels) is set by
this option. Default 10 pixels. Specifies the color in which
bargraph ticks should be rendered. Defaults to blue. Specifies the
interval between successive ticks. Default 20.0. The default
doesn’t depend on the range of data, and if
there are too many pixels, the widget will generate an error and
you will have to increase the -tickinterval. Specify 0 to
indicate no ticks at all. This option doesn’t
affect the ticks drawn with the -alabels or -blabels
options. Specifies the length of all tick marks. Default 4 pixels.
Specifies the value to be displayed at the top (or the right of a
horizontal bargraph) of a bar-graph. If -from is greater
than -to then the bargraph will grow back-wards.
Default is 100.0. Specifies the width of a bar in pixels. Default
20 pixels.
Description
The ::vu::bargraph command creates a new window (given by the pathName argument) and makes it into a bargraph widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the bargraph such as its colors, font, text, and initial relief. The ::vu::bargraph command returns its path-Name argument. At the time this command is invoked, there must not exist a window named pathName, but pathName’s parent must exist.
A bargraph is a widget that displays a value as a bargraph.
Widget Command
The ::vu::bargraph command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form: pathName option ?arg arg
- ...?
- Option and the args determine the exact behavior of the command. The following commands are possible for bargraph widgets:
pathName set ?value?
Display a bar whose height represents the specified value.
pathName cget option
Returns the current value of the configuration option given by
option. Option may have any of the values accepted by
the ::vu::bargraph command.
pathName configure ?option? ?value option value ...? Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the avail-able options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the ::vu::bargraph command.
pathName get
Returns the current value of the bargraph.
Keywords
bargraph, widget