Browse Source

Task/refactor input in investment chart component (#6693)

* Refactor input to isInPercentage
pull/6695/head
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
71ffd045cf
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html
  2. 14
      apps/client/src/app/components/investment-chart/investment-chart.component.ts
  3. 12
      apps/client/src/app/pages/portfolio/analysis/analysis-page.html

2
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html

@ -24,7 +24,7 @@
class="h-100"
[currency]="user?.settings?.baseCurrency"
[historicalDataItems]="historicalDataItems"
[isInPercent]="
[isInPercentage]="
data.hasImpersonationId || user.settings.isRestrictedView
"
[isLoading]="isLoadingChart"

14
apps/client/src/app/components/investment-chart/investment-chart.component.ts

@ -61,7 +61,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
@Input() currency: string;
@Input() groupBy: GroupBy;
@Input() historicalDataItems: LineChartItem[] = [];
@Input() isInPercent = false;
@Input() isInPercentage = false;
@Input() isLoading = false;
@Input() locale = getLocale();
@Input() savingsRate = 0;
@ -119,7 +119,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
data: this.investments.map(({ date, investment }) => {
return {
x: parseDate(date).getTime(),
y: this.isInPercent ? investment * 100 : investment
y: this.isInPercentage ? investment * 100 : investment
};
}),
label: this.benchmarkDataLabel,
@ -139,7 +139,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
data: this.values.map(({ date, value }) => {
return {
x: parseDate(date).getTime(),
y: this.isInPercent ? value * 100 : value
y: this.isInPercentage ? value * 100 : value
};
}),
fill: false,
@ -251,7 +251,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
border: {
display: false
},
display: !this.isInPercent,
display: !this.isInPercentage,
grid: {
color: ({ scale, tick }) => {
if (
@ -292,10 +292,10 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
return {
...getTooltipOptions({
colorScheme: this.colorScheme,
currency: this.isInPercent ? undefined : this.currency,
currency: this.isInPercentage ? undefined : this.currency,
groupBy: this.groupBy,
locale: this.isInPercent ? undefined : this.locale,
unit: this.isInPercent ? '%' : undefined
locale: this.isInPercentage ? undefined : this.locale,
unit: this.isInPercentage ? '%' : undefined
}),
mode: 'index',
position: 'top',

12
apps/client/src/app/pages/portfolio/analysis/analysis-page.html

@ -417,7 +417,9 @@
[benchmarkDataLabel]="portfolioEvolutionDataLabel"
[currency]="user?.settings?.baseCurrency"
[historicalDataItems]="performanceDataItems"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[isInPercentage]="
hasImpersonationId || user.settings.isRestrictedView
"
[isLoading]="isLoadingInvestmentChart"
[locale]="user?.settings?.locale"
/>
@ -473,7 +475,9 @@
[benchmarkDataLabel]="investmentTimelineDataLabel"
[currency]="user?.settings?.baseCurrency"
[groupBy]="mode"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[isInPercentage]="
hasImpersonationId || user.settings.isRestrictedView
"
[isLoading]="isLoadingInvestmentTimelineChart"
[locale]="user?.settings?.locale"
[savingsRate]="savingsRate"
@ -508,7 +512,9 @@
[benchmarkDataLabel]="dividendTimelineDataLabel"
[currency]="user?.settings?.baseCurrency"
[groupBy]="mode"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[isInPercentage]="
hasImpersonationId || user.settings.isRestrictedView
"
[isLoading]="isLoadingDividendTimelineChart"
[locale]="user?.settings?.locale"
/>

Loading…
Cancel
Save