From ea62e698330cc0bf886e09648a763c37e6f8ff96 Mon Sep 17 00:00:00 2001 From: Graham McNeill Date: Tue, 10 Dec 2024 11:05:00 +0000 Subject: [PATCH] [Platform]: format values in sumstats popover (#615) --- packages/ui/src/components/SummaryStatsTable.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/SummaryStatsTable.tsx b/packages/ui/src/components/SummaryStatsTable.tsx index a548d3ea3..687a4554c 100644 --- a/packages/ui/src/components/SummaryStatsTable.tsx +++ b/packages/ui/src/components/SummaryStatsTable.tsx @@ -24,6 +24,10 @@ const dicSummary = [ }, ]; +function formatValue(v: number) { + return Number.isInteger(v) ? v.toLocaleString() : v.toPrecision(3); +} + export default function SummaryStatsTable({ sumstatQCValues }: any) { return ( <> @@ -44,7 +48,7 @@ export default function SummaryStatsTable({ sumstatQCValues }: any) { - {summStatValue} + {formatValue(summStatValue)} );