2017-03-06 08:51:50 +00:00
|
|
|
package expanded
|
|
|
|
|
|
|
|
import (
|
|
|
|
ui "github.com/gizak/termui"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ExpandedCpu struct {
|
|
|
|
*ui.LineChart
|
|
|
|
hist FloatHist
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewExpandedCpu() *ExpandedCpu {
|
|
|
|
cpu := &ExpandedCpu{ui.NewLineChart(), NewFloatHist(60)}
|
|
|
|
cpu.BorderLabel = "CPU"
|
|
|
|
cpu.Height = 10
|
2017-03-06 22:05:04 +00:00
|
|
|
cpu.Width = colWidth[0]
|
2017-03-06 08:51:50 +00:00
|
|
|
cpu.X = 0
|
2017-03-06 22:05:04 +00:00
|
|
|
cpu.Y = 6
|
2017-03-06 08:51:50 +00:00
|
|
|
cpu.Data = cpu.hist.Data
|
|
|
|
cpu.DataLabels = cpu.hist.Labels
|
|
|
|
cpu.AxesColor = ui.ColorDefault
|
|
|
|
cpu.LineColor = ui.ColorGreen
|
|
|
|
return cpu
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *ExpandedCpu) Update(val int) {
|
|
|
|
w.hist.Append(float64(val))
|
|
|
|
}
|