When hidePortfolioBalances scale the chart to the maximum price; avoids issue with resampling and using the last value

pull/237/head
Simon Roberts 3 years ago
parent 30fa30c057
commit d7cec61e83
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -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
}
}
}

Loading…
Cancel
Save