improve scatter

This commit is contained in:
liangping 2022-11-01 10:49:55 +08:00
parent eabd43ce88
commit bb2f816b5c
2 changed files with 9 additions and 8 deletions

View File

@ -364,8 +364,9 @@ export default {
const total = []
if (this.calculateByDenom.qty) {
Object.entries(this.calculateByDenom.qty).forEach(i => {
const price = this.getPrice(i[0])
total.push([Math.sqrt(i[1]), Math.sqrt(price), i[1] * price, i[0]])
const price = this.getPrice(i[0], 'usd')
// x, y, circle
total.push([Math.sqrt(i[1]), i[1] * price, price, i[0]])
})
}
return total.sort((a, b) => b[2] - a[2])
@ -530,10 +531,10 @@ export default {
}
return ''
},
getPrice(denom) {
getPrice(denom, currency = null) {
const d2 = this.formatDenom(denom)
const quote = this.$store.state.chains.quotes[d2]
return quote ? quote[this.currency2] || 0 : 0
return quote ? quote[currency || this.currency2 || 'usd'] || 0 : 0
},
getChanges(denom) {
const d2 = this.formatDenom(denom)

View File

@ -49,15 +49,15 @@ export default {
data: [item],
type: 'scatter',
symbolSize(data) {
const r = Math.log10(data[2]) * 5
return r < 10 ? 10 : r
const r = Math.log(data[2]) * 8
return r < 15 ? 15 : r
},
emphasis: {
focus: 'series',
label: {
show: true,
formatter(param) {
return `${param.data[3]}, ${formatNumber(param.data[2], true, 1)}`
return `${param.data[3]}, $${parseFloat(param.data[2]).toFixed(2)}`
},
position: 'top',
},
@ -94,7 +94,7 @@ export default {
},
},
yAxis: {
name: 'Price',
name: 'Value',
nameLocation: 'center',
axisLabel: {
show: false,