diff options
author | Sean E. Russell <ser@ser1.net> | 2020-07-25 07:21:15 -0500 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-07-25 07:23:17 -0500 |
commit | c25e58e79c704b9e2b34e27ea342d12fa26b00b3 (patch) | |
tree | 55bf6717a22ee3328c91d01f7f63bace35ef7fb0 /termui | |
parent | f9f330a910655c8a9527a386d9aea475c5424be4 (diff) |
Closes #32. Average is really average, over time. Boldify the AVRG label. Remove spurious sync lock.
Diffstat (limited to 'termui')
-rw-r--r-- | termui/linegraph.go | 10 |
1 files changed, 8 insertions, 2 deletions
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), ) } |