From 7757daca3b0171ee55d153394125693e37298db0 Mon Sep 17 00:00:00 2001 From: mister-ideas <36502095+mister-ideas@users.noreply.github.com> Date: Wed, 21 Oct 2026 10:54:00 +0200 Subject: [PATCH] Feature/hide the performance chart of the home overview if it has less than three data points --- .../components/home-overview/home-overview.component.ts | 8 ++++++++ .../src/app/components/home-overview/home-overview.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/client/src/app/components/home-overview/home-overview.component.ts b/apps/client/src/app/components/home-overview/home-overview.component.ts index c7b880efce..fc33a10d0d 100644 --- a/apps/client/src/app/components/home-overview/home-overview.component.ts +++ b/apps/client/src/app/components/home-overview/home-overview.component.ts @@ -38,6 +38,8 @@ import { MatCardModule } from '@angular/material/card'; import { Router, RouterModule } from '@angular/router'; import { DeviceDetectorService } from 'ngx-device-detector'; +const MINIMUM_CHART_ITEMS = 3; + @Component({ changeDetection: ChangeDetectionStrategy.OnPush, imports: [ @@ -56,6 +58,12 @@ export class GfHomeOverviewComponent implements OnInit { protected readonly errors = signal([]); protected readonly hasImpersonationId = signal(false); protected readonly historicalDataItems = signal(null); + + // A line through only two points (e.g. the close of the previous day and + // now) is drawn as a misleading slope across the whole width + protected readonly hasEnoughChartData = computed(() => { + return (this.historicalDataItems()?.length ?? 0) >= MINIMUM_CHART_ITEMS; + }); protected readonly holdings = signal( undefined ); diff --git a/apps/client/src/app/components/home-overview/home-overview.html b/apps/client/src/app/components/home-overview/home-overview.html index 64789ddc7d..1d1110dc9e 100644 --- a/apps/client/src/app/components/home-overview/home-overview.html +++ b/apps/client/src/app/components/home-overview/home-overview.html @@ -72,7 +72,7 @@ unit="%" [class.pe-3]="deviceType() === 'mobile'" [colorScheme]="user()?.settings?.colorScheme" - [hidden]="historicalDataItems()?.length === 0" + [hidden]="!hasEnoughChartData()" [historicalDataItems]="historicalDataItems()" [isAnimated]="user()?.settings?.dateRange === '1d' ? false : true" [label]="performanceLabel"