add expanded net, mem widgets

This commit is contained in:
Bradley Cicenas
2017-01-07 20:37:11 +00:00
parent 99aac17030
commit 98a8cecfa1
5 changed files with 138 additions and 39 deletions

View File

@@ -5,26 +5,24 @@ import (
)
type ExpandedCpu struct {
*ui.BarChart
hist HistData
*ui.LineChart
hist FloatHistData
}
func NewExpandedCpu() *ExpandedCpu {
cpu := &ExpandedCpu{ui.NewBarChart(), NewHistData(12)}
cpu.BorderLabel = "CPU Util"
cpu := &ExpandedCpu{ui.NewLineChart(), NewFloatHistData(60)}
cpu.BorderLabel = "CPU"
cpu.Height = 10
cpu.Width = 50
cpu.BarColor = ui.ColorGreen
cpu.BarWidth = 3
cpu.BarGap = 1
cpu.X = 0
cpu.Y = 4
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(val)
w.Data = w.hist.data
w.hist.Append(float64(val))
}