Table of Contents

Name

::vu::bargraph - Create and manipulate bargraph widgets

Synopsis

::vu::bargraph pathName ?options?

Standard Options

borderWidth font relief cursor

orient
background

See the «options» manual entry for details on the standard options.

Widget-specific Options

Since there are quite a few options, they are arranged below in five sections: general widget configuration options, bar configuration options, tick configuration options, text labelling options, and alternative color options.

General Widget Configuration

-min minval
Specifies the value to be displayed at the bottom (or the left of a horizontal bargraph) of a bargraph. If minval is greater than maxval (see -max_val option), then the bargraph will grow «backwards". Default is 0.0.
-max maxval
Specifies the value to be displayed at the top (or the right of a horizontal bargraph) of a bargraph. If minval is greater than maxval, then the bargraph will grow «backwards". Default is 100.0.
-base baseval
Specifies where the origin of the bar is. It should be a value between minval and maxval. By default baseval is 0. NOTE: ticks are drawn as offsets from the baseval. Therefore, using something like -base 33.33 -tickinterval 10 will give tick marks at 33.33, 43.33, 53.33, ...
-precision n
Specifies the maximum number of digits after the decimal point when displaying floating-point values. Trailing zeros will be removed. Default 6.
-interval n
Specifies the time between sucessive callbacks, in milliseconds.
-hpadding n
The text elements of the widget are held together by «glue» that controls their relative positions with regard to one another and to the central bar area. The hpadding option can be used to «loosen" the glue (larger values) and make the elements «explode» away from each other horizontally. Default 2 pixels.
-vpadding n
Like hpadding, but controls the vertical «glue" holding the text elements together. Default 2 pixels.
-data sss
A string that can be associated with each widget. Think of it as a generic attribute.
-userbits n
An integer that can be associated with each widget.

Bar Configuration

-mode modename
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.
-width n
Specifies the width of a bar in pixels. Default 20 pixels.
-height n
Specifies the height in pixels a bar should be when displaying the maximum value (i.e. the maximum height of a bar). Default 100 pixels.
-length n
Alias for -height.
-barbackground color
Specifies the background color for the bar region. rendered. On a color display this defaults to gray77 and on a monochrome display the default is white.
-barcolor color or -fg color or -barcolour color
Specifies the color in which the bargraph bars should be rendered. On a color display this defaults to red and on a monochrome display the default is black.
-barborderwidth n
Specifies the width of a bar border. Default 2 pixels.
-barrelief relief
Specifies the relief of the bars. Can be one of «raised", «groove", «sunken» or «flat". By default the relief is «groove".
-sliderlength n
If the bargraph is in slider mode (see -mode), the length of the slider (in pixels) is set by this option. Default 10 pixels.

Tick Configuration

-tickcolor color or -tickcolour color
Specifies the color in which bargraph ticks should be rendered. On a color display this defaults to blue2 and on a monochrome display the default is black.
-tickinterval n
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. Use a -tickinterval of 0 to indicate no ticks at all. Note: this doesn't affect the ticks drawn with the -alabels or -blabels options.
-ticklength n
Specifies the length of all tick marks. Default 4 pixels.

Text Label Configuration

-textcolor color or -textcolour color
Specifies the color in which bargraph text should be rendered. On both color and monochrome displays this defaults to black.
-title txt
This string is placed at the top of the widget as the widget's title. By default there is no title. Specifying a blank title (-title {}) will remove the title.
-showminmax
bool By default, the minval and maxval values are labelled at the appropriate ends of the bar area. Setting -showminmax 0 will suppress these labels.
-showvalue bool
By default, the current value to which the bargraph is set will be labelled near the left or bottom end of the bargraph area. Setting -showvalue 0 will suppress this label.
-alabels LabelList
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 also the -blabels option for the right or bottom side of the bar.) LabelList 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. Note: this option does not affect the regularlyspaced ticks that are controlled with the -tickin_terval 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.
-blabels LabelList
Like -alabels, except it is for the right [bottom] side of the bar when the orientation is vertical [horizontal].
-alabfont font
The font used for the -alabels text.
-blabfont font
The font used for the -blabels text.

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 pathName 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 available options for path_Name (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


Table of Contents