add candlestick chart for account balance trends

This commit is contained in:
MaysWind
2025-08-05 23:29:49 +08:00
parent 0d55912f6c
commit 7283b724b1
24 changed files with 292 additions and 64 deletions
@@ -34,7 +34,7 @@ import {
export function useReconciliationStatementPageBase() {
const {
tt,
getAllTrendChartTypes,
getAllAccountBalanceTrendChartTypes,
getAllStatisticsDateAggregationTypesWithShortName,
getCurrentDigitGroupingSymbol,
formatUnixTimeToLongDateTime,
@@ -59,7 +59,7 @@ export function useReconciliationStatementPageBase() {
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone));
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
const allChartTypes = computed<TypeAndDisplayName[]>(() => getAllTrendChartTypes());
const allChartTypes = computed<TypeAndDisplayName[]>(() => getAllAccountBalanceTrendChartTypes());
const allDateAggregationTypes = computed<TypeAndDisplayName[]>(() => getAllStatisticsDateAggregationTypesWithShortName());
const currentAccount = computed(() => allAccountsMap.value[accountId.value]);
@@ -187,9 +187,9 @@ export function useReconciliationStatementPageBase() {
}
if (isLiabilityAccount) {
return formatAmountWithCurrency(-transaction.accountBalance, currency);
return formatAmountWithCurrency(-transaction.accountClosingBalance, currency);
} else {
return formatAmountWithCurrency(transaction.accountBalance, currency);
return formatAmountWithCurrency(transaction.accountClosingBalance, currency);
}
}
@@ -234,9 +234,9 @@ export function useReconciliationStatementPageBase() {
let displayAccountBalance = '';
if (isCurrentLiabilityAccount.value) {
displayAccountBalance = removeAll(formatAmount(-transaction.accountBalance), digitGroupingSymbol);
displayAccountBalance = removeAll(formatAmount(-transaction.accountClosingBalance), digitGroupingSymbol);
} else {
displayAccountBalance = removeAll(formatAmount(transaction.accountBalance), digitGroupingSymbol);
displayAccountBalance = removeAll(formatAmount(transaction.accountClosingBalance), digitGroupingSymbol);
}
let description = transaction.comment || '';
@@ -279,7 +279,7 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.ts';
import { useTransactionsStore } from '@/stores/transaction.ts';
import { TransactionType } from '@/core/transaction.ts';
import { TrendChartType, ChartDateAggregationType } from '@/core/statistics.ts';
import { AccountBalanceTrendChartType, ChartDateAggregationType } from '@/core/statistics.ts';
import { KnownFileType } from '@/core/file.ts';
import { Transaction, type TransactionReconciliationStatementResponseItem } from '@/models/transaction.ts';
@@ -295,6 +295,7 @@ import {
mdiCheck,
mdiChartBar,
mdiChartAreasplineVariant,
mdiChartWaterfall,
mdiCalendarTodayOutline,
mdiCalendarMonthOutline,
mdiLayersTripleOutline,
@@ -356,8 +357,9 @@ const transactionCategoriesStore = useTransactionCategoriesStore();
const transactionsStore = useTransactionsStore();
const chartTypeIconMap = {
[TrendChartType.Column.type]: mdiChartBar,
[TrendChartType.Area.type]: mdiChartAreasplineVariant,
[AccountBalanceTrendChartType.Column.type]: mdiChartBar,
[AccountBalanceTrendChartType.Area.type]: mdiChartAreasplineVariant,
[AccountBalanceTrendChartType.Candlestick.type]: mdiChartWaterfall,
};
const chartDataDateAggregationTypeIconMap = {
@@ -376,7 +378,7 @@ const loading = ref<boolean>(false);
const currentPage = ref<number>(1);
const countPerPage = ref<number>(10);
const showAccountBalanceTrendsCharts = ref<boolean>(false);
const chartType = ref<number>(TrendChartType.Default.type);
const chartType = ref<number>(AccountBalanceTrendChartType.Default.type);
const chartDataDateAggregationType = ref<number | undefined>(undefined);
let rejectFunc: ((reason?: unknown) => void) | null = null;
@@ -459,7 +461,7 @@ function open(options: { accountId: string, startTime: number, endTime: number }
currentPage.value = 1;
countPerPage.value = 10;
showAccountBalanceTrendsCharts.value = false;
chartType.value = TrendChartType.Default.type;
chartType.value = AccountBalanceTrendChartType.Default.type;
chartDataDateAggregationType.value = undefined;
showState.value = true;
loading.value = true;