tchart

package
v0.25.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2022 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeltaSame represents no difference.
	DeltaSame delta = iota

	// DeltaMore represents a higher value.
	DeltaMore

	// DeltaLess represents a lower value.
	DeltaLess
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	*tview.Box
	// contains filtered or unexported fields
}

Component represents a graphic component.

func NewComponent

func NewComponent(id string) *Component

NewComponent returns a new component.

func (*Component) GetSeriesColorNames

func (c *Component) GetSeriesColorNames() []string

GetSeriesColorNames returns series colors by name.

func (*Component) ID

func (c *Component) ID() string

ID returns the component ID.

func (*Component) InputHandler

func (c *Component) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler returns the handler for this primitive.

func (*Component) IsDial

func (c *Component) IsDial() bool

IsDial returns true if chart is a dial.

func (*Component) SetBackgroundColor

func (c *Component) SetBackgroundColor(color tcell.Color)

SetBackgroundColor sets the graph bg color.

func (*Component) SetBlurFunc

func (c *Component) SetBlurFunc(handler func(key tcell.Key)) *Component

SetBlurFunc sets a callback fn when component gets out of focus.

func (*Component) SetFocusColorNames added in v0.17.3

func (c *Component) SetFocusColorNames(fg, bg string)

SetFocusColorNames sets the focus color names.

func (*Component) SetLegend

func (c *Component) SetLegend(l string)

SetLegend sets the component legend.

func (*Component) SetSeriesColors

func (c *Component) SetSeriesColors(cc ...tcell.Color)

SetSeriesColors sets the component series colors.

type DotMatrix

type DotMatrix struct {
	// contains filtered or unexported fields
}

DotMatrix tracks a char matrix.

func NewDotMatrix

func NewDotMatrix() DotMatrix

NewDotMatrix returns a new matrix.

func (DotMatrix) Print

func (d DotMatrix) Print(n int) Matrix

Print prints the matrix.

type Gauge

type Gauge struct {
	*Component
	// contains filtered or unexported fields
}

Gauge represents a gauge component.

func NewGauge

func NewGauge(id string) *Gauge

NewGauge returns a new gauge.

func (*Gauge) Add

func (g *Gauge) Add(m Metric)

Add adds a new metric.

func (*Gauge) Draw

func (g *Gauge) Draw(sc tcell.Screen)

Draw draws the primitive.

func (*Gauge) IsDial

func (g *Gauge) IsDial() bool

IsDial returns true if chart is a dial.

func (*Gauge) SetResolution added in v0.17.3

func (g *Gauge) SetResolution(n int)

SetResolution overrides the default number of digits to display.

type Matrix

type Matrix [][]rune

Matrix represents a number dial.

func To3x3Char added in v0.17.3

func To3x3Char(numb int) Matrix

To3x3Char returns 3x3 number matrix.

type Metric

type Metric struct {
	S1, S2 int64
}

Metric tracks two series.

func (Metric) Max added in v0.17.2

func (m Metric) Max() int64

Max returns the max of the series.

func (Metric) MaxDigits

func (m Metric) MaxDigits() int

MaxDigits returns the max series number of digits.

func (Metric) Sum

func (m Metric) Sum() int64

Sum returns the sum of series.

type Orientation

type Orientation int

Orientation tracks char orientations.

type SparkLine

type SparkLine struct {
	*Component
	// contains filtered or unexported fields
}

SparkLine represents a sparkline component.

func NewSparkLine

func NewSparkLine(id string) *SparkLine

NewSparkLine returns a new graph.

func (*SparkLine) Add

func (s *SparkLine) Add(m Metric)

Add adds a metric.

func (*SparkLine) Draw

func (s *SparkLine) Draw(screen tcell.Screen)

Draw draws the graph.

func (*SparkLine) SetMultiSeries added in v0.17.2

func (s *SparkLine) SetMultiSeries(b bool)

SetMultiSeries indicates if multi series are in effect or not.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL