From b129a3a6a500fc2ac9493d3b61b2d496e0ece84a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 11 Jan 2022 18:27:29 +0800 Subject: [PATCH] edit charts --- src/views/WalletAccounts.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index cda0afa6..92ead107 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -482,12 +482,14 @@ export default { }, calculateChartBar() { const total = this.calculateByDenom + // Object.entries(total.value).sort((a, b) => b[0].localeCompare(a[0])); + const data = Object.entries(total.value).sort((a, b) => b[1] - a[1]).slice(0, 15) return { - labels: Object.keys(total.value), + labels: data.map(x => x[0]), datasets: [ { label: 'Market Cap', - data: Object.values(total.value), + data: data.map(x => x[1]), backgroundColor: chartColors(), borderWidth: 0, pointStyle: 'rectRounded', @@ -495,11 +497,11 @@ export default { }, { label: 'Qty', - data: Object.values(total.qty), + data: data.map(x => total.qty[x[0]]), // Object.values(total.qty), backgroundColor: chartColors(), borderWidth: 0, pointStyle: 'rectRounded', - // yAxisID: 'y-axis-2', + yAxisID: 'y-axis-2', }, ], }