Skip to content

Gauge

Gauge preview

Gauge renders an arc-style progress indicator for a single 0–100% value. For a simpler horizontal bar use ProgressBar; for unknown-duration tasks use Spinner.

Constructor func NewGauge() *Gauge

Usage

gauge := components.NewGauge().
SetLabel("CPU").
SetValue(0.72).
SetUnit("%")
fmt.Println(gauge != nil)

Methods

Method Signature Description
GetFieldHeight func (g *Gauge) GetFieldHeight() int GetFieldHeight returns the preferred height.
SetLabel func (g *Gauge) SetLabel(label string) *Gauge SetLabel sets the label displayed below the gauge.
SetMaxValue func (g *Gauge) SetMaxValue(max float64) *Gauge SetMaxValue sets the max value for display purposes.
SetUnit func (g *Gauge) SetUnit(unit string) *Gauge SetUnit sets the unit displayed with the value.
SetValue func (g *Gauge) SetValue(value float64) *Gauge SetValue sets the gauge value (0.0 to 1.0).