From fa9357d1ed084529e75fe7e04457c45d30843601 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Sat, 25 Jul 2020 07:21:15 -0500 Subject: Closes #32. Average is really average, over time. Boldify the AVRG label. Remove spurious sync lock. --- termui/linegraph.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'termui/linegraph.go') diff --git a/termui/linegraph.go b/termui/linegraph.go index db15822..fa8a3ae 100644 --- a/termui/linegraph.go +++ b/termui/linegraph.go @@ -25,6 +25,7 @@ type LineGraph struct { HorizontalScale int LineColors map[string]Color + LabelStyles map[string]Modifier DefaultLineColor Color } @@ -37,7 +38,8 @@ func NewLineGraph() *LineGraph { HorizontalScale: 5, - LineColors: make(map[string]Color), + LineColors: make(map[string]Color), + LabelStyles: make(map[string]Modifier), } } @@ -136,6 +138,10 @@ func (self *LineGraph) Draw(buf *Buffer) { if !ok { seriesLineColor = self.DefaultLineColor } + seriesLabelStyle, ok := self.LabelStyles[seriesName] + if !ok { + seriesLabelStyle = ModifierClear + } // render key ontop, but let braille be drawn over space characters str := seriesName + " " + self.Labels[seriesName] @@ -145,7 +151,7 @@ func (self *LineGraph) Draw(buf *Buffer) { for k, char := range str { if char != ' ' { buf.SetCell( - NewCell(char, NewStyle(seriesLineColor)), + NewCell(char, NewStyle(seriesLineColor, ColorClear, seriesLabelStyle)), image.Pt(xoff+self.Inner.Min.X+2+k, yoff+self.Inner.Min.Y+i+1), ) } -- cgit v1.2.3