summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Mota <hello@miguelmota.com>2021-10-20 20:23:24 -0700
committerGitHub <noreply@github.com>2021-10-20 20:23:24 -0700
commitf34eb3ef8fb4684ebf9661068a530267c470769b (patch)
treee6ac115bcd8ff21bc4bbeb81d4b962d994d1004b
parent30fa30c057cfd3f8e7741e82c99f31feb1dccf4a (diff)
parentd7cec61e837fcba0fa6a9973c7b06521c2804d06 (diff)
Merge pull request #237 from lyricnz/bugfix/hide-portfolio-balances
Fix bug with chart Y axis still showing when hidePortfolioBalances
-rw-r--r--cointop/chart.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/cointop/chart.go b/cointop/chart.go
index dcca3f4..98ff63c 100644
--- a/cointop/chart.go
+++ b/cointop/chart.go
@@ -315,10 +315,15 @@ func (ct *Cointop) PortfolioChart() error {
// Scale Portfolio Balances to hide value
if ct.State.hidePortfolioBalances {
- var lastPrice = data[len(data)-1]
- if lastPrice > 0.0 {
+ scalePrice := 0.0
+ for _, price := range data {
+ if price > scalePrice {
+ scalePrice = price
+ }
+ }
+ if scalePrice > 0.0 {
for i, price := range data {
- data[i] = 100 * price / lastPrice
+ data[i] = 100 * price / scalePrice
}
}
}