Browse Source

Refactor input to isInPercentage

pull/6693/head
Thomas Kaul 2 months ago
parent
commit
f70c6b23ef
  1. 14
      apps/client/src/app/components/investment-chart/investment-chart.component.ts

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

Loading…
Cancel
Save