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

View File

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