change the outflows/inflows by account trend charts to non-stacked charts and hide the total amount for these charts
This commit is contained in:
@@ -17,6 +17,7 @@ import { getAllDateRangesFromItems } from '@/lib/statistics.ts';
|
|||||||
|
|
||||||
export interface CommonMonthlyTrendsChartProps<T extends Year1BasedMonth> {
|
export interface CommonMonthlyTrendsChartProps<T extends Year1BasedMonth> {
|
||||||
items: YearMonthItems<T>[];
|
items: YearMonthItems<T>[];
|
||||||
|
stacked?: boolean;
|
||||||
startYearMonth: TextualYearMonth | '';
|
startYearMonth: TextualYearMonth | '';
|
||||||
endYearMonth: TextualYearMonth | '';
|
endYearMonth: TextualYearMonth | '';
|
||||||
fiscalYearStart: number;
|
fiscalYearStart: number;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ interface MonthlyTrendsChartDataItem {
|
|||||||
selected: boolean;
|
selected: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
areaStyle?: object;
|
areaStyle?: object;
|
||||||
stack: string;
|
stack?: string;
|
||||||
animation: boolean;
|
animation: boolean;
|
||||||
data: number[];
|
data: number[];
|
||||||
}
|
}
|
||||||
@@ -219,11 +219,16 @@ const allSeries = computed<MonthlyTrendsChartDataItem[]>(() => {
|
|||||||
},
|
},
|
||||||
selected: true,
|
selected: true,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
stack: 'a',
|
|
||||||
animation: !props.skeleton,
|
animation: !props.skeleton,
|
||||||
data: allAmounts
|
data: allAmounts
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (props.stacked) {
|
||||||
|
finalItem.stack = 'a';
|
||||||
|
} else if (props.idField && item[props.idField]) {
|
||||||
|
finalItem.stack = item[props.idField] as string;
|
||||||
|
}
|
||||||
|
|
||||||
if (props.type === TrendChartType.Area.type) {
|
if (props.type === TrendChartType.Area.type) {
|
||||||
finalItem.areaStyle = {};
|
finalItem.areaStyle = {};
|
||||||
} else if (props.type === TrendChartType.Column.type) {
|
} else if (props.type === TrendChartType.Column.type) {
|
||||||
|
|||||||
@@ -43,9 +43,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
<f7-list-item class="statistics-list-item"
|
<f7-list-item link="#"
|
||||||
link="#"
|
|
||||||
:key="idx"
|
:key="idx"
|
||||||
|
:class="{ 'statistics-list-item': true, 'statistics-list-item-stacked': stacked, 'statistics-list-item-non-stacked': !stacked }"
|
||||||
v-for="(item, idx) in allDisplayDataItems.data"
|
v-for="(item, idx) in allDisplayDataItems.data"
|
||||||
@click="clickItem(item)"
|
@click="clickItem(item)"
|
||||||
>
|
>
|
||||||
@@ -61,14 +61,31 @@
|
|||||||
<div class="statistics-list-item-text">
|
<div class="statistics-list-item-text">
|
||||||
<span>{{ item.displayDateRange }}</span>
|
<span>{{ item.displayDateRange }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="full-line statistics-percent-line statistics-multi-percent-line display-flex flex-direction-column" v-if="!stacked">
|
||||||
|
<div class="display-flex flex-direction-column"
|
||||||
|
style="margin-top: 4px"
|
||||||
|
:key="dataIdx"
|
||||||
|
v-for="(data, dataIdx) in item.items"
|
||||||
|
v-show="data.totalAmount > 0">
|
||||||
|
<div class="full-line display-flex flex-direction-row">
|
||||||
|
<div class="display-inline-flex" :style="{ 'width': (item.percent * data.totalAmount / item.maxAmount) + '%' }">
|
||||||
|
<f7-progressbar :progress="100" :style="{ '--f7-progressbar-progress-color': (data.color ? data.color : '') } "></f7-progressbar>
|
||||||
|
</div>
|
||||||
|
<div class="display-inline-flex" :style="{ 'width': (100.0 - item.percent * data.totalAmount / item.maxAmount) + '%' }"
|
||||||
|
v-if="item.percent * data.totalAmount / item.maxAmount < 100.0">
|
||||||
|
<f7-progressbar :progress="0"></f7-progressbar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #after>
|
<template #after>
|
||||||
<span>{{ formatAmountToLocalizedNumeralsWithCurrency(item.totalAmount, defaultCurrency) }}</span>
|
<span v-if="stacked">{{ formatAmountToLocalizedNumeralsWithCurrency(item.totalAmount, defaultCurrency) }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #inner-end>
|
<template #inner-end>
|
||||||
<div class="statistics-item-end">
|
<div class="statistics-item-end" v-if="stacked">
|
||||||
<div class="statistics-percent-line statistics-multi-percent-line display-flex">
|
<div class="statistics-percent-line statistics-multi-percent-line display-flex">
|
||||||
<div class="display-inline-flex" :style="{ 'width': (item.percent * data.totalAmount / item.totalPositiveAmount) + '%' }"
|
<div class="display-inline-flex" :style="{ 'width': (item.percent * data.totalAmount / item.totalPositiveAmount) + '%' }"
|
||||||
:key="dataIdx"
|
:key="dataIdx"
|
||||||
@@ -137,6 +154,7 @@ interface MonthlyTrendsBarChartDataItem {
|
|||||||
items: MonthlyTrendsBarChartDataAmount[];
|
items: MonthlyTrendsBarChartDataAmount[];
|
||||||
totalAmount: number;
|
totalAmount: number;
|
||||||
totalPositiveAmount: number;
|
totalPositiveAmount: number;
|
||||||
|
maxAmount: number;
|
||||||
percent: number;
|
percent: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,6 +277,7 @@ const allDisplayDataItems = computed<MonthlyTrendsBarChartData>(() => {
|
|||||||
const dataItems = allDateRangeItemsMap[dateRangeKey] || [];
|
const dataItems = allDateRangeItemsMap[dateRangeKey] || [];
|
||||||
let totalAmount = 0;
|
let totalAmount = 0;
|
||||||
let totalPositiveAmount = 0;
|
let totalPositiveAmount = 0;
|
||||||
|
let maxAmount = 0;
|
||||||
|
|
||||||
sortStatisticsItems(dataItems, props.sortingType);
|
sortStatisticsItems(dataItems, props.sortingType);
|
||||||
|
|
||||||
@@ -268,6 +287,10 @@ const allDisplayDataItems = computed<MonthlyTrendsBarChartData>(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
totalAmount += dataItem.totalAmount;
|
totalAmount += dataItem.totalAmount;
|
||||||
|
|
||||||
|
if (dataItem.totalAmount > maxAmount) {
|
||||||
|
maxAmount = dataItem.totalAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalAmount > maxTotalAmount) {
|
if (totalAmount > maxTotalAmount) {
|
||||||
@@ -280,6 +303,7 @@ const allDisplayDataItems = computed<MonthlyTrendsBarChartData>(() => {
|
|||||||
items: dataItems,
|
items: dataItems,
|
||||||
totalAmount: totalAmount,
|
totalAmount: totalAmount,
|
||||||
totalPositiveAmount: totalPositiveAmount,
|
totalPositiveAmount: totalPositiveAmount,
|
||||||
|
maxAmount: maxAmount,
|
||||||
percent: 0.0
|
percent: 0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -775,6 +775,10 @@ html[dir="rtl"] .dp__main .dp__btn.dp--arrow-btn-nav {
|
|||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.statistics-list-item-non-stacked .item-inner > .item-title {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.statistics-icon {
|
.statistics-icon {
|
||||||
margin-bottom: -2px;
|
margin-bottom: -2px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,9 @@ export function useStatisticsTransactionPageBase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const showTotalAmountInTrendsChart = computed<boolean>(() => {
|
const showTotalAmountInTrendsChart = computed<boolean>(() => {
|
||||||
return query.value.chartDataType !== ChartDataType.TotalOutflows.type &&
|
return query.value.chartDataType !== ChartDataType.OutflowsByAccount.type &&
|
||||||
|
query.value.chartDataType !== ChartDataType.InflowsByAccount.type &&
|
||||||
|
query.value.chartDataType !== ChartDataType.TotalOutflows.type &&
|
||||||
query.value.chartDataType !== ChartDataType.TotalExpense.type &&
|
query.value.chartDataType !== ChartDataType.TotalExpense.type &&
|
||||||
query.value.chartDataType !== ChartDataType.TotalInflows.type &&
|
query.value.chartDataType !== ChartDataType.TotalInflows.type &&
|
||||||
query.value.chartDataType !== ChartDataType.TotalIncome.type &&
|
query.value.chartDataType !== ChartDataType.TotalIncome.type &&
|
||||||
@@ -226,6 +228,11 @@ export function useStatisticsTransactionPageBase() {
|
|||||||
query.value.chartDataType !== ChartDataType.NetIncome.type;
|
query.value.chartDataType !== ChartDataType.NetIncome.type;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const showStackedInTrendsChart = computed<boolean>(() => {
|
||||||
|
return query.value.chartDataType !== ChartDataType.OutflowsByAccount.type &&
|
||||||
|
query.value.chartDataType !== ChartDataType.InflowsByAccount.type;
|
||||||
|
});
|
||||||
|
|
||||||
const translateNameInTrendsChart = computed<boolean>(() => {
|
const translateNameInTrendsChart = computed<boolean>(() => {
|
||||||
return query.value.chartDataType === ChartDataType.TotalOutflows.type ||
|
return query.value.chartDataType === ChartDataType.TotalOutflows.type ||
|
||||||
query.value.chartDataType === ChartDataType.TotalExpense.type ||
|
query.value.chartDataType === ChartDataType.TotalExpense.type ||
|
||||||
@@ -307,6 +314,7 @@ export function useStatisticsTransactionPageBase() {
|
|||||||
totalAmountName,
|
totalAmountName,
|
||||||
showPercentInCategoricalChart,
|
showPercentInCategoricalChart,
|
||||||
showTotalAmountInTrendsChart,
|
showTotalAmountInTrendsChart,
|
||||||
|
showStackedInTrendsChart,
|
||||||
translateNameInTrendsChart,
|
translateNameInTrendsChart,
|
||||||
categoricalAnalysisData,
|
categoricalAnalysisData,
|
||||||
categoricalAllAnalysisData,
|
categoricalAllAnalysisData,
|
||||||
|
|||||||
@@ -349,6 +349,7 @@
|
|||||||
:show-value="showAmountInChart"
|
:show-value="showAmountInChart"
|
||||||
:enable-click-item="true"
|
:enable-click-item="true"
|
||||||
:default-currency="defaultCurrency"
|
:default-currency="defaultCurrency"
|
||||||
|
:stacked="showStackedInTrendsChart"
|
||||||
:show-total-amount-in-tooltip="showTotalAmountInTrendsChart"
|
:show-total-amount-in-tooltip="showTotalAmountInTrendsChart"
|
||||||
ref="monthlyTrendsChart"
|
ref="monthlyTrendsChart"
|
||||||
id-field="id"
|
id-field="id"
|
||||||
@@ -522,6 +523,7 @@ const {
|
|||||||
totalAmountName,
|
totalAmountName,
|
||||||
showPercentInCategoricalChart,
|
showPercentInCategoricalChart,
|
||||||
showTotalAmountInTrendsChart,
|
showTotalAmountInTrendsChart,
|
||||||
|
showStackedInTrendsChart,
|
||||||
translateNameInTrendsChart,
|
translateNameInTrendsChart,
|
||||||
categoricalAnalysisData,
|
categoricalAnalysisData,
|
||||||
categoricalAllAnalysisData,
|
categoricalAllAnalysisData,
|
||||||
|
|||||||
@@ -211,6 +211,7 @@
|
|||||||
:date-aggregation-type="trendDateAggregationType"
|
:date-aggregation-type="trendDateAggregationType"
|
||||||
:fiscal-year-start="fiscalYearStart"
|
:fiscal-year-start="fiscalYearStart"
|
||||||
:items="trendsAnalysisData && trendsAnalysisData.items && trendsAnalysisData.items.length ? trendsAnalysisData.items : []"
|
:items="trendsAnalysisData && trendsAnalysisData.items && trendsAnalysisData.items.length ? trendsAnalysisData.items : []"
|
||||||
|
:stacked="showStackedInTrendsChart"
|
||||||
:translate-name="translateNameInTrendsChart"
|
:translate-name="translateNameInTrendsChart"
|
||||||
:default-currency="defaultCurrency"
|
:default-currency="defaultCurrency"
|
||||||
id-field="id"
|
id-field="id"
|
||||||
@@ -405,6 +406,7 @@ const {
|
|||||||
showAmountInChart,
|
showAmountInChart,
|
||||||
totalAmountName,
|
totalAmountName,
|
||||||
showPercentInCategoricalChart,
|
showPercentInCategoricalChart,
|
||||||
|
showStackedInTrendsChart,
|
||||||
translateNameInTrendsChart,
|
translateNameInTrendsChart,
|
||||||
categoricalAnalysisData,
|
categoricalAnalysisData,
|
||||||
trendsAnalysisData,
|
trendsAnalysisData,
|
||||||
|
|||||||
Reference in New Issue
Block a user