Documentation ¶
Index ¶
Constants ¶
const HDASH = '┈'
const ORIGIN = '└'
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.
type Gauge ¶
type Image ¶
type Image struct { Block Image image.Image Monochrome bool MonochromeThreshold uint8 MonochromeInvert bool }
Image is an image widget.
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.
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.
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.