From c183d4a3683d8497a3bfa5c744e9a1982a786d32 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sun, 10 Oct 2021 17:36:16 +0800 Subject: [PATCH] optimize parameters of charts --- src/views/ChartComponentDoughnut.vue | 1 - src/views/Summary.vue | 8 ++++---- src/views/SummaryPriceChart.vue | 1 + src/views/WalletAccounts.vue | 25 +++++++++++++------------ 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/views/ChartComponentDoughnut.vue b/src/views/ChartComponentDoughnut.vue index 172fbdc9..29500004 100644 --- a/src/views/ChartComponentDoughnut.vue +++ b/src/views/ChartComponentDoughnut.vue @@ -5,7 +5,6 @@ :data="data" :chart-data="data" :options="options" - class="mb-3" /> diff --git a/src/views/Summary.vue b/src/views/Summary.vue index 39787501..6b5838f7 100644 --- a/src/views/Summary.vue +++ b/src/views/Summary.vue @@ -17,11 +17,11 @@ - + @@ -169,7 +169,7 @@ export default { Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)]) .then(pool => { const bondedAndSupply = this.chain.items.findIndex(x => x.subtitle === 'bonded_and_supply') - this.$set(this.chain.items[bondedAndSupply], 'title', `${formatNumber(formatTokenAmount(pool[0].bondedToken, 2, res.bond_denom), true, 2)} / ${formatNumber(formatTokenAmount(pool[1].amount, 2, res.bond_denom), true, 2)}`) + this.$set(this.chain.items[bondedAndSupply], 'title', `${formatNumber(formatTokenAmount(pool[0].bondedToken, 2, res.bond_denom), true, 0)}/${formatNumber(formatTokenAmount(pool[1].amount, 2, res.bond_denom), true, 0)}`) const bondedRatio = this.chain.items.findIndex(x => x.subtitle === 'bonded_ratio') this.$set(this.chain.items[bondedRatio], 'title', `${percent(pool[0].bondedToken / pool[1].amount)}%`) }) diff --git a/src/views/SummaryPriceChart.vue b/src/views/SummaryPriceChart.vue index 9dfd44f5..8f7d1f31 100644 --- a/src/views/SummaryPriceChart.vue +++ b/src/views/SummaryPriceChart.vue @@ -13,6 +13,7 @@ export default { data() { return { options: { + maintainAspectRatio: false, scales: { xAxes: [{ type: 'time', diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index 5156bf3f..4b466822 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -7,6 +7,7 @@ -

+

{{ currency }}{{ calculateTotal }}

@@ -283,6 +281,7 @@ export default { ibcDenom: {}, quotes: {}, options: { + maintainAspectRatio: false, legend: { display: false, }, @@ -303,16 +302,18 @@ export default { position: 'left', id: 'y-axis-1', ticks: { - // For a category axis, the val is the index so the lookup via getLabelForValue is needed - callback(val, index) { - // Hide the label of every 2nd dataset - return index % 5 === 0 ? formatNumber(val, true, 2) : '' + min: 0, + autoskipping: true, + display: true, + maxTicksLimit: 7, + callback(val) { + return formatNumber(val, true, 0) }, color: 'red', }, offset: true, gridLines: { - display: false, + display: true, offsetGridLines: false, }, }, {