Fixed bug where linegraphs would overwrite the key

This commit is contained in:
Caleb Bassi 2018-02-27 13:43:59 -08:00
parent 44a6eebae9
commit c6ae8a46fb
1 changed files with 9 additions and 1 deletions

View File

@ -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])