Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add decimation plugin to chart #2557

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added

- Added support for data decimation in the line chart component

### Changed

- Improved the check for duplicates in the preview step of the activities import (allow different accounts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<gf-line-chart
class="mb-4"
[colorScheme]="user?.settings?.colorScheme"
[dataDecimation]="true"
[historicalDataItems]="historicalDataItems"
[isAnimated]="true"
[locale]="locale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ <h4 i18n>Welcome to Ghostfolio</h4>
symbol="Performance"
unit="%"
[colorScheme]="user?.settings?.colorScheme"
[dataDecimation]="true"
[hidden]="historicalDataItems?.length === 0"
[historicalDataItems]="historicalDataItems"
[isAnimated]="user?.settings?.dateRange === '1d' ? false : true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
[benchmarkDataItems]="benchmarkDataItems"
[colorScheme]="data.colorScheme"
[currency]="SymbolProfile?.currency"
[dataDecimation]="true"
[historicalDataItems]="historicalDataItems"
[isAnimated]="true"
[locale]="data.locale"
Expand Down
6 changes: 6 additions & 0 deletions libs/ui/src/lib/line-chart/line-chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { LineChartItem } from '@ghostfolio/common/interfaces';
import { ColorScheme } from '@ghostfolio/common/types';
import {
Chart,
Decimation,
Filler,
LineController,
LineElement,
Expand All @@ -49,6 +50,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;
Expand All @@ -73,6 +75,7 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy {

public constructor(private changeDetectorRef: ChangeDetectorRef) {
Chart.register(
Decimation,
Filler,
LineController,
LineElement,
Expand Down Expand Up @@ -201,6 +204,9 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy {
},
interaction: { intersect: false, mode: 'index' },
plugins: <unknown>{
decimation: {
enabled: this.dataDecimation
},
legend: {
align: 'start',
display: this.showLegend,
Expand Down