hide percent for outflows/inflows by account categorical chart

This commit is contained in:
MaysWind
2025-10-27 23:47:04 +08:00
parent f93610b5e0
commit 765e64d96f
8 changed files with 55 additions and 15 deletions
@@ -212,6 +212,11 @@ export function useStatisticsTransactionPageBase() {
return tt('Total Amount');
});
const showPercentInCategoricalChart = computed<boolean>(() => {
return query.value.chartDataType !== ChartDataType.OutflowsByAccount.type &&
query.value.chartDataType !== ChartDataType.InflowsByAccount.type;
});
const showTotalAmountInTrendsChart = computed<boolean>(() => {
return query.value.chartDataType !== ChartDataType.TotalOutflows.type &&
query.value.chartDataType !== ChartDataType.TotalExpense.type &&
@@ -300,6 +305,7 @@ export function useStatisticsTransactionPageBase() {
canUseKeywordFilter,
showAmountInChart,
totalAmountName,
showPercentInCategoricalChart,
showTotalAmountInTrendsChart,
translateNameInTrendsChart,
categoricalAnalysisData,
@@ -224,6 +224,7 @@
:items="categoricalAnalysisData && categoricalAnalysisData.items && categoricalAnalysisData.items.length ? categoricalAnalysisData.items : []"
:min-valid-percent="0.0001"
:show-value="showAmountInChart"
:show-percent="showPercentInCategoricalChart"
:enable-click-item="true"
:default-currency="defaultCurrency"
id-field="id"
@@ -273,7 +274,7 @@
<div class="d-flex flex-column ms-2">
<div class="d-flex">
<span>{{ item.name }}</span>
<small class="statistics-percent" v-if="item.percent >= 0">{{ formatPercentToLocalizedNumerals(item.percent, 2, '&lt;0.01') }}</small>
<small class="statistics-percent" v-if="showPercentInCategoricalChart && item.percent >= 0">{{ formatPercentToLocalizedNumerals(item.percent, 2, '&lt;0.01') }}</small>
<v-spacer/>
<span class="statistics-amount">{{ getDisplayAmount(item.totalAmount, defaultCurrency) }}</span>
</div>
@@ -310,6 +311,7 @@
:items="categoricalAnalysisData && categoricalAnalysisData.items && categoricalAnalysisData.items.length ? categoricalAnalysisData.items : []"
:min-valid-percent="0.0001"
:show-value="showAmountInChart"
:show-percent="showPercentInCategoricalChart"
:default-currency="defaultCurrency"
name-field="name"
value-field="totalAmount"
@@ -518,6 +520,7 @@ const {
canUseKeywordFilter,
showAmountInChart,
totalAmountName,
showPercentInCategoricalChart,
showTotalAmountInTrendsChart,
translateNameInTrendsChart,
categoricalAnalysisData,
@@ -72,6 +72,7 @@
:items="categoricalAnalysisData.items"
:min-valid-percent="0.0001"
:show-value="showAmountInChart"
:show-percent="showPercentInCategoricalChart"
:show-center-text="true"
:show-selected-item-info="true"
:enable-click-item="true"
@@ -171,7 +172,7 @@
<template #title>
<div class="statistics-list-item-text">
<span>{{ item.name }}</span>
<small class="statistics-percent" v-if="item.percent >= 0">{{ formatPercentToLocalizedNumerals(item.percent, 2, '&lt;0.01') }}</small>
<small class="statistics-percent" v-if="showPercentInCategoricalChart && item.percent >= 0">{{ formatPercentToLocalizedNumerals(item.percent, 2, '&lt;0.01') }}</small>
</div>
</template>
@@ -403,6 +404,7 @@ const {
canUseKeywordFilter,
showAmountInChart,
totalAmountName,
showPercentInCategoricalChart,
translateNameInTrendsChart,
categoricalAnalysisData,
trendsAnalysisData,