improve ux

This commit is contained in:
liangping 2022-03-06 09:20:25 +08:00
parent 944b02dce1
commit 1e07bf6d4b
2 changed files with 6 additions and 3 deletions

View File

@ -558,7 +558,7 @@ export default {
}, },
formatCurrency(amount, denom) { formatCurrency(amount, denom) {
const qty = this.formatAmount(amount, denom, false) const qty = this.formatAmount(amount, denom, false)
return qty * this.getPrice(denom) return parseFloat((qty * this.getPrice(denom)).toFixed(2))
}, },
priceColor(denom) { priceColor(denom) {
const d2 = this.formatDenom(denom) const d2 = this.formatDenom(denom)
@ -585,6 +585,9 @@ export default {
}, },
formatChanges(denom) { formatChanges(denom) {
const price = this.getChanges(denom) const price = this.getChanges(denom)
if (price > 0) {
return `+${parseFloat(price.toFixed(2))}%`
}
return price === 0 ? '' : `${parseFloat(price.toFixed(2))}%` return price === 0 ? '' : `${parseFloat(price.toFixed(2))}%`
}, },
formatPrice(denom) { formatPrice(denom) {
@ -622,7 +625,7 @@ export default {
const ret = delegations.map(x => this.formatCurrency(x.amount, x.denom) * this.getChanges(x.denom) * 0.01).reduce((t, c) => t + c, 0) const ret = delegations.map(x => this.formatCurrency(x.amount, x.denom) * this.getChanges(x.denom) * 0.01).reduce((t, c) => t + c, 0)
total += ret total += ret
} }
return parseFloat(total.toFixed(2)) return total > 0 ? `+${parseFloat(total.toFixed(2))}` : parseFloat(total.toFixed(2))
}, },
formatBalanceChangesColor(v) { formatBalanceChangesColor(v) {
const total = this.formatBalanceChanges(v) const total = this.formatBalanceChanges(v)

View File

@ -89,7 +89,7 @@ export default {
series: [ series: [
{ {
name: '', name: '',
data: this.items, data: this.items.filter(x => x[1] > 0),
type: 'scatter', type: 'scatter',
symbolSize(data) { symbolSize(data) {
const r = Math.log(data[2]) const r = Math.log(data[2])