Sparklines uses first var

This commit is contained in:
Ivan Daniluk 2015-05-01 19:36:11 +03:00
parent c14bc64319
commit 0114f247c8
2 changed files with 2 additions and 4 deletions

View File

@ -5,8 +5,6 @@ import (
"net" "net"
"strconv" "strconv"
"strings" "strings"
//"github.com/pyk/byten"
) )
// Services is just a slice of Service. // Services is just a slice of Service.

View File

@ -74,7 +74,7 @@ func (t *TermUI) Init(data UIData) error {
s := termui.NewSparklines(sparklines...) s := termui.NewSparklines(sparklines...)
s.Height = 2*len(data.Services) + 2 s.Height = 2*len(data.Services) + 2
s.HasBorder = true s.HasBorder = true
s.Border.Label = "Memory Track" s.Border.Label = fmt.Sprintf("Sparklines for %s", data.Vars[0])
return s return s
}() }()
@ -121,7 +121,7 @@ func (t *TermUI) Update(data UIData) {
// Sparklines // Sparklines
for i, service := range data.Services { for i, service := range data.Services {
t.MemSparkline.Lines[i].Title = service.Name t.MemSparkline.Lines[i].Title = service.Name
t.MemSparkline.Lines[i].Data = service.Values("memstats.Alloc") t.MemSparkline.Lines[i].Data = service.Values(data.Vars[0])
} }
termui.Body.Width = termui.TermWidth() termui.Body.Width = termui.TermWidth()