only show chart data type of categorical analysis in statistics setting page

This commit is contained in:
MaysWind
2024-07-15 01:25:33 +08:00
parent 7849b2f05c
commit 26e9a0ef2a
3 changed files with 11 additions and 4 deletions
+7 -2
View File
@@ -13,6 +13,7 @@ import statisticsConstants from '@/consts/statistics.js';
import apiConstants from '@/consts/api.js'; import apiConstants from '@/consts/api.js';
import { import {
isDefined,
isString, isString,
isNumber, isNumber,
isBoolean, isBoolean,
@@ -995,7 +996,7 @@ function getAllTrendChartTypes(translateFn) {
return allChartTypes; return allChartTypes;
} }
function getAllStatisticsChartDataTypes(translateFn) { function getAllStatisticsChartDataTypes(translateFn, analysisType) {
const allChartDataTypes = []; const allChartDataTypes = [];
for (const dataTypeField in statisticsConstants.allChartDataTypes) { for (const dataTypeField in statisticsConstants.allChartDataTypes) {
@@ -1005,6 +1006,10 @@ function getAllStatisticsChartDataTypes(translateFn) {
const chartDataType = statisticsConstants.allChartDataTypes[dataTypeField]; const chartDataType = statisticsConstants.allChartDataTypes[dataTypeField];
if (isDefined(analysisType) && !chartDataType.availableAnalysisTypes[analysisType]) {
continue;
}
allChartDataTypes.push({ allChartDataTypes.push({
type: chartDataType.type, type: chartDataType.type,
displayName: translateFn(chartDataType.name), displayName: translateFn(chartDataType.name),
@@ -1468,7 +1473,7 @@ export function i18nFunctions(i18nGlobal) {
getAllAccountTypes: () => getAllAccountTypes(i18nGlobal.t), getAllAccountTypes: () => getAllAccountTypes(i18nGlobal.t),
getAllCategoricalChartTypes: () => getAllCategoricalChartTypes(i18nGlobal.t), getAllCategoricalChartTypes: () => getAllCategoricalChartTypes(i18nGlobal.t),
getAllTrendChartTypes: () => getAllTrendChartTypes(i18nGlobal.t), getAllTrendChartTypes: () => getAllTrendChartTypes(i18nGlobal.t),
getAllStatisticsChartDataTypes: () => getAllStatisticsChartDataTypes(i18nGlobal.t), getAllStatisticsChartDataTypes: (analysisType) => getAllStatisticsChartDataTypes(i18nGlobal.t, analysisType),
getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t), getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t),
getAllTransactionEditScopeTypes: () => getAllTransactionEditScopeTypes(i18nGlobal.t), getAllTransactionEditScopeTypes: () => getAllTransactionEditScopeTypes(i18nGlobal.t),
getAllTransactionDefaultCategories: (categoryType, locale) => getAllTransactionDefaultCategories(categoryType, locale, i18nGlobal.t), getAllTransactionDefaultCategories: (categoryType, locale) => getAllTransactionDefaultCategories(categoryType, locale, i18nGlobal.t),
@@ -129,6 +129,7 @@ import { mapStores } from 'pinia';
import { useSettingsStore } from '@/stores/setting.js'; import { useSettingsStore } from '@/stores/setting.js';
import datetimeConstants from '@/consts/datetime.js'; import datetimeConstants from '@/consts/datetime.js';
import statisticsConstants from '@/consts/statistics.js';
import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue'; import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue';
import CategoryFilterSettingsCard from '@/views/desktop/common/cards/CategoryFilterSettingsCard.vue'; import CategoryFilterSettingsCard from '@/views/desktop/common/cards/CategoryFilterSettingsCard.vue';
@@ -141,7 +142,7 @@ export default {
computed: { computed: {
...mapStores(useSettingsStore), ...mapStores(useSettingsStore),
allChartDataTypes() { allChartDataTypes() {
return this.$locale.getAllStatisticsChartDataTypes(); return this.$locale.getAllStatisticsChartDataTypes(statisticsConstants.allAnalysisTypes.CategoricalAnalysis);
}, },
allTimezoneTypesUsedForStatistics() { allTimezoneTypesUsedForStatistics() {
return this.$locale.getAllTimezoneTypesUsedForStatistics(); return this.$locale.getAllTimezoneTypesUsedForStatistics();
+2 -1
View File
@@ -92,12 +92,13 @@ import { mapStores } from 'pinia';
import { useSettingsStore } from '@/stores/setting.js'; import { useSettingsStore } from '@/stores/setting.js';
import datetimeConstants from '@/consts/datetime.js'; import datetimeConstants from '@/consts/datetime.js';
import statisticsConstants from '@/consts/statistics.js';
export default { export default {
computed: { computed: {
...mapStores(useSettingsStore), ...mapStores(useSettingsStore),
allChartDataTypes() { allChartDataTypes() {
return this.$locale.getAllStatisticsChartDataTypes(); return this.$locale.getAllStatisticsChartDataTypes(statisticsConstants.allAnalysisTypes.CategoricalAnalysis);
}, },
allTimezoneTypesUsedForStatistics() { allTimezoneTypesUsedForStatistics() {
return this.$locale.getAllTimezoneTypesUsedForStatistics(); return this.$locale.getAllTimezoneTypesUsedForStatistics();