From cab0cd0492f7bc484e82b6fbce36a443ae004718 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Thu, 6 Apr 2023 19:37:38 +0200 Subject: [PATCH] Keep the value if value smaller than 1000 --- libs/common/src/lib/chart-helper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/common/src/lib/chart-helper.ts b/libs/common/src/lib/chart-helper.ts index 1befb1585..d4a5d75d9 100644 --- a/libs/common/src/lib/chart-helper.ts +++ b/libs/common/src/lib/chart-helper.ts @@ -131,5 +131,11 @@ export function getVerticalHoverLinePlugin( } export function transformTickToAbbreviation(value: number) { - return value < 1000000 ? `${value / 1000}K` : `${value / 1000000}M`; + if (value >= -999 && value <= 999) { + return value.toString(); + } else if (value >= -999999 && value <= 999999) { + return `${value / 1000}K`; + } else { + return `${value / 1000000}M`; + } }