Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(BigNumber): adjust decimal formatting to limit to a maximum of 3 decimal places (#7332)

marliessophie9ca861464406
diff --git a/web/src/features/widgets/chart-library/BigNumber.tsx b/web/src/features/widgets/chart-library/BigNumber.tsx
index e4d18f8c90..7dad68f59a 100644
--- a/web/src/features/widgets/chart-library/BigNumber.tsx
+++ b/web/src/features/widgets/chart-library/BigNumber.tsx
@@ -67,7 +67,9 @@ const formatBigNumber = (
)
: 2;
return {
- formatted: value.toFixed(decimals).replace(/\.?0+$/, ""),
+ formatted: value
+ .toFixed(Math.max(0, Math.min(3, decimals)))
+ .replace(/\.?0+$/, ""),
unit: "",
};
} else if (absValue > 0) {
@@ -84,7 +86,9 @@ const formatBigNumber = (
const decimals = Math.min(neededDecimals, maxAllowedDecimals, 8); // Max 8 decimal places
return {
- formatted: value.toFixed(decimals).replace(/\.?0+$/, ""),
+ formatted: value
+ .toFixed(Math.max(0, Math.min(3, decimals)))
+ .replace(/\.?0+$/, ""),
unit: "",
};
} else {