From be771f9d61d6ce9648bfb1f80a36020411b18cdf Mon Sep 17 00:00:00 2001 From: Dhoni77 Date: Sat, 28 Oct 2023 19:23:32 +0530 Subject: [PATCH 1/5] feat: add decimation plugin to chart --- libs/ui/src/lib/line-chart/line-chart.component.ts | 5 +++++ 1 file changed, 5 insertions(+) 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 c6eb68cec..45712dd63 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -49,6 +49,7 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { @Input() benchmarkLabel = ''; @Input() colorScheme: ColorScheme; @Input() currency: string; + @Input() dataDecimation = false; @Input() historicalDataItems: LineChartItem[]; @Input() isAnimated = false; @Input() locale: string; @@ -209,6 +210,10 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { tooltip: this.getTooltipPluginConfiguration(), verticalHoverLine: { color: `rgba(${getTextColor(this.colorScheme)}, 0.1)` + }, + decimation: { + enabled: this.dataDecimation, + algorithm: 'min-max' } }, scales: { From 97b3c089045be1d0e5cccbaec39d2f037926a4a4 Mon Sep 17 00:00:00 2001 From: Dhoni77 Date: Sun, 29 Oct 2023 09:36:08 +0530 Subject: [PATCH 2/5] chore: refactor code --- libs/ui/src/lib/line-chart/line-chart.component.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 45712dd63..33a04aebc 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -202,6 +202,9 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { }, interaction: { intersect: false, mode: 'index' }, plugins: { + decimation: { + enabled: this.dataDecimation + }, legend: { align: 'start', display: this.showLegend, @@ -210,10 +213,6 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { tooltip: this.getTooltipPluginConfiguration(), verticalHoverLine: { color: `rgba(${getTextColor(this.colorScheme)}, 0.1)` - }, - decimation: { - enabled: this.dataDecimation, - algorithm: 'min-max' } }, scales: { From 4981cfaf42ad11eaa38749c4dcd4a6c0487812c8 Mon Sep 17 00:00:00 2001 From: Dhoni77 Date: Sun, 29 Oct 2023 09:43:48 +0530 Subject: [PATCH 3/5] feat: add dataDecimation databindings --- .../admin-market-data-detail.component.html | 1 + apps/client/src/app/components/home-overview/home-overview.html | 1 + .../position/position-detail-dialog/position-detail-dialog.html | 1 + 3 files changed, 3 insertions(+) diff --git a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html index c6e972f45..348a6b548 100644 --- a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html +++ b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html @@ -2,6 +2,7 @@ Date: Sun, 29 Oct 2023 08:39:59 +0100 Subject: [PATCH 4/5] Register plugin --- libs/ui/src/lib/line-chart/line-chart.component.ts | 2 ++ 1 file changed, 2 insertions(+) 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 33a04aebc..09b7a0579 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -29,6 +29,7 @@ import { LineChartItem } from '@ghostfolio/common/interfaces'; import { ColorScheme } from '@ghostfolio/common/types'; import { Chart, + Decimation, Filler, LineController, LineElement, @@ -74,6 +75,7 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { public constructor(private changeDetectorRef: ChangeDetectorRef) { Chart.register( + Decimation, Filler, LineController, LineElement, From d21f00f0d5ac0e105ae1d941c373627ba061eabb Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sun, 29 Oct 2023 08:40:14 +0100 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec59301fa..13a7b85d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added support for data decimation in the line chart component + ## 2.15.0 - 2023-10-26 ### Added