mirror of
https://github.com/bcicen/ctop.git
synced 2025-11-12 06:05:39 +01:00
refactor all container widgets into subpackage
This commit is contained in:
28
cwidgets/expanded/cpu.go
Normal file
28
cwidgets/expanded/cpu.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
cpu.Width = 50
|
||||
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(float64(val))
|
||||
}
|
||||
Reference in New Issue
Block a user