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
+28 -7
View File
@@ -326,17 +326,38 @@ export const useStatisticsStore = defineStore('statistics', () => {
const allStatisticsItems: TransactionCategoricalAnalysisDataItem[] = [];
if (combinedData && combinedData.items) {
let maxTotalAmount = 0;
for (const dataItem of values(combinedData.items)) {
if (dataItem.totalAmount > maxTotalAmount) {
maxTotalAmount = dataItem.totalAmount;
}
}
for (const dataItem of values(combinedData.items)) {
let percent = 0;
if (dataItem.totalAmount > 0) {
percent = dataItem.totalAmount * 100 / combinedData.totalNonNegativeAmount;
} else {
percent = 0;
}
if (transactionStatisticsFilter.value.chartDataType === ChartDataType.OutflowsByAccount.type ||
transactionStatisticsFilter.value.chartDataType === ChartDataType.InflowsByAccount.type) {
if (maxTotalAmount > 0) {
percent = dataItem.totalAmount * 100 / maxTotalAmount;
} else {
percent = 0;
}
if (percent < 0) {
percent = 0;
if (percent < 0) {
percent = 0;
}
} else {
if (dataItem.totalAmount > 0) {
percent = dataItem.totalAmount * 100 / combinedData.totalNonNegativeAmount;
} else {
percent = 0;
}
if (percent < 0) {
percent = 0;
}
}
const statisticDataItem: TransactionCategoricalAnalysisDataItem = {