From ad562f056a4976b484ae7f98da2eef8153f9b0c4 Mon Sep 17 00:00:00 2001 From: Jagadam Dinesh Reddy Date: Mon, 4 Sep 2023 12:52:52 +0530 Subject: [PATCH] fix: formatDataValues for values with 4 digits or more (#1083) --- src/filters.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/filters.ts b/src/filters.ts index 46016238..6aede8d3 100644 --- a/src/filters.ts +++ b/src/filters.ts @@ -24,7 +24,9 @@ export function formatDataValue(data: number, isBinary: boolean) { while (data >= base ** i) { i++ } - return toPrecision(data / base ** (i - 1), i > 1 ? 3 : 1) + let value = data / base ** (i - 1) + if (value > 999) return toPrecision(value,4) + return toPrecision(value, i > 1 ? 3 : 1) } Vue.filter('formatDataValue', formatDataValue)