termui/_examples/barchart.go
Caleb Bassi b227bd5277 Rework event system
* Timers should now be done through Go tickers
* Reworked event names used in Handle()
* Reworked Event type and payloads
2018-09-06 16:43:11 -07:00

33 lines
772 B
Go

// Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can
// be found in the LICENSE file.
// +build ignore
package main
import ui "github.com/gizak/termui"
func main() {
ui.Init()
defer ui.Close()
bc := ui.NewBarChart()
bc.Data = []int{3, 2, 5, 3, 9, 5, 3, 2, 5, 8, 3, 2, 4, 5, 3, 2, 5, 7, 5, 3, 2, 6, 7, 4, 6, 3, 6, 7, 8, 3, 6, 4, 5, 3, 2, 4, 6, 4, 8, 5, 9, 4, 3, 6, 5, 3, 6}
bc.DataLabels = []string{"S0", "S1", "S2", "S3", "S4", "S5"}
bc.BorderLabel = "Bar Chart"
bc.Width = 26
bc.Height = 10
bc.TextColor = ui.ColorGreen
bc.BarColor = ui.ColorRed
bc.NumColor = ui.ColorYellow
ui.Render(bc)
ui.Handle("q", "<Insert>", func(ui.Event) {
ui.StopLoop()
})
ui.Loop()
}