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:28:23 -0500 |
commit | fa9357d1ed084529e75fe7e04457c45d30843601 (patch) | |
tree | 49d675253921beddcd0abfc49dbccc9edeb18739 /termui/linegraph.go | |
parent | b767f7fbda1f63a14b00284994afc5894bfb6a17 (diff) |
Closes #32. Average is really average, over time. Boldify the AVRG label. Remove spurious sync lock.v4.0.2
Diffstat (limited to 'termui/linegraph.go')
-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), ) } |