mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
add chart type and chart data type settings for trend analysis
This commit is contained in:
+18
-1
@@ -823,6 +823,21 @@ function getAllCategoricalChartTypes(translateFn) {
|
||||
return allChartTypes;
|
||||
}
|
||||
|
||||
function getAllTrendChartTypes(translateFn) {
|
||||
const allChartTypes = [];
|
||||
|
||||
for (let i = 0; i < statistics.allTrendChartTypesArray.length; i++) {
|
||||
const chartType = statistics.allTrendChartTypesArray[i];
|
||||
|
||||
allChartTypes.push({
|
||||
type: chartType.type,
|
||||
displayName: translateFn(chartType.name)
|
||||
});
|
||||
}
|
||||
|
||||
return allChartTypes;
|
||||
}
|
||||
|
||||
function getAllStatisticsChartDataTypes(translateFn) {
|
||||
const allChartDataTypes = [];
|
||||
|
||||
@@ -835,7 +850,8 @@ function getAllStatisticsChartDataTypes(translateFn) {
|
||||
|
||||
allChartDataTypes.push({
|
||||
type: chartDataType.type,
|
||||
displayName: translateFn(chartDataType.name)
|
||||
displayName: translateFn(chartDataType.name),
|
||||
availableAnalysisTypes: chartDataType.availableAnalysisTypes
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1367,6 +1383,7 @@ export function i18nFunctions(i18nGlobal) {
|
||||
getAllAccountCategories: () => getAllAccountCategories(i18nGlobal.t),
|
||||
getAllAccountTypes: () => getAllAccountTypes(i18nGlobal.t),
|
||||
getAllCategoricalChartTypes: () => getAllCategoricalChartTypes(i18nGlobal.t),
|
||||
getAllTrendChartTypes: () => getAllTrendChartTypes(i18nGlobal.t),
|
||||
getAllStatisticsChartDataTypes: () => getAllStatisticsChartDataTypes(i18nGlobal.t),
|
||||
getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t),
|
||||
getAllTransactionEditScopeTypes: () => getAllTransactionEditScopeTypes(i18nGlobal.t),
|
||||
|
||||
+19
-10
@@ -21,13 +21,14 @@ const defaultSettings = {
|
||||
showTotalAmountInTransactionListPage: true,
|
||||
showAccountBalance: true,
|
||||
statistics: {
|
||||
defaultChartType: statisticsConstants.defaultCategoricalChartType,
|
||||
defaultChartDataType: statisticsConstants.defaultChartDataType,
|
||||
defaultDataRangeType: statisticsConstants.defaultDataRangeType,
|
||||
defaultTimezoneType: timezoneConstants.defaultTimezoneTypesUsedForStatistics,
|
||||
defaultAccountFilter: {},
|
||||
defaultTransactionCategoryFilter: {},
|
||||
defaultSortingType: statisticsConstants.defaultSortingType
|
||||
defaultSortingType: statisticsConstants.defaultSortingType,
|
||||
defaultCategoricalChartType: statisticsConstants.defaultCategoricalChartType,
|
||||
defaultTrendChartType: statisticsConstants.defaultTrendChartType,
|
||||
},
|
||||
animate: true
|
||||
};
|
||||
@@ -221,14 +222,6 @@ export function setShowAccountBalance(value) {
|
||||
setOption('showAccountBalance', value);
|
||||
}
|
||||
|
||||
export function getStatisticsDefaultChartType() {
|
||||
return getSubOption('statistics', 'defaultChartType');
|
||||
}
|
||||
|
||||
export function setStatisticsDefaultChartType(value) {
|
||||
setSubOption('statistics', 'defaultChartType', value);
|
||||
}
|
||||
|
||||
export function getStatisticsDefaultChartDataType() {
|
||||
return getSubOption('statistics', 'defaultChartDataType');
|
||||
}
|
||||
@@ -277,6 +270,22 @@ export function setStatisticsSortingType(value) {
|
||||
setSubOption('statistics', 'defaultSortingType', value);
|
||||
}
|
||||
|
||||
export function getStatisticsDefaultCategoricalChartType() {
|
||||
return getSubOption('statistics', 'defaultCategoricalChartType');
|
||||
}
|
||||
|
||||
export function setStatisticsDefaultCategoricalChartType(value) {
|
||||
setSubOption('statistics', 'defaultCategoricalChartType', value);
|
||||
}
|
||||
|
||||
export function getStatisticsDefaultTrendChartType() {
|
||||
return getSubOption('statistics', 'defaultTrendChartType');
|
||||
}
|
||||
|
||||
export function setStatisticsDefaultTrendChartType(value) {
|
||||
setSubOption('statistics', 'defaultTrendChartType', value);
|
||||
}
|
||||
|
||||
export function isEnableAnimate() {
|
||||
return getOption('animate');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
|
||||
export function isChartDataTypeAvailableForAnalysisType(chartDataType, analysisType) {
|
||||
for (const dataTypeField in statisticsConstants.allChartDataTypes) {
|
||||
if (!Object.prototype.hasOwnProperty.call(statisticsConstants.allChartDataTypes, dataTypeField)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const dataTypeItem = statisticsConstants.allChartDataTypes[dataTypeField];
|
||||
|
||||
if (dataTypeItem.type !== chartDataType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return !!dataTypeItem.availableAnalysisTypes[analysisType];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user