Update examples
This commit is contained in:
parent
5d65a22da1
commit
007ca2123b
@ -6,8 +6,11 @@
|
||||
|
||||
package main
|
||||
|
||||
import ui "github.com/gizak/termui"
|
||||
import "math"
|
||||
import (
|
||||
"math"
|
||||
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := ui.Init(); err != nil {
|
||||
@ -82,13 +85,13 @@ func main() {
|
||||
|
||||
lc := ui.NewLineChart()
|
||||
lc.BorderLabel = "dot-mode Line Chart"
|
||||
lc.Data = sinps
|
||||
lc.Data["default"] = sinps
|
||||
lc.Width = 50
|
||||
lc.Height = 11
|
||||
lc.X = 0
|
||||
lc.Y = 14
|
||||
lc.AxesColor = ui.ColorWhite
|
||||
lc.LineColor = ui.ColorRed | ui.AttrBold
|
||||
lc.LineColor["default"] = ui.ColorRed | ui.AttrBold
|
||||
lc.Mode = "dot"
|
||||
|
||||
bc := ui.NewBarChart()
|
||||
@ -105,13 +108,13 @@ func main() {
|
||||
|
||||
lc1 := ui.NewLineChart()
|
||||
lc1.BorderLabel = "braille-mode Line Chart"
|
||||
lc1.Data = sinps
|
||||
lc1.Data["default"] = sinps
|
||||
lc1.Width = 26
|
||||
lc1.Height = 11
|
||||
lc1.X = 51
|
||||
lc1.Y = 14
|
||||
lc1.AxesColor = ui.ColorWhite
|
||||
lc1.LineColor = ui.ColorYellow | ui.AttrBold
|
||||
lc1.LineColor["default"] = ui.ColorYellow | ui.AttrBold
|
||||
|
||||
p1 := ui.NewPar("Hey!\nI am a borderless block!")
|
||||
p1.Border = false
|
||||
@ -126,8 +129,8 @@ func main() {
|
||||
list.Items = strs[t%9:]
|
||||
sp.Lines[0].Data = spdata[:30+t%50]
|
||||
sp.Lines[1].Data = spdata[:35+t%50]
|
||||
lc.Data = sinps[t/2%220:]
|
||||
lc1.Data = sinps[2*t%220:]
|
||||
lc.Data["default"] = sinps[t/2%220:]
|
||||
lc1.Data["default"] = sinps[2*t%220:]
|
||||
bc.Data = bcdata[t/2%10:]
|
||||
ui.Render(p, list, g, sp, lc, bc, lc1, p1)
|
||||
}
|
||||
|
@ -6,9 +6,11 @@
|
||||
|
||||
package main
|
||||
|
||||
import ui "github.com/gizak/termui"
|
||||
import (
|
||||
"math"
|
||||
|
||||
import "math"
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := ui.Init(); err != nil {
|
||||
@ -45,10 +47,10 @@ func main() {
|
||||
|
||||
lc := ui.NewLineChart()
|
||||
lc.BorderLabel = "braille-mode Line Chart"
|
||||
lc.Data = sinps
|
||||
lc.Data["default"] = sinps
|
||||
lc.Height = 11
|
||||
lc.AxesColor = ui.ColorWhite
|
||||
lc.LineColor = ui.ColorYellow | ui.AttrBold
|
||||
lc.LineColor["default"] = ui.ColorYellow | ui.AttrBold
|
||||
|
||||
gs := make([]*ui.Gauge, 3)
|
||||
for i := range gs {
|
||||
@ -107,7 +109,7 @@ func main() {
|
||||
}
|
||||
|
||||
sp.Lines[0].Data = spdata[:100+i]
|
||||
lc.Data = sinps[2*i:]
|
||||
lc.Data["default"] = sinps[2*i:]
|
||||
ui.Render(ui.Body)
|
||||
})
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 31 KiB |
@ -6,8 +6,11 @@
|
||||
|
||||
package main
|
||||
|
||||
import ui "github.com/gizak/termui"
|
||||
import "math"
|
||||
import (
|
||||
"math"
|
||||
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
|
||||
func main() {
|
||||
err := ui.Init()
|
||||
@ -76,7 +79,7 @@ func main() {
|
||||
})()
|
||||
|
||||
lc.BorderLabel = "Line Chart"
|
||||
lc.Data = sinps
|
||||
lc.Data["default"] = sinps
|
||||
lc.Width = 50
|
||||
lc.Height = 11
|
||||
lc.X = 0
|
||||
@ -108,7 +111,7 @@ func main() {
|
||||
}
|
||||
return d
|
||||
})()
|
||||
lc1.Data = rndwalk
|
||||
lc1.Data["default"] = rndwalk
|
||||
lc1.Width = 26
|
||||
lc1.Height = 11
|
||||
lc1.X = 51
|
||||
@ -126,8 +129,8 @@ func main() {
|
||||
list.Items = strs[t%9:]
|
||||
sp.Lines[0].Data = spdata[t%10:]
|
||||
sp.Lines[1].Data = spdata[t/2%10:]
|
||||
lc.Data = sinps[t/2:]
|
||||
lc1.Data = rndwalk[t:]
|
||||
lc.Data["default"] = sinps[t/2:]
|
||||
lc1.Data["default"] = rndwalk[t:]
|
||||
bc.Data = bcdata[t/2%10:]
|
||||
ui.Render(p, list, g, sp, lc, bc, lc1, p1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user