optimize parameters of charts

This commit is contained in:
liangping 2021-10-10 17:36:16 +08:00
parent 5b0d2eebc0
commit c183d4a368
4 changed files with 18 additions and 17 deletions

View File

@ -5,7 +5,6 @@
:data="data" :data="data"
:chart-data="data" :chart-data="data"
:options="options" :options="options"
class="mb-3"
/> />
</template> </template>

View File

@ -17,11 +17,11 @@
</b-row> </b-row>
<b-row v-if="marketChartData"> <b-row v-if="marketChartData">
<b-col> <b-col>
<b-card style="min-height:60px;"> <b-card>
<summary-price-chart <summary-price-chart
:chart-data="marketChartData" :chart-data="marketChartData"
:height="60" :height="150"
:min-height="60" :min-height="150"
/> />
</b-card> </b-card>
</b-col> </b-col>
@ -169,7 +169,7 @@ export default {
Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)]) Promise.all([this.$http.getStakingPool(), this.$http.getBankTotal(res.bond_denom)])
.then(pool => { .then(pool => {
const bondedAndSupply = this.chain.items.findIndex(x => x.subtitle === 'bonded_and_supply') 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') 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)}%`) this.$set(this.chain.items[bondedRatio], 'title', `${percent(pool[0].bondedToken / pool[1].amount)}%`)
}) })

View File

@ -13,6 +13,7 @@ export default {
data() { data() {
return { return {
options: { options: {
maintainAspectRatio: false,
scales: { scales: {
xAxes: [{ xAxes: [{
type: 'time', type: 'time',

View File

@ -7,6 +7,7 @@
<b-row class="mx-0 d-flex align-items-center"> <b-row class="mx-0 d-flex align-items-center">
<b-col <b-col
md="4" md="4"
class="py-0"
> >
<b-dropdown <b-dropdown
:text="`Currency: ${currency2.toUpperCase()}`" :text="`Currency: ${currency2.toUpperCase()}`"
@ -36,26 +37,23 @@
KRW (대한민국원) KRW (대한민국원)
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
<h2 class="my-1"> <h2 class="mt-1">
{{ currency }}{{ calculateTotal }} {{ currency }}{{ calculateTotal }}
</h2> </h2>
<!-- chart --> <!-- chart -->
<chart-component-doughnut <chart-component-doughnut
:height="235" :height="160"
:width="235" :width="160"
:data="calculateChartDoughnut" :data="calculateChartDoughnut"
class="mb-3"
/> />
</b-col> </b-col>
<b-col <b-col
md="8" md="8"
class="d-none d-md-block"
> >
<chartjs-component-bar <chartjs-component-bar
:height="135.0" :height="200"
:chart-data="calculateChartBar" :chart-data="calculateChartBar"
:options="options" :options="options"
class="align-self-stretch"
/> />
</b-col> </b-col>
</b-row> </b-row>
@ -283,6 +281,7 @@ export default {
ibcDenom: {}, ibcDenom: {},
quotes: {}, quotes: {},
options: { options: {
maintainAspectRatio: false,
legend: { legend: {
display: false, display: false,
}, },
@ -303,16 +302,18 @@ export default {
position: 'left', position: 'left',
id: 'y-axis-1', id: 'y-axis-1',
ticks: { ticks: {
// For a category axis, the val is the index so the lookup via getLabelForValue is needed min: 0,
callback(val, index) { autoskipping: true,
// Hide the label of every 2nd dataset display: true,
return index % 5 === 0 ? formatNumber(val, true, 2) : '' maxTicksLimit: 7,
callback(val) {
return formatNumber(val, true, 0)
}, },
color: 'red', color: 'red',
}, },
offset: true, offset: true,
gridLines: { gridLines: {
display: false, display: true,
offsetGridLines: false, offsetGridLines: false,
}, },
}, { }, {