Browse Source

Feature/add multilines to tooltips in proportion chart (#753)

* Introduce multilines for tooltips

* Update changelog
pull/756/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
e769fabbae
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 12
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Restructured the portfolio summary tab on the home page - Restructured the portfolio summary tab on the home page
- Improved the tooltips in the portfolio proportion chart component by introducing multilines
## 1.125.0 - 12.03.2022 ## 1.125.0 - 12.03.2022

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

@ -324,16 +324,16 @@ export class PortfolioProportionChartComponent
const percentage = (context.parsed * 100) / sum; const percentage = (context.parsed * 100) / sum;
if (this.isInPercent) { if (this.isInPercent) {
return `${name ?? symbol} (${percentage.toFixed(2)}%)`; return [`${name ?? symbol}`, `${percentage.toFixed(2)}%`];
} else { } else {
const value = <number>context.raw; const value = <number>context.raw;
return `${name ?? symbol}: ${value.toLocaleString( return [
this.locale, `${name ?? symbol}`,
{ `${value.toLocaleString(this.locale, {
maximumFractionDigits: 2, maximumFractionDigits: 2,
minimumFractionDigits: 2 minimumFractionDigits: 2
} })} ${this.baseCurrency} (${percentage.toFixed(2)}%)`
)} ${this.baseCurrency} (${percentage.toFixed(2)}%)`; ];
} }
} }
} }

Loading…
Cancel
Save