Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/localize number formatting of y-axis labels in line chart component (#5624)

David Requenoda80efa0c620
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9bbcca846..e94d88d010 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Localized the number formatting of the y-axis labels in the line chart component
- Improved the wording of the 4% rule in the _FIRE_ section
- Improved the language localization for German (`de`)
diff --git a/libs/ui/src/lib/line-chart/line-chart.component.ts b/libs/ui/src/lib/line-chart/line-chart.component.ts
index e7f8b132ea..0afef5959d 100644
--- a/libs/ui/src/lib/line-chart/line-chart.component.ts
+++ b/libs/ui/src/lib/line-chart/line-chart.component.ts
@@ -261,7 +261,10 @@ export class GfLineChartComponent
}
if (typeof tickValue === 'number') {
- return tickValue.toFixed(2);
+ return tickValue.toLocaleString(this.locale, {
+ maximumFractionDigits: 2,
+ minimumFractionDigits: 2
+ });
}
return tickValue;