Table of Contents

## Name

pie - Create and manipulate pie graph widgets

## Synopsis

pie
  pathName ?options? -background -borderwidth -cursor -font -foreground
-highlightbackground
  -highlightcolor -highlightthickness
-padx
  -pady -relief -takefocus

## Widget-specific Options

The viewing angle for the pie, between 0 and 90. 0 views the pie as a flat circle. 90 views the pie as a flat line. Defaults to 0. This string is placed on the top of the widget as the widgets title. An empty label ("") will remove the label. Default to empty. Specifies what fields are displayed in the legend, and in what order. The legend option is a string consisting of the letters K,V,P and L, representing fields: Key box (the colored square), Value (the numerical value), P (the percentage of the whole), Label (the given label of the slice). Each letter may be present only once (no duplication of fields).

Numbers may precede a field identifier. In all cases, a 0 indicates that this field should not be shown (in which case the field id should simply be omitted). For the key box, a positive number means display the slice's color in a separate box, while a negative number means use the slice's color as background for the whole text. For all other fields, a positive number specifies the maximum field length to display, while a negative number means use a field length equal to the longest required for that field. When no number is specified, a -1 is assumed. For example, the string KL would display only the label, with no numerical data displayed at all, using a background of the slice color. Specifies the rotation of the pie, in degrees, clockwise. It specifies the angle that the line between the first slice and the last slice makes with the vertical. That is, if origin is 0, then there will always be a line in the `12 o-clock' position, going straight up. If it is 90, then there will be a line in the `3 o-clock' position. The numeric precision at which to display slice value and percentage values. Defaults to 2 (ie 100.00% or 34.22). Specifies the radius of the pie. Specifies the depth of the shadow for the pie, drawn when the angle is not 0. The shadow appears under the slices using a darker background, and does not have borders. Defaults to 0, meaning no shadow. Specifies whether borders should be drawn around the slices. Defaults to 1. If specified, this font is used to draw the values of the slices at their edges in the main pie area.

## Description

The pie command creates a new window (given by the path_N ame argument) and makes it into a pie graph widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the pie such as its colors, font, text, and initial relief. The pie 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 pie is a widget for displaying pie graphs. It creates a rectangular widget which contains a pie and a legend. The legend consists of four fields, the key box (the colored square), value (the numerical value), p (the percentage of the whole) and label (the textual label of the slice). The display of the legend is managed by the -legend option.

## Widget Command

The pie 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 pie widgets:

pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the pie 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_N ame (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 pie command.

pathName delete pattern ?pattern ...?
Delete pie slices that match the given glob patterns.

pathName explode name ?value name value ...? Convenience method to set the explode values of one or more slices. The slices must already exist. If only one name is given, then the explode value for that slice is returned.

pathName itemcget name option
Returns the current value of the configuration option given by option for the named slice. Option may have any of the values accepted by the pie itemconfigure command.

pathName itemconfigure name ?option? ?value option value ...?
Query or modify the configuration options of the named slice. If no option is specified, returns a list describing all of the available options for named slice (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 for the slice (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 slice option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the following values:

-foreground or -fg color
  Foreground color of the slice.
-label color
  Label of the slice. This defaults to the name, but can be changed for viewing in the legend.
-value double
  Value of the slice.
-explode integer
  Explode value of the slice. This defines how far separated from the main pie to display this piece.

pathName lower name ?belowThis?
Lower the named slice below the slice belowThis. If belowThis is not specified, move named slice to the bottom.

pathName names ?pattern ...?
Return the names of the slices, in order, according to the given glob pattern. pattern defaults to *.

pathName order name ?name ...?
Move the named slices, in order, to the top. The first named slice will be first, the second second, and so on. The named slices must exist.

pathName raise name ?aboveThis?
Raise the named slice above the slice aboveThis. If aboveThis is not specified, move named slice to the top.

pathName swap name name
Swap the two named slices.

pathName set name ?value name value ...? Convenience method to set the values of one or more slices. The slices do not need to already exist. If only one name is given, then the value for that slice is returned.

pathName value
Returns the sum of the slice values.

## Default Bindings

When a new pie is created, it has no default event bindings: pies are intended for output purposes only. Events can be bound to make the pie interactively spin or rotate.

## Keywords

pie, widget

Table of Contents

- Name
- Synopsis
- Widget-specific Options
- Description
- Widget Command
- Default Bindings
- Keywords