diff --git a/widgets/sparkline.go b/widgets/sparkline.go index 840a8a7..ec963b5 100644 --- a/widgets/sparkline.go +++ b/widgets/sparkline.go @@ -17,7 +17,7 @@ type Sparkline struct { TitleStyle Style LineColor Color MaxVal float64 - MaxHeight int // TODO + MaxHeight int } // SparklineGroup is a renderable widget which groups together the given sparklines. @@ -66,6 +66,9 @@ func (self *SparklineGroup) Draw(buf *Buffer) { for j := 0; j < len(sl.Data) && j < self.Inner.Dx(); j++ { data := sl.Data[j] height := int((data / maxVal) * float64(barHeight)) + if height > sl.MaxHeight { + height = sl.MaxHeight + } sparkChar := BARS[len(BARS)-1] for k := 0; k < height; k++ { buf.SetCell(