diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2019-03-08 14:11:55 -0800 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2019-03-08 14:11:55 -0800 |
commit | 35223403c1b9cb3c12aaf485f964a9905d694745 (patch) | |
tree | 5fc2de20115fc494cc1a3a146767c1bbc92e9735 | |
parent | c2c941e94b21af1a56075b49fb0f031e0155ba81 (diff) |
Fix sparkline after upgrading termui
-rw-r--r-- | src/termui/sparkline.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/termui/sparkline.go b/src/termui/sparkline.go index ef09efd..2f27d9e 100644 --- a/src/termui/sparkline.go +++ b/src/termui/sparkline.go @@ -78,13 +78,13 @@ func (self *SparklineGroup) Draw(buf *Buffer) { } // prints sparkline for x := self.Inner.Dx(); x >= 1; x-- { - char := BARS[0] + char := BARS[1] if (self.Inner.Dx() - x) < len(line.Data) { offset := self.Inner.Dx() - x curItem := line.Data[(len(line.Data)-1)-offset] percent := float64(curItem) / float64(max) - index := int(percent * 7) - if index < 0 || index >= len(BARS) { + index := int(percent*float64(len(BARS)-2)) + 1 + if index < 1 || index >= len(BARS) { log.Printf( "invalid sparkline data value. index: %v, percent: %v, curItem: %v, offset: %v", index, percent, curItem, offset, |