Browse Source

WIP: Handle a dynamic number of graphs.

main
Jason J. Gullickson 4 months ago
parent
commit
6ffc0f23cc
  1. 28
      software/raintop/main.go
  2. BIN
      software/raintop/raintop

28
software/raintop/main.go

@ -21,7 +21,7 @@ func main() {
nodes[0] = clusternode.New("rain-psp-0")
// For additional nodes, use append():
//nodes = append(nodes, clusternode.New("rain-psp-x"))
nodes = append(nodes, clusternode.New("rain-psp-1"))
// Initialize plot charts
historyPlots := make([]*widgets.Plot, len(nodes))
@ -44,11 +44,27 @@ func main() {
// Creates a grid to contain all the gauges.
// TODO: Add all gauges dynamically (not just one hard-coded as below).
grid.Set(
ui.NewRow(1.0/1,
ui.NewCol(1.0/1, historyPlots[0]),
),
)
/*
grid.Set(
ui.NewRow(1.0/1,
ui.NewCol(1.0/1, historyPlots[0]),
),
)
*/
// TODO: To fix this, I think we need to create each grid
// part (row, column, etc.) discretely and then add them
// to the grid.
gridRows := make([]ui.GridItem, len(historyPlots))
for idx, historyPlot := range historyPlots {
gridRows[idx] =
ui.NewRow(1.0/float64(len(historyPlots)),
ui.NewCol(1.0/1, historyPlot),
)
}
grid.Set(gridRows)
ui.Render(grid)

BIN
software/raintop/raintop

Binary file not shown.
Loading…
Cancel
Save