vermui

package
v0.6.10-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const HDASH = '┈'
View Source
const ORIGIN = '└'
View Source
const VDASH = '┊'

Variables

This section is empty.

Functions

This section is empty.

Types

type BarChart

type BarChart struct {
	Block
	BarColor   Attribute
	TextColor  Attribute
	NumColor   Attribute
	Data       []int
	DataLabels []string
	BarWidth   int
	BarGap     int
	CellChar   rune
	// contains filtered or unexported fields
}

BarChart creates multiple bars in a widget:

bc := vermui.NewBarChart()
data := []int{3, 2, 5, 3, 9, 5}
bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
bc.BorderLabel = "Bar Chart"
bc.Data = data
bc.Width = 26
bc.Height = 10
bc.DataLabels = bclabels
bc.TextColor = vermui.ColorGreen
bc.BarColor = vermui.ColorRed
bc.NumColor = vermui.ColorYellow

func NewBarChart

func NewBarChart() *BarChart

NewBarChart returns a new *BarChart with current theme.

func (*BarChart) Buffer

func (bc *BarChart) Buffer() Buffer

Buffer implements Bufferer interface.

func (*BarChart) SetMax

func (bc *BarChart) SetMax(max int)

type Canvas

type Canvas map[[2]int]rune

Canvas contains drawing map: i,j -> rune

func NewCanvas

func NewCanvas() Canvas

NewCanvas returns an empty Canvas

func (Canvas) Buffer

func (c Canvas) Buffer() Buffer

Buffer returns un-styled points

func (Canvas) Set

func (c Canvas) Set(x, y int)

Set sets a point (x,y) in the virtual coordinate

func (Canvas) Unset

func (c Canvas) Unset(x, y int)

Unset removes point (x,y)

type Gauge

type Gauge struct {
	Block
	Percent                 int
	BarColor                Attribute
	PercentColor            Attribute
	PercentColorHighlighted Attribute
	Label                   string
	LabelAlign              Align
}

func NewGauge

func NewGauge() *Gauge

NewGauge return a new gauge with current theme.

func (*Gauge) Buffer

func (g *Gauge) Buffer() Buffer

Buffer implements Bufferer interface.

type Image

type Image struct {
	Block
	Image               image.Image
	Monochrome          bool
	MonochromeThreshold uint8
	MonochromeInvert    bool
}

Image is an image widget.

func NewImage

func NewImage(img image.Image) *Image

NewImage returns a new image widget.

func (*Image) Buffer

func (im *Image) Buffer() Buffer

Image implements Bufferer.

type LineChart

type LineChart struct {
	Block
	Data       map[string][]float64
	DataLabels []string // if unset, the data indices will be used
	Mode       string   // braille | dot
	DotStyle   rune
	LineColor  map[string]Attribute

	AxesColor Attribute

	YPadding float64
	YFloor   float64 // min Y value to display, use -Inf for "auto"
	YCeil    float64 // max Y value to display, use +Inf for "auto"
	Name     string  // not used internally, but useful in many programs
	// contains filtered or unexported fields
}

LineChart has two modes: braille(default) and dot. A single braille character is a 2x4 grid of dots, so Using braille gives 2x X resolution and 4x Y resolution over dot mode.

lc := vermui.NewLineChart()
lc.BorderLabel = "braille-mode Line Chart"
lc.Data["name'] = [1.2, 1.3, 1.5, 1.7, 1.5, 1.6, 1.8, 2.0]
lc.Width = 50
lc.Height = 12
lc.AxesColor = vermui.ColorWhite
lc.LineColor = vermui.ColorGreen | vermui.AttrBold
// vermui.Render(lc)...

func NewLineChart

func NewLineChart() *LineChart

NewLineChart returns a new LineChart with current theme.

func (*LineChart) Buffer

func (lc *LineChart) Buffer() Buffer

Buffer implements Bufferer interface.

type MBarChart

type MBarChart struct {
	Block
	BarColor   [NumberofColors]Attribute
	TextColor  Attribute
	NumColor   [NumberofColors]Attribute
	Data       [NumberofColors][]int
	DataLabels []string
	BarWidth   int
	BarGap     int

	ShowScale bool
	// contains filtered or unexported fields
}

This is the implementation of multi-colored or stacked bar graph. This is different from default barGraph which is implemented in bar.go Multi-Colored-BarChart creates multiple bars in a widget:

bc := vermui.NewMBarChart()
data := make([][]int, 2)
data[0] := []int{3, 2, 5, 7, 9, 4}
data[1] := []int{7, 8, 5, 3, 1, 6}
bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
bc.BorderLabel = "Bar Chart"
bc.Data = data
bc.Width = 26
bc.Height = 10
bc.DataLabels = bclabels
bc.TextColor = vermui.ColorGreen
bc.BarColor = vermui.ColorRed
bc.NumColor = vermui.ColorYellow

func NewMBarChart

func NewMBarChart() *MBarChart

NewBarChart returns a new *BarChart with current theme.

func (*MBarChart) Buffer

func (bc *MBarChart) Buffer() Buffer

Buffer implements Bufferer interface.

func (*MBarChart) SetMax

func (bc *MBarChart) SetMax(max int)

type Sparkline

type Sparkline struct {
	Data       []int
	Height     int
	Title      string
	TitleColor Attribute
	LineColor  Attribute
	// contains filtered or unexported fields
}

Sparkline is like: ▅▆▂▂▅▇▂▂▃▆▆▆▅▃. The data points should be non-negative integers.

data := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1}
spl := vermui.NewSparkline()
spl.Data = data
spl.Title = "Sparkline 0"
spl.LineColor = vermui.ColorGreen

func NewSparkline

func NewSparkline() Sparkline

NewSparkline returns a unrenderable single sparkline that intended to be added into Sparklines.

type Sparklines

type Sparklines struct {
	Block
	Lines []Sparkline
	// contains filtered or unexported fields
}

Sparklines is a renderable widget which groups together the given sparklines.

spls := vermui.NewSparklines(spl0,spl1,spl2) //...
spls.Height = 2
spls.Width = 20

func NewSparklines

func NewSparklines(ss ...Sparkline) *Sparklines

NewSparklines return a new *Sparklines with given Sparkline(s), you can always add a new Sparkline later.

func (*Sparklines) Add

func (s *Sparklines) Add(sl Sparkline)

Add appends a given Sparkline to s *Sparklines.

func (*Sparklines) Buffer

func (sl *Sparklines) Buffer() Buffer

Buffer implements Bufferer interface.

Jump to

Keyboard shortcuts

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