From bcbe7417157d90961cb03c216fabbe412bfabfe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CSebastian?= <64795732+slegarraga@users.noreply.github.com> Date: Thu, 6 Aug 2026 01:18:06 -0400 Subject: [PATCH 1/3] feat: add data decimation option to line chart --- CHANGELOG.md | 1 + libs/ui/src/lib/line-chart/line-chart.component.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be20727bd..4bcb86fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the platform logo to the platform selector in the create or update account dialog - Added the platform logo to the account selector in the create or update activity dialog - Extended the value component by an `isLoading` attribute to distinguish the loading state from redacted values +- Added the option to enable data decimation in the line chart component ### Changed 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 edc377fa3..9a3b18c2e 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -23,6 +23,7 @@ import { import { type AnimationsSpec, Chart, + Decimation, Filler, LinearScale, LineController, @@ -54,6 +55,7 @@ export class GfLineChartComponent @Input() benchmarkLabel = ''; @Input() colorScheme: ColorScheme; @Input() currency: string; + @Input() dataDecimation = false; @Input() historicalDataItems: LineChartItem[]; @Input() isAnimated = false; @Input() label: string; @@ -78,6 +80,7 @@ export class GfLineChartComponent public constructor(private changeDetectorRef: ChangeDetectorRef) { Chart.register( + Decimation, Filler, LineController, LineElement, @@ -183,6 +186,9 @@ export class GfLineChartComponent this.chart.options.plugins ??= {}; this.chart.options.plugins.tooltip = this.getTooltipPluginConfiguration(); + this.chart.options.plugins.decimation = this.dataDecimation + ? { algorithm: 'lttb', enabled: true } + : undefined; this.chart.options.animations = this.isAnimated ? animations : undefined; @@ -202,6 +208,9 @@ export class GfLineChartComponent }, interaction: { intersect: false, mode: 'index' }, plugins: { + decimation: this.dataDecimation + ? { algorithm: 'lttb', enabled: true } + : undefined, legend: { align: 'start', display: this.showLegend, From 39c2034ff66d8239f188a2a9091e6c5d33e550f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CSebastian?= <64795732+slegarraga@users.noreply.github.com> Date: Thu, 6 Aug 2026 07:02:37 -0400 Subject: [PATCH 2/3] fix: display cryptocurrency quantities with asset precision in holdings table --- .../holdings-table.component.html | 2 +- .../holdings-table.component.ts | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.html b/libs/ui/src/lib/holdings-table/holdings-table.component.html index e66dac725..6ffeb8442 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.html +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.html @@ -80,9 +80,9 @@ >
diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.ts b/libs/ui/src/lib/holdings-table/holdings-table.component.ts index 7fe21720e..8128c4dee 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.ts +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.ts @@ -1,3 +1,4 @@ +import { NUMERICAL_PRECISION_THRESHOLD_6_FIGURES } from '@ghostfolio/common/config'; import { canOpenHoldingDetail, getLocale, @@ -7,6 +8,7 @@ import { AssetProfileIdentifier, PortfolioPosition } from '@ghostfolio/common/interfaces'; +import { AssetSubClass } from '@prisma/client'; import { CUSTOM_ELEMENTS_SCHEMA, @@ -103,6 +105,28 @@ export class GfHoldingsTableComponent { return this.hasPermissionToOpenDetails() && canOpenHoldingDetail(holding); } + protected getQuantityPrecision(holding: PortfolioPosition): number { + if (Number.isInteger(holding.quantity)) { + return 0; + } + + if (holding.assetProfile.assetSubClass === AssetSubClass.CRYPTOCURRENCY) { + if (holding.quantity < 10) { + return 8; + } + + if (holding.quantity < 1000) { + return 6; + } + + if (holding.quantity >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES) { + return 0; + } + } + + return 2; + } + protected onOpenHoldingDialog({ dataSource, symbol From b4d6f388a60cf435f27c181acb6565caa9a90910 Mon Sep 17 00:00:00 2001 From: Sebastian Legarraga <64795732+slegarraga@users.noreply.github.com> Date: Thu, 6 Aug 2026 07:26:52 -0400 Subject: [PATCH 3/3] fix: satisfy formatting check --- libs/ui/src/lib/holdings-table/holdings-table.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.ts b/libs/ui/src/lib/holdings-table/holdings-table.component.ts index 8128c4dee..372939c5e 100644 --- a/libs/ui/src/lib/holdings-table/holdings-table.component.ts +++ b/libs/ui/src/lib/holdings-table/holdings-table.component.ts @@ -8,7 +8,6 @@ import { AssetProfileIdentifier, PortfolioPosition } from '@ghostfolio/common/interfaces'; -import { AssetSubClass } from '@prisma/client'; import { CUSTOM_ELEMENTS_SCHEMA, @@ -26,6 +25,7 @@ import { MatDialogModule } from '@angular/material/dialog'; import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator'; import { MatSort, MatSortModule } from '@angular/material/sort'; import { MatTableDataSource, MatTableModule } from '@angular/material/table'; +import { AssetSubClass } from '@prisma/client'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { GfEntityLogoComponent } from '../entity-logo/entity-logo.component';