Skip to content

Commit

Permalink
Fix legends label texts format
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Nov 1, 2020
1 parent bff4e54 commit fc8c4eb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions diagnoser/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (g *GUI) run(ctx context.Context, t terminalapi.Terminal, r runner) error {
// [-element-] [----element----] [element]
// ----------------------------------------------------
func gridLayout(w *widgets) ([]container.Option, error) {
raw1 := grid.RowHeightPerc(4,
raw1 := grid.RowHeightPerc(5,
grid.Widget(w.Metadata, container.Border(linestyle.Light), container.BorderTitle("Press Q to quit")),
)
raw2 := grid.RowHeightPerc(45,
Expand All @@ -122,8 +122,8 @@ func gridLayout(w *widgets) ([]container.Option, error) {
[]container.Option{container.Border(linestyle.Light), container.BorderTitle("Heap (MB)")},
grid.RowHeightPerc(97, grid.ColWidthPerc(99, grid.Widget(w.HeapChart))),
grid.RowHeightPercWithOpts(3,
[]container.Option{container.MarginLeftPercent(0), container.MarginBottomPercent(0)},
textsInColumn(w.HeapAllocLegend.text, w.HeapIdelLegend.text, w.HeapInuseLegend.text)...,
[]container.Option{container.MarginLeftPercent(w.HeapChart.Options().MinimumSize.X)},
textsInColumn(w.HeapIdelLegend.text, w.HeapInuseLegend.text, w.HeapAllocLegend.text)...,
),
)
builder := grid.New()
Expand All @@ -139,7 +139,9 @@ func gridLayout(w *widgets) ([]container.Option, error) {
func textsInColumn(texts ...Text) []grid.Element {
els := make([]grid.Element, 0, len(texts))
for _, text := range texts {
els = append(els, grid.ColWidthPerc(3, grid.Widget(text)))
// TODO: Make it flexible.
// Currently the width is highly dependent on the size of the device.
els = append(els, grid.ColWidthPerc(6, grid.Widget(text)))
}
return els
}
Expand Down

0 comments on commit fc8c4eb

Please sign in to comment.