Documentation ¶
Overview ¶
Package barchart implements a widget that draws multiple bars displaying values and their relative ratios.
Index ¶
Constants ¶
const DefaultBarColor = cell.ColorRed
DefaultBarColor is the default color of a bar, unless specified otherwise via the BarColors option.
const DefaultBarGap = 1
DefaultBarGap is the default value for the BarGap option.
const DefaultChar = draw.DefaultRectChar
DefaultChar is the default value for the Char option.
const DefaultLabelColor = cell.ColorGreen
DefaultLabelColor is the default color of a bar label, unless specified otherwise via the LabelColors option.
const DefaultValueColor = cell.ColorYellow
DefaultValueColor is the default color of a bar value, unless specified otherwise via the ValueColors option.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BarChart ¶
type BarChart struct {
// contains filtered or unexported fields
}
BarChart displays multiple bars showing relative ratios of values.
Each bar can have a text label under it explaining the meaning of the value and can display the value itself inside the bar.
Implements widgetapi.Widget. This object is thread-safe.
func (*BarChart) Draw ¶
Draw draws the BarChart widget onto the canvas. Implements widgetapi.Widget.Draw.
func (*BarChart) Keyboard ¶
func (*BarChart) Keyboard(k *terminalapi.Keyboard) error
Keyboard input isn't supported on the BarChart widget.
func (*BarChart) Mouse ¶
func (*BarChart) Mouse(m *terminalapi.Mouse) error
Mouse input isn't supported on the BarChart widget.
func (*BarChart) Values ¶
Values sets the values to be displayed by the BarChart. Each value ends up in its own bar. The values must not be negative and must be less or equal the maximum value. A bar displaying the maximum value is a full bar, taking all available vertical space. Provided options override values set when New() was called.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to provide options.
func BarColors ¶
BarColors sets the colors of each of the bars. Bars are created on a call to Values(), each value ends up in its own Bar. The first supplied color applies to the bar displaying the first value. Any bars that don't have a color specified use the DefaultBarColor.
func BarWidth ¶
BarWidth sets the width of the bars. If not set, the bars use all the space available to the widget.
func LabelColors ¶
LabelColors sets the colors of each of the labels under the bars. Bars are created on a call to Values(), each value ends up in its own Bar. The first supplied color applies to the label of the bar displaying the first value. Any labels that don't have a color specified use the DefaultLabelColor.
func Labels ¶
Labels sets the labels displayed under each bar, Bars are created on a call to Values(), each value ends up in its own Bar. The first supplied label applies to the bar displaying the first value. If not specified, the corresponding bar (or all the bars) don't have a label.
func ShowValues ¶
func ShowValues() Option
ShowValues tells the bar chart to display the actual values inside each of the bars.
func ValueColors ¶
ValueColors sets the colors of each of the values in the bars. Bars are created on a call to Values(), each value ends up in its own Bar. The first supplied color applies to the bar displaying the first value. Any values that don't have a color specified use the DefaultValueColor.
Directories ¶
Path | Synopsis |
---|---|
Binary barchartdemo displays a couple of BarChart widgets.
|
Binary barchartdemo displays a couple of BarChart widgets. |