func (page *perContainerPage) init() {
	page.CPUChart.Title = " CPU % "
	page.CPUChart.BarColor = ui.ColorGreen
	page.CPUChart.LabelStyle.Fg = ui.ColorClear
	page.CPUChart.BorderStyle.Fg = ui.ColorCyan
	page.CPUChart.TitleStyle.Fg = ui.ColorClear
	page.MemChart.Title = " Mem % "
	page.MemChart.LabelStyle.Fg = ui.ColorClear
	page.MemChart.BarColor = ui.ColorGreen
	page.MemChart.BorderStyle.Fg = ui.ColorCyan
	page.MemChart.TitleStyle.Fg = ui.ColorClear
	page.NetChart.Data = []float64{0, 0}
	page.NetChart.Title = " Network I/O "
	page.NetChart.Labels = []string{"RX", "TX"}
	page.NetChart.BorderStyle.Fg = ui.ColorCyan
	page.NetChart.TitleStyle.Fg = ui.ColorClear
	page.NetChart.BarWidth = 9
	page.NetChart.BarColors = []ui.Color{ui.ColorGreen, ui.ColorCyan}
	page.NetChart.LabelStyles = []ui.Style{ui.NewStyle(ui.ColorClear)}
	page.NetChart.NumStyles = []ui.Style{ui.NewStyle(ui.ColorBlack)}
	page.BlkChart.Data = []float64{0, 0}
	page.BlkChart.Title = " Blk I/O "
	page.BlkChart.Labels = []string{"Read", "Write"}
	page.BlkChart.BorderStyle.Fg = ui.ColorCyan
	page.BlkChart.TitleStyle.Fg = ui.ColorClear
	page.BlkChart.BarWidth = 9
	page.BlkChart.BarColors = []ui.Color{ui.ColorGreen, ui.ColorCyan}
	page.BlkChart.LabelStyles = []ui.Style{ui.NewStyle(ui.ColorClear)}
	page.BlkChart.NumStyles = []ui.Style{ui.NewStyle(ui.ColorBlack)}
	page.DetailsTable.Title = " Details "
	page.DetailsTable.BorderStyle.Fg = ui.ColorCyan
	page.DetailsTable.TitleStyle.Fg = ui.ColorClear
	page.DetailsTable.ColResizer = func() {
		x := page.DetailsTable.Inner.Dx()
		page.DetailsTable.ColWidths = []int{
			x / 2,
			x / 2,
		}
	}
	page.DetailsTable.ShowCursor = true
	page.MountTable.Title = " Mounts "
	page.MountTable.BorderStyle.Fg = ui.ColorCyan
	page.MountTable.TitleStyle.Fg = ui.ColorClear
	page.MountTable.ColGap = 1
	page.MountTable.ColResizer = func() {
		x := page.MountTable.Inner.Dx()
		page.MountTable.ColWidths = []int{
			4 * x / 10,
			4 * x / 10,
			2 * x / 10,
		}
	}
	page.MountTable.Header = []string{"SRC", "DST", "Mode"}
	page.MountTable.CursorColor = ui.ColorCyan
	page.NetworkTable.Title = " Networks "
	page.NetworkTable.BorderStyle.Fg = ui.ColorCyan
	page.NetworkTable.TitleStyle.Fg = ui.ColorClear
	page.NetworkTable.ColGap = 1
	page.NetworkTable.ColResizer = func() {
		x := page.NetworkTable.Inner.Dx()
		page.NetworkTable.ColWidths = []int{
			2 * x / 10,
			2 * x / 10,
			3 * x / 10,
			x / 10,
		}
	}
	page.NetworkTable.Header = []string{"Name", "Driver", "IP", "Ingress"}
	page.NetworkTable.CursorColor = ui.ColorCyan
	page.CPUUsageTable.Title = " Per CPU "
	page.CPUUsageTable.BorderStyle.Fg = ui.ColorCyan
	page.CPUUsageTable.TitleStyle.Fg = ui.ColorClear
	page.CPUUsageTable.ColResizer = func() {
		x := page.CPUUsageTable.Inner.Dx()
		page.CPUUsageTable.ColWidths = []int{
			x / 2,
			x / 2,
		}
	}
	page.CPUUsageTable.Header = []string{"CPU", "Usage"}
	page.CPUUsageTable.CursorColor = ui.ColorCyan
	page.PortMapTable.Title = " Port Mappings "
	page.PortMapTable.BorderStyle.Fg = ui.ColorCyan
	page.PortMapTable.TitleStyle.Fg = ui.ColorClear
	page.PortMapTable.ColResizer = func() {
		x := page.PortMapTable.Inner.Dx()
		page.PortMapTable.ColWidths = []int{
			3 * x / 10,
			2 * x / 10,
			2 * x / 10,
			2 * x / 10,
		}
	}
	page.PortMapTable.Header = []string{"HostIP", "Host", "Container", "Type"}
	page.PortMapTable.CursorColor = ui.ColorCyan
	page.ProcTable.Title = " Processes "
	page.ProcTable.BorderStyle.Fg = ui.ColorCyan
	page.ProcTable.TitleStyle.Fg = ui.ColorClear
	page.ProcTable.ColResizer = func() {
		x := page.ProcTable.Inner.Dx()
		page.ProcTable.ColWidths = []int{
			2 * x / 10,
			3 * x / 10,
			5 * x / 10,
		}
	}
	page.ProcTable.Header = []string{"PID", "UID", "CMD"}
	page.ProcTable.CursorColor = ui.ColorCyan
	page.Grid.Set(
		ui.NewRow(0.3,
			ui.NewCol(0.3, page.DetailsTable),
			ui.NewCol(0.45, page.MountTable),
			ui.NewCol(0.25, page.BlkChart),
		),
		ui.NewRow(0.3,
			ui.NewCol(0.3,
				ui.NewRow(0.5, page.MemChart),
				ui.NewRow(0.5, page.CPUChart),
			),
			ui.NewCol(0.45, page.NetworkTable),
			ui.NewCol(0.25, page.NetChart),
		),
		ui.NewRow(0.4,
			ui.NewCol(0.2, page.CPUUsageTable),
			ui.NewCol(0.4, page.PortMapTable),
			ui.NewCol(0.4, page.ProcTable),
		),
	)
	w, h := ui.TerminalDimensions()
	page.Grid.SetRect(0, 0, w, h)
}
init initializes and sets the ui and grid for grofer proc -p PID
package container
import (
	ui "github.com/gizak/termui/v3"
	"github.com/gizak/termui/v3/widgets"
	viz "github.com/pesos/grofer/pkg/utils/visualization"
)
type overallContainerPage struct {
	Grid         *ui.Grid
	CPUChart     *widgets.Gauge
	MemChart     *widgets.Gauge
	NetChart     *viz.BarChart
	BlkChart     *viz.BarChart
	DetailsTable *viz.Table
}
func newOverallContainerPage() *overallContainerPage {
	page := &overallContainerPage{
		Grid:         ui.NewGrid(),
		CPUChart:     widgets.NewGauge(),
		MemChart:     widgets.NewGauge(),
		NetChart:     viz.NewBarChart(),
		BlkChart:     viz.NewBarChart(),
		DetailsTable: viz.NewTable(),
	}
	page.init()
	return page
}
func (page *overallContainerPage) init() {
	page.CPUChart.Title = " Total CPU % "
	page.CPUChart.LabelStyle.Fg = ui.ColorClear
	page.CPUChart.BarColor = ui.ColorGreen
	page.CPUChart.BorderStyle.Fg = ui.ColorCyan
	page.CPUChart.TitleStyle.Fg = ui.ColorClear
	page.MemChart.Title = " Total Mem % "
	page.MemChart.LabelStyle.Fg = ui.ColorClear
	page.MemChart.BarColor = ui.ColorGreen
	page.MemChart.BorderStyle.Fg = ui.ColorCyan
	page.MemChart.TitleStyle.Fg = ui.ColorClear
	page.NetChart.Data = []float64{0, 0}
	page.NetChart.Title = " Total Network I/O "
	page.NetChart.Labels = []string{"RX", "TX"}
	page.NetChart.BorderStyle.Fg = ui.ColorCyan
	page.NetChart.TitleStyle.Fg = ui.ColorClear
	page.NetChart.BarWidth = 9
	page.NetChart.BarColors = []ui.Color{ui.ColorGreen, ui.ColorCyan}
	page.NetChart.LabelStyles = []ui.Style{ui.NewStyle(ui.ColorClear)}
	page.NetChart.NumStyles = []ui.Style{ui.NewStyle(ui.ColorBlack)}
	page.BlkChart.Data = []float64{0, 0}
	page.BlkChart.Title = " Total Blk I/O "
	page.BlkChart.Labels = []string{"Read", "Write"}
	page.BlkChart.BorderStyle.Fg = ui.ColorCyan
	page.BlkChart.TitleStyle.Fg = ui.ColorClear
	page.BlkChart.BarWidth = 9
	page.BlkChart.BarColors = []ui.Color{ui.ColorGreen, ui.ColorCyan}
	page.BlkChart.LabelStyles = []ui.Style{ui.NewStyle(ui.ColorClear)}
	page.BlkChart.NumStyles = []ui.Style{ui.NewStyle(ui.ColorBlack)}
	page.DetailsTable.Title = " Details "
	page.DetailsTable.DefaultBorderColor = ui.ColorCyan
	page.DetailsTable.ActiveBorderColor = ui.ColorCyan
	page.DetailsTable.TitleStyle.Fg = ui.ColorClear
	page.DetailsTable.ColResizer = func() {
		x := page.DetailsTable.Inner.Dx() - (12 + 10 + 10 + 17 + 23)
		page.DetailsTable.ColWidths = []int{
			12,
			ui.MaxInt(15, int(x*3/13)),
			ui.MaxInt(20, int(x*4/13)),
			ui.MaxInt(20, int(x*4/13)),
			ui.MaxInt(10, int(x*2/13)),
			10, 10, 17, 23,
		}
	}
	page.DetailsTable.Header = []string{"ID", "Image", "Name", "Status", "State", "CPU", "Memory", "Net I/O", "Block I/O"}
	page.DetailsTable.ShowCursor = true
	page.DetailsTable.CursorColor = ui.ColorCyan
	page.Grid.Set(
		ui.NewRow(0.4,
			ui.NewCol(0.5,
				ui.NewRow(0.5, page.CPUChart),
				ui.NewRow(0.5, page.MemChart),
			),
			ui.NewCol(0.25, page.NetChart),
			ui.NewCol(0.25, page.BlkChart),
		),
		ui.NewRow(0.6, page.DetailsTable),
	)
	w, h := ui.TerminalDimensions()
	page.Grid.SetRect(0, 0, w, h)
}
type perContainerPage struct {
	Grid          *ui.Grid
	DetailsTable  *viz.Table
	CPUChart      *widgets.Gauge
	MemChart      *widgets.Gauge
	NetChart      *viz.BarChart
	BlkChart      *viz.BarChart
	MountTable    *viz.Table
	NetworkTable  *viz.Table
	CPUUsageTable *viz.Table
	PortMapTable  *viz.Table
	ProcTable     *viz.Table
}
func newPerContainerPage() *perContainerPage {
	page := &perContainerPage{
		Grid:          ui.NewGrid(),
		DetailsTable:  viz.NewTable(),
		CPUChart:      widgets.NewGauge(),
		MemChart:      widgets.NewGauge(),
		NetChart:      viz.NewBarChart(),
		BlkChart:      viz.NewBarChart(),
		MountTable:    viz.NewTable(),
		NetworkTable:  viz.NewTable(),
		CPUUsageTable: viz.NewTable(),
		PortMapTable:  viz.NewTable(),
		ProcTable:     viz.NewTable(),
	}
	page.init()
	return page
}