Debian Codegraph @

demos/demo/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/demo`/
3
4 import (
5 "mathscip-go gomod github.com/golang/go/src go1.24.7 math/"
6 "math/randscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/"
7 "timescip-go gomod github.com/golang/go/src go1.24.7 time/"
8
9 "github.com/gdamore/tcell/v2scip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/"
10 "github.com/navidys/tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/"
11 "github.com/rivo/tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/"
12 )
13
14 func mainscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/main().() {
15 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().()
16
17 // spinners
18 spinners := []*tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.Spinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#{
19
20 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerDotsCirclingscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerDotsCircling.),
21 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerDotsUpDownscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerDotsUpDown.),
22 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerBouncescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerBounce.),
23 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerLinescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerLine.),
24
25 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerCircleQuartersscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerCircleQuarters.),
26 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerSquareCornersscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerSquareCorners.),
27 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerCircleHalvesscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerCircleHalves.),
28 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerCornersscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerCorners.),
29
30 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerArrowsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerArrows.),
31 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerHamburgerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerHamburger.),
32 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerStackscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerStack.),
33 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerStarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerStar.),
34
35 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerGrowHorizontalscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerGrowHorizontal.),
36 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerGrowVerticalscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerGrowVertical.),
37 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetStyle().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.SpinnerBoxBouncescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/SpinnerBoxBounce.),
38 tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSpinnerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSpinner().().SetCustomStylescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#SetCustomStyle().([]rune{'🕛', '🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚'}),
39 }
40
41 spinnerRow := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexColumnscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexColumn.)
42 spinnerRow.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true).SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("spinners")
43
44 for _, spinner := range spinners {
45 spinnerRow.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(spinner, 0, 1, false)
46 }
47
48 // bar graph
49 barGraph := newBarChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/newBarChart().()
50 barGraph.SetMaxValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetMaxValue().(100)
51 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.)
52 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.)
53
54 // activity mode gauge
55 amGauge := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewActivityModeGaugescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewActivityModeGauge().()
56 amGauge.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("activity mode gauge")
57 amGauge.SetPgBgColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/ActivityModeGauge#SetPgBgColor().(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.)
58 amGauge.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true)
59
60 // percentage mode gauge
61 pmGauge := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewPercentageModeGaugescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewPercentageModeGauge().()
62 pmGauge.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("percentage mode gauge")
63 pmGauge.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true)
64 pmGauge.SetMaxValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/PercentageModeGauge#SetMaxValue().(50)
65
66 // cpu usage gauge
67 cpuGauge := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewUtilModeGaugescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewUtilModeGauge().()
68 cpuGauge.SetLabelscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetLabel().("cpu usage: ")
69 cpuGauge.SetLabelColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetLabelColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorLightSkyBluescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorLightSkyBlue.)
70 cpuGauge.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(false)
71 // memory usage gauge
72 memGauge := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewUtilModeGaugescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewUtilModeGauge().()
73 memGauge.SetLabelscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetLabel().("memory usage:")
74 memGauge.SetLabelColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetLabelColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorLightSkyBluescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorLightSkyBlue.)
75 memGauge.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(false)
76 // swap usage gauge
77 swapGauge := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewUtilModeGaugescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewUtilModeGauge().()
78 swapGauge.SetLabelscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetLabel().("swap usage: ")
79 swapGauge.SetLabelColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetLabelColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorLightSkyBluescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorLightSkyBlue.)
80 swapGauge.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(false)
81
82 // utilisation flex
83 utilFlex := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexRowscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexRow.)
84 utilFlex.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(cpuGauge, 1, 0, false)
85 utilFlex.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(memGauge, 1, 0, false)
86 utilFlex.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(swapGauge, 1, 0, false)
87 utilFlex.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("utilisation mode gauge")
88 utilFlex.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true)
89
90 // plot (line charts)
91 sinData := func() [][]float64 {
92 n := 220
93 data := make([][]float64, 2)
94 data[0] = make([]float64, n)
95 data[1] = make([]float64, n)
96 for i := 0; i < n; i++ {
97 data[0][i] = 1 + mathscip-go gomod github.com/golang/go/src go1.24.7 math/.Sinscip-go gomod github.com/golang/go/src go1.24.7 math/Sin().(float64(i)/5)
98 data[1][i] = 1 + mathscip-go gomod github.com/golang/go/src go1.24.7 math/.Cosscip-go gomod github.com/golang/go/src go1.24.7 math/Cos().(float64(i)/5)
99 }
100 return data
101 }()
102
103 bmLineChart := newBrailleModeLineChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/newBrailleModeLineChart().()
104 bmLineChart.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetData().(sinData)
105
106 dmLineChart := newDotModeLineChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/newDotModeLineChart().()
107
108 sampleData1 := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
109 sampleData2 := []float64{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}
110 dotChartData := [][]float64{sampleData1}
111 dotChartData[0] = append(dotChartData[0], sampleData2...)
112 dotChartData[0] = append(dotChartData[0], sampleData1[:5]...)
113 dotChartData[0] = append(dotChartData[0], sampleData2[5:]...)
114 dotChartData[0] = append(dotChartData[0], sampleData1[:7]...)
115 dotChartData[0] = append(dotChartData[0], sampleData2[3:]...)
116
117 dmLineChart.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetData().(dotChartData)
118
119 // sparkline
120 iowaitSparkline := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSparklinescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSparkline().()
121 iowaitSparkline.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(false)
122 iowaitSparkline.SetDataTitlescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetDataTitle().("Disk IO (iowait)")
123 iowaitSparkline.SetDataTitleColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetDataTitleColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorDarkOrangescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorDarkOrange.)
124 iowaitSparkline.SetLineColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetLineColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorMediumPurplescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorMediumPurple.)
125
126 systemSparkline := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewSparklinescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewSparkline().()
127 systemSparkline.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(false)
128 systemSparkline.SetDataTitlescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetDataTitle().("Disk IO (system)")
129 systemSparkline.SetDataTitleColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetDataTitleColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorDarkOrangescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorDarkOrange.)
130 systemSparkline.SetLineColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetLineColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorSteelBluescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorSteelBlue.)
131
132 iowaitData := []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}
133 systemData := []float64{0, 0, 1, 2, 9, 5, 3, 1, 2, 0, 6, 3, 2, 2, 6, 8, 5, 2, 1, 5, 8, 6, 1, 4, 1, 1, 4, 3, 6}
134
135 ioSparkLineData := func() []float64 {
136 for i := 0; i < 5; i++ {
137 iowaitData = append(iowaitData, iowaitData...)
138 }
139
140 return iowaitData
141 }()
142
143 systemSparklineData := func() []float64 {
144 for i := 0; i < 5; i++ {
145 systemData = append(systemData, systemData...)
146 }
147
148 return systemData
149 }()
150
151 iowaitSparkline.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetData().(ioSparkLineData)
152 systemSparkline.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetData().(systemSparklineData)
153
154 sparklineGroupLayout := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexColumnscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexColumn.)
155 sparklineGroupLayout.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true)
156 sparklineGroupLayout.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("sparkline")
157 sparklineGroupLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(iowaitSparkline, 0, 1, false)
158 sparklineGroupLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewBoxscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewBox().(), 1, 0, false)
159 sparklineGroupLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(systemSparkline, 0, 1, false)
160
161 // first row layout
162 firstRowfirstCol := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexRowscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexRow.)
163 firstRowfirstCol.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(barGraph, 0, 1, false)
164
165 firstRowSecondCol := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexRowscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexRow.)
166 firstRowSecondCol.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(amGauge, 0, 3, false)
167 firstRowSecondCol.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(pmGauge, 0, 3, false)
168 firstRowSecondCol.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(utilFlex, 0, 5, false)
169
170 firstRow := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexColumnscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexColumn.)
171 firstRow.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(firstRowfirstCol, 0, 1, false)
172 firstRow.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(firstRowSecondCol, 0, 1, false)
173
174 // second row
175 plotRowLayout := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexColumnscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexColumn.)
176 plotRowLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(bmLineChart, 0, 1, false)
177 plotRowLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(dmLineChart, 0, 1, false)
178
179 screenLayout := tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.NewFlexscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/NewFlex().().SetDirectionscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/.FlexRowscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/FlexRow.)
180 screenLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(firstRow, 11, 0, false)
181 screenLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(plotRowLayout, 15, 0, false)
182 screenLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(sparklineGroupLayout, 6, 0, false)
183 screenLayout.AddItemscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Flex#AddItem().(spinnerRow, 3, 0, false)
184
185 screenLayout.SetRectscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetRect().(0, 0, 100, 40)
186
187 // upgrade datat functions
188 moveDotChartData := func() {
189 newData := append(dotChartData[0], dotChartData[0][0])
190 dotChartData[0] = newData[1:]
191 }
192
193 moveDiskIOData := func() ([]float64, []float64) {
194
195 newIOWaitData := ioSparkLineData[1:]
196 newIOWaitData = append(newIOWaitData, ioSparkLineData[0])
197 ioSparkLineData = newIOWaitData
198
199 newSystemData := systemSparklineData[1:]
200 newSystemData = append(newSystemData, systemSparklineData[0])
201 systemSparklineData = newSystemData
202
203 return newIOWaitData, newSystemData
204 }
205
206 moveSinData := func(data [][]float64) [][]float64 {
207 newData := make([][]float64, 2)
208 newData[0] = rotatescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/rotate().(data[0], -1)
209 newData[1] = rotatescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/rotate().(data[1], -1)
210 return newData
211 }
212
213 updateSpinner := func() {
214 spinnerTick := timescip-go gomod github.com/golang/go/src go1.24.7 time/.NewTickerscip-go gomod github.com/golang/go/src go1.24.7 time/NewTicker().(100 * timescip-go gomod github.com/golang/go/src go1.24.7 time/.Millisecondscip-go gomod github.com/golang/go/src go1.24.7 time/Millisecond.)
215 for {
216 select {
217 case <-spinnerTick.Cscip-go gomod github.com/golang/go/src go1.24.7 time/Ticker#C.:
218 // update spinners
219 for _, spinner := range spinners {
220 spinner.Pulsescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Spinner#Pulse().()
221 }
222 // update gauge
223 amGauge.Pulsescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/ActivityModeGauge#Pulse().()
224 app.Drawscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Application#Draw().()
225 }
226 }
227 }
228
229 // update screen ticker
230 update := func() {
231 value := 0
232 maxValue := pmGauge.GetMaxValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/PercentageModeGauge#GetMaxValue().()
233 randscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/.Seedscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/Seed().(timescip-go gomod github.com/golang/go/src go1.24.7 time/.Nowscip-go gomod github.com/golang/go/src go1.24.7 time/Now().().UnixNanoscip-go gomod github.com/golang/go/src go1.24.7 time/Time#UnixNano().())
234 tick := timescip-go gomod github.com/golang/go/src go1.24.7 time/.NewTickerscip-go gomod github.com/golang/go/src go1.24.7 time/NewTicker().(500 * timescip-go gomod github.com/golang/go/src go1.24.7 time/.Millisecondscip-go gomod github.com/golang/go/src go1.24.7 time/Millisecond.)
235 for {
236 select {
237 case <-tick.Cscip-go gomod github.com/golang/go/src go1.24.7 time/Ticker#C.:
238
239 if value > maxValue {
240 value = 0
241 } else {
242 value = value + 1
243 }
244 pmGauge.SetValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/PercentageModeGauge#SetValue().(value)
245
246 randNum1 := float64(randscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/.Float64scip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/Float64().() * 100)
247 randNum2 := float64(randscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/.Float64scip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/Float64().() * 100)
248 randNum3 := float64(randscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/.Float64scip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/Float64().() * 100)
249 randNum4 := float64(randscip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/.Float64scip-go gomod github.com/golang/go/src go1.24.7 `math/rand`/Float64().() * 100)
250
251 barGraph.SetBarValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetBarValue().("eth0", int(randNum1))
252 cpuGauge.SetValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetValue().(randNum1)
253 barGraph.SetBarValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetBarValue().("eth1", int(randNum2))
254 memGauge.SetValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetValue().(randNum2)
255 barGraph.SetBarValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetBarValue().("eth2", int(randNum3))
256 swapGauge.SetValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/UtilModeGauge#SetValue().(randNum3)
257 barGraph.SetBarValuescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetBarValue().("eth3", int(randNum4))
258
259 // move line charts
260 sinData = moveSinData(sinData)
261 bmLineChart.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetData().(sinData)
262
263 moveDotChartData()
264 dmLineChart.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetData().(dotChartData)
265
266 d1, d2 := moveDiskIOData()
267 iowaitSparkline.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetData().(d1)
268 systemSparkline.SetDatascip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Sparkline#SetData().(d2)
269
270 app.Drawscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Application#Draw().()
271 }
272 }
273 }
274
275 go updateSpinner()
276 go update()
277
278 if err := app.SetRootscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Application#SetRoot().(screenLayout, 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 {
279 panic(err)
280 }
281 }
282
283 func newDotModeLineChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/newDotModeLineChart().() *tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.Plotscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot# {
284 dmLineChart := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewPlotscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewPlot().()
285 dmLineChart.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true)
286 dmLineChart.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("line chart (dot mode)")
287 dmLineChart.SetLineColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetLineColor().([]tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.Colorscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/Color#{
288 tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorDarkOrangescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorDarkOrange.,
289 })
290 dmLineChart.SetAxesLabelColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetAxesLabelColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorGoldscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorGold.)
291 dmLineChart.SetAxesColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetAxesColor().(tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorGoldscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorGold.)
292 dmLineChart.SetMarkerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetMarker().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.PlotMarkerDotscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/PlotMarkerDot.)
293 dmLineChart.SetDotMarkerRunescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetDotMarkerRune().('\u25c9')
294
295 return dmLineChart
296 }
297
298 func newBrailleModeLineChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/newBrailleModeLineChart().() *tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.Plotscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot# {
299 bmLineChart := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewPlotscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewPlot().()
300 bmLineChart.SetBorderscip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetBorder().(true)
301 bmLineChart.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("line chart (braille mode)")
302 bmLineChart.SetLineColorscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetLineColor().([]tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.Colorscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/Color#{
303 tcellscip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/.ColorSteelBluescip-go gomod github.com/gdamore/tcell/v2 v2.13.8 `github.com/gdamore/tcell/v2`/ColorSteelBlue.,
304 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.,
305 })
306 bmLineChart.SetMarkerscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/Plot#SetMarker().(tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.PlotMarkerBraillescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/PlotMarkerBraille.)
307
308 return bmLineChart
309 }
310
311 func newBarChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/newBarChart().() *tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.BarChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart# {
312 barGraph := tvxwidgetsscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/.NewBarChartscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/NewBarChart().()
313 barGraph.SetBorderscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#SetBorder().(true)
314 barGraph.SetTitlescip-go gomod github.com/rivo/tview v0.42.0 `github.com/rivo/tview`/Box#SetTitle().("bar chart")
315 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("eth0", 20, 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.)
316 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("eth1", 60, 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.)
317 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("eth2", 80, 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.)
318 barGraph.AddBarscip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets`/BarChart#AddBar().("eth3", 100, 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.)
319
320 return barGraph
321 }
322
323 // Source: https://stackoverflow.com/questions/50833673/rotate-array-in-go/79079760#79079760
324 // rotate rotates the given slice by k positions to the left or right.
325 func rotatescip-go gomod github.com/navidys/tvxwidgets . `github.com/navidys/tvxwidgets/demos/demo`/rotate().[T any](slice []T, k int) []T {
326 if len(slice) == 0 {
327 return slice
328 }
329
330 var r int
331 if k > 0 {
332 r = len(slice) - k%len(slice)
333 } else {
334 kAbs := int(mathscip-go gomod github.com/golang/go/src go1.24.7 math/.Absscip-go gomod github.com/golang/go/src go1.24.7 math/Abs().(float64(k)))
335 r = kAbs % len(slice)
336 }
337
338 slice = append(slice[r:], slice[:r]...)
339
340 return slice
341 }