Debian Codegraph @

demos/barchart/main.go

raw symbols SCIP
1 // Demo code for the bar chart primitive.
2 package mainscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/barchart`/
3
4 import (
5 "github.com/gdamore/tcell/v2scip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/"
6 "github.com/navidys/tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/"
7 "github.com/rivo/tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/"
8 )
9
10 func mainscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/barchart`/main().() {
11 app := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewApplicationscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewApplication().()
12 barGraph := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewBarChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewBarChart().()
13 barGraph.SetRectscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetRect().(4, 2, 50, 20)
14 barGraph.SetBorderscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetBorder().(true)
15 barGraph.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("System Resource Usage")
16 // display system metric usage
17 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("cpu", 80, tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorBluescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorBlue.)
18 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("mem", 20, tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorRedscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorRed.)
19 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("swap", 40, tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorGreenscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorGreen.)
20 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("disk", 40, tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorOrangescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorOrange.)
21 barGraph.SetMaxValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetMaxValue().(100)
22 barGraph.SetAxesColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetAxesColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorAntiqueWhitescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorAntiqueWhite.)
23 barGraph.SetAxesLabelColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetAxesLabelColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorAntiqueWhitescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorAntiqueWhite.)
24
25 if err := app.SetRootscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Application#SetRoot().(barGraph, false).EnableMousescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Application#EnableMouse().(true).Runscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Application#Run().(); err != nil {
26 panic(err)
27 }
28 }