mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add expanded net, mem widgets
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user