From c434b730a827010279d95b07dc70e1b2b9fb4d28 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 9 Jul 2023 10:42:53 +0200 Subject: [PATCH] Feature/hide average buy price in position detail chart if no holding (#2133) * Hide the average buy price if no holding * Update changelog --- CHANGELOG.md | 1 + .../position-detail-dialog.component.ts | 9 +++++++++ libs/ui/src/lib/line-chart/line-chart.component.ts | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5d37f742..e901299f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Hid the average buy price in the position detail chart if there is no holding - Improved the language localization for French (`fr`) - Refactored the blog articles to standalone components diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts index 9c4d3c6e3..bc68cf231 100644 --- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts +++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts @@ -215,6 +215,15 @@ export class PositionDetailDialog implements OnDestroy, OnInit { this.benchmarkDataItems[0].value = this.averagePrice; } + this.benchmarkDataItems = this.benchmarkDataItems.map( + ({ date, value }) => { + return { + date, + value: value === 0 ? null : value + }; + } + ); + if (Number.isInteger(this.quantity)) { this.quantityPrecision = 0; } else if (this.SymbolProfile?.assetSubClass === 'CRYPTOCURRENCY') { 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 be43f9394..c6eb68cec 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -154,7 +154,8 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { data: benchmarkPrices, fill: false, label: this.benchmarkLabel, - pointRadius: 0 + pointRadius: 0, + spanGaps: false }, { backgroundColor: gradient,