rename expanded -> single view

This commit is contained in:
Bradley Cicenas
2017-08-05 11:28:20 +00:00
parent 3ed9912bcb
commit 27e272c58f
13 changed files with 33 additions and 33 deletions

32
cwidgets/single/cpu.go Normal file
View File

@@ -0,0 +1,32 @@
package single
import (
ui "github.com/gizak/termui"
)
type Cpu struct {
*ui.LineChart
hist FloatHist
}
func NewCpu() *Cpu {
cpu := &Cpu{ui.NewLineChart(), NewFloatHist(55)}
cpu.Mode = "dot"
cpu.BorderLabel = "CPU"
cpu.Height = 12
cpu.Width = colWidth[0]
cpu.X = 0
cpu.DataLabels = cpu.hist.Labels
// hack to force the default minY scale to 0
tmpData := []float64{20}
cpu.Data = tmpData
_ = cpu.Buffer()
cpu.Data = cpu.hist.Data
return cpu
}
func (w *Cpu) Update(val int) {
w.hist.Append(float64(val))
}