|
|
@ -93,6 +93,7 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
protected isLoadingDividendTimelineChart: boolean; |
|
|
protected isLoadingDividendTimelineChart: boolean; |
|
|
protected isLoadingInvestmentChart: boolean; |
|
|
protected isLoadingInvestmentChart: boolean; |
|
|
protected isLoadingInvestmentTimelineChart: boolean; |
|
|
protected isLoadingInvestmentTimelineChart: boolean; |
|
|
|
|
|
protected isLoadingPerformanceTimelineChart: boolean; |
|
|
protected isLoadingPortfolioPrompt: boolean; |
|
|
protected isLoadingPortfolioPrompt: boolean; |
|
|
protected readonly mode = signal<GroupBy>('month'); |
|
|
protected readonly mode = signal<GroupBy>('month'); |
|
|
protected readonly modeOptions: ToggleOption<GroupBy>[] = [ |
|
|
protected readonly modeOptions: ToggleOption<GroupBy>[] = [ |
|
|
@ -103,6 +104,8 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
protected readonly PerformanceCalculationType = PerformanceCalculationType; |
|
|
protected readonly PerformanceCalculationType = PerformanceCalculationType; |
|
|
protected performanceDataItems: LineChartItem[]; |
|
|
protected performanceDataItems: LineChartItem[]; |
|
|
protected performanceDataItemsInPercentage: LineChartItem[]; |
|
|
protected performanceDataItemsInPercentage: LineChartItem[]; |
|
|
|
|
|
protected performancePercentagesByYear: InvestmentItem[]; |
|
|
|
|
|
protected readonly performanceTimelineDataLabel = $localize`Net Performance`; |
|
|
protected readonly portfolioEvolutionDataLabel = $localize`Invested Capital`; |
|
|
protected readonly portfolioEvolutionDataLabel = $localize`Invested Capital`; |
|
|
protected precision = 2; |
|
|
protected precision = 2; |
|
|
protected savingsRatePerMonth: number | undefined; |
|
|
protected savingsRatePerMonth: number | undefined; |
|
|
@ -312,6 +315,37 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fetchPerformanceByYear() { |
|
|
|
|
|
this.isLoadingPerformanceTimelineChart = true; |
|
|
|
|
|
|
|
|
|
|
|
this.dataService |
|
|
|
|
|
.fetchPortfolioPerformance({ |
|
|
|
|
|
filters: this.userService.getFilters(), |
|
|
|
|
|
groupBy: 'year', |
|
|
|
|
|
range: this.user?.settings?.dateRange ?? DEFAULT_DATE_RANGE |
|
|
|
|
|
}) |
|
|
|
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
|
|
.subscribe(({ chart }) => { |
|
|
|
|
|
this.performancePercentagesByYear = []; |
|
|
|
|
|
|
|
|
|
|
|
for (const { |
|
|
|
|
|
date, |
|
|
|
|
|
netPerformanceInPercentageWithCurrencyEffect |
|
|
|
|
|
} of chart ?? []) { |
|
|
|
|
|
if (isNumber(netPerformanceInPercentageWithCurrencyEffect)) { |
|
|
|
|
|
this.performancePercentagesByYear.push({ |
|
|
|
|
|
date, |
|
|
|
|
|
investment: netPerformanceInPercentageWithCurrencyEffect |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.isLoadingPerformanceTimelineChart = false; |
|
|
|
|
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private update() { |
|
|
private update() { |
|
|
this.isLoadingInvestmentChart = true; |
|
|
this.isLoadingInvestmentChart = true; |
|
|
|
|
|
|
|
|
@ -420,6 +454,10 @@ export class GfAnalysisPageComponent implements OnInit { |
|
|
|
|
|
|
|
|
this.fetchDividendsAndInvestments(); |
|
|
this.fetchDividendsAndInvestments(); |
|
|
|
|
|
|
|
|
|
|
|
if (this.user?.settings?.isExperimentalFeatures) { |
|
|
|
|
|
this.fetchPerformanceByYear(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|