Closed nifflin closed 5 years ago
Hi, I (roughly) converted your code based on the latest api:
package main
import (
ui "github.com/gizak/termui"
"github.com/gizak/termui/widgets"
)
func main() {
err := ui.Init()
if err != nil {
panic(err)
}
defer ui.Close()
tsl := widgets.NewSparkline()
tsl.LineColor = ui.ColorGreen
tsl.Data = []float64{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6}
tsls := widgets.NewSparklineGroup(tsl)
tsls.Title = " Thruput "
tsls.BorderStyle.Fg = ui.ColorWhite
// tsls.Border = false
grid := ui.NewGrid()
termWidth, termHeight := ui.TerminalDimensions()
grid.SetRect(0, 0, termWidth, termHeight)
grid.Set(
ui.NewCol(1.0/2, tsls),
)
ui.Render(grid)
uiEvents := ui.PollEvents()
for {
e := <-uiEvents
switch e.ID {
case "q", "<C-c>":
return
}
}
}
And it seems to work for me with or without the tsls.Border = false
line. I just rewrote the sparkline in 958a28575d7411492d25e42da3ad5a6e5947d9a4 on master, so that may have fixed it, but let me know if you still get issues. Do note that termui has been heavily reworked in that commit, so there's a lot of breaking changes.
When I delete
tsls.Border = false
, and rebuild it, the sparkline will not show normally. Thanks.