diff --git a/src/termui/linegraph.go b/src/termui/linegraph.go index 72f48b6..a20ddcd 100644 --- a/src/termui/linegraph.go +++ b/src/termui/linegraph.go @@ -30,7 +30,6 @@ func NewLineGraph() *LineGraph { } } -// Buffer implements Bufferer interface. func (self *LineGraph) Draw(buf *Buffer) { self.Block.Draw(buf) // we render each data point on to the canvas then copy over the braille to the buffer at the end diff --git a/src/termui/sparkline.go b/src/termui/sparkline.go index 52963fa..4783b86 100644 --- a/src/termui/sparkline.go +++ b/src/termui/sparkline.go @@ -41,7 +41,6 @@ func NewSparklines(ss ...*Sparkline) *Sparklines { } } -// Buffer implements Bufferer interface. func (self *Sparklines) Draw(buf *Buffer) { self.Block.Draw(buf) @@ -51,20 +50,24 @@ func (self *Sparklines) Draw(buf *Buffer) { for i, line := range self.Lines { // prints titles - title1Y := 2 + (self.Inner.Dy()/lc)*i - title2Y := (2 + (self.Inner.Dy()/lc)*i) + 1 + title1Y := self.Inner.Min.Y + 1 + (self.Inner.Dy()/lc)*i + title2Y := self.Inner.Min.Y + 2 + (self.Inner.Dy()/lc)*i title1 := TrimString(line.Title1, self.Inner.Dx()) title2 := TrimString(line.Title2, self.Inner.Dx()) - buf.SetString( - title1, - image.Pt(self.Inner.Min.X, self.Inner.Min.Y+title1Y-1), - AttrPair{line.TitleColor | AttrBold, -1}, - ) - buf.SetString( - title2, - image.Pt(self.Inner.Min.X, self.Inner.Min.Y+title2Y-1), - AttrPair{line.TitleColor | AttrBold, -1}, - ) + if self.Inner.Dy() > 5 { + buf.SetString( + title1, + image.Pt(self.Inner.Min.X, title1Y), + AttrPair{line.TitleColor | AttrBold, -1}, + ) + } + if self.Inner.Dy() > 6 { + buf.SetString( + title2, + image.Pt(self.Inner.Min.X, title2Y), + AttrPair{line.TitleColor | AttrBold, -1}, + ) + } sparkY := (self.Inner.Dy() / lc) * (i + 1) // finds max data in current view used for relative heights diff --git a/src/termui/table.go b/src/termui/table.go index 1455726..693bb54 100644 --- a/src/termui/table.go +++ b/src/termui/table.go @@ -50,7 +50,6 @@ func NewTable() *Table { func (self *Table) ColResize() { } -// Buffer implements the Bufferer interface. func (self *Table) Draw(buf *Buffer) { self.Lock() diff --git a/src/widgets/temp.go b/src/widgets/temp.go index f065ad4..db3f0e1 100644 --- a/src/widgets/temp.go +++ b/src/widgets/temp.go @@ -48,7 +48,6 @@ func NewTemp(fahrenheit bool) *Temp { return self } -// Buffer implements ui.Bufferer interface and renders the widget. func (self *Temp) Draw(buf *ui.Buffer) { self.Block.Draw(buf)