From c6ae8a46fbad3caaf6c4d13ab24a109cf23a98e5 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Tue, 27 Feb 2018 13:43:59 -0800 Subject: [PATCH] Fixed bug where linegraphs would overwrite the key --- termui/linegraph.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/termui/linegraph.go b/termui/linegraph.go index 7a88566..41a2dea 100644 --- a/termui/linegraph.go +++ b/termui/linegraph.go @@ -46,7 +46,7 @@ func (lc *LineGraph) Buffer() *Buffer { } sort.Strings(seriesList) - for j, seriesName := range seriesList { + for _, seriesName := range seriesList { seriesData := lc.Data[seriesName] seriesLineColor, ok := lc.LineColor[seriesName] if !ok { @@ -87,6 +87,14 @@ func (lc *LineGraph) Buffer() *Buffer { } } } + } + + for j, seriesName := range seriesList { + seriesData := lc.Data[seriesName] + seriesLineColor, ok := lc.LineColor[seriesName] + if !ok { + seriesLineColor = lc.DefaultLineColor + } // Render key ontop, but let braille be drawn between words str := fmt.Sprintf("%s %3.0f%%", seriesName, seriesData[len(seriesData)-1])