From bb2f816b5ca915e938e08c8d9fc75c59d0221117 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 1 Nov 2022 10:49:55 +0800 Subject: [PATCH] improve scatter --- src/views/WalletAccounts.vue | 9 +++++---- src/views/components/charts/EchartScatter.vue | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index 4d1e2d52..9b92a149 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -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) diff --git a/src/views/components/charts/EchartScatter.vue b/src/views/components/charts/EchartScatter.vue index 030c4d1a..b5d228c7 100644 --- a/src/views/components/charts/EchartScatter.vue +++ b/src/views/components/charts/EchartScatter.vue @@ -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,