Browse Source

Refactor input to isInPercentage

pull/6691/head
Thomas Kaul 2 months ago
parent
commit
83f58176cf
  1. 6
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

6
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -74,7 +74,7 @@ export class GfPortfolioProportionChartComponent
value: number; value: number;
}; };
} = {}; } = {};
@Input() isInPercent = false; @Input() isInPercentage = false;
@Input() keys: string[] = []; @Input() keys: string[] = [];
@Input() locale = getLocale(); @Input() locale = getLocale();
@Input() maxItems?: number; @Input() maxItems?: number;
@ -198,7 +198,7 @@ export class GfPortfolioProportionChartComponent
}); });
} }
if (this.isInPercent) { if (this.isInPercentage) {
const totalValueInPercentage = getSum( const totalValueInPercentage = getSum(
Object.values(chartData).map(({ value }) => { Object.values(chartData).map(({ value }) => {
return value; return value;
@ -465,7 +465,7 @@ export class GfPortfolioProportionChartComponent
if ((context.raw as number) === Number.MAX_SAFE_INTEGER) { if ((context.raw as number) === Number.MAX_SAFE_INTEGER) {
return $localize`No data available`; return $localize`No data available`;
} else if (this.isInPercent) { } else if (this.isInPercentage) {
return [`${name ?? symbol}`, `${percentage.toFixed(2)}%`]; return [`${name ?? symbol}`, `${percentage.toFixed(2)}%`];
} else { } else {
const value = context.raw as number; const value = context.raw as number;

Loading…
Cancel
Save