1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Move Bargraph functionality into /view

This commit is contained in:
Chris Cummer
2019-08-04 21:21:16 -07:00
parent 2ba50f2a73
commit 94d63306d4
4 changed files with 22 additions and 20 deletions

View File

@@ -9,7 +9,7 @@ import (
"math/rand"
"time"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
var started = false
@@ -17,7 +17,7 @@ var ok = true
// Widget define wtf widget to register widget later
type Widget struct {
wtf.BarGraph
view.BarGraph
app *tview.Application
}
@@ -25,7 +25,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
BarGraph: wtf.NewBarGraph(app, "Sample Bar Graph", settings.common, false),
BarGraph: view.NewBarGraph(app, "Sample Bar Graph", settings.common, false),
app: app,
}
@@ -43,13 +43,13 @@ func MakeGraph(widget *Widget) {
//this could come from config
const lineCount = 8
var stats [lineCount]wtf.Bar
var stats [lineCount]view.Bar
barTime := time.Now()
for i := 0; i < lineCount; i++ {
barTime = barTime.Add(time.Duration(time.Minute))
bar := wtf.Bar{
bar := view.Bar{
Label: barTime.Format("15:04"),
Percent: rand.Intn(100-5) + 5,
}