From 75f2a0e7b143022cdb4ccd1b19ed3d4d78863c71 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:19:54 +0200 Subject: [PATCH] Refactoring --- libs/ui/src/lib/treemap-chart/interfaces/interfaces.ts | 6 ++++++ libs/ui/src/lib/treemap-chart/treemap-chart.component.ts | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/ui/src/lib/treemap-chart/interfaces/interfaces.ts b/libs/ui/src/lib/treemap-chart/interfaces/interfaces.ts index 25ab884f0..108da438f 100644 --- a/libs/ui/src/lib/treemap-chart/interfaces/interfaces.ts +++ b/libs/ui/src/lib/treemap-chart/interfaces/interfaces.ts @@ -2,3 +2,9 @@ export interface ColorConfig { backgroundColor: string; fontColor: string; } + +export interface GetColorConfigParams { + annualizedNetPerformancePercent: number; + negativeNetPerformancePercentsRange: { max: number; min: number }; + positiveNetPerformancePercentsRange: { max: number; min: number }; +} diff --git a/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts b/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts index cf4fbd437..4247f04fb 100644 --- a/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts +++ b/libs/ui/src/lib/treemap-chart/treemap-chart.component.ts @@ -33,7 +33,7 @@ import { differenceInDays, max } from 'date-fns'; import { orderBy } from 'lodash'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; -import { ColorConfig } from './interfaces/interfaces'; +import { ColorConfig, GetColorConfigParams } from './interfaces/interfaces'; const { gray, green, red } = require('open-color'); @@ -85,11 +85,7 @@ export class GfTreemapChartComponent annualizedNetPerformancePercent, negativeNetPerformancePercentsRange, positiveNetPerformancePercentsRange - }: { - annualizedNetPerformancePercent: number; - negativeNetPerformancePercentsRange: { max: number; min: number }; - positiveNetPerformancePercentsRange: { max: number; min: number }; - }): ColorConfig { + }: GetColorConfigParams): ColorConfig { if (Math.abs(annualizedNetPerformancePercent) === 0) { return { backgroundColor: gray[3],