Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: y-axis generic time unit conversion (#1088)

Pranshu Chittoraf5d10b72f09c
diff --git a/frontend/src/components/Graph/yAxisConfig.ts b/frontend/src/components/Graph/yAxisConfig.ts
index 839914f1ed..5d1eeb5da7 100644
--- a/frontend/src/components/Graph/yAxisConfig.ts
+++ b/frontend/src/components/Graph/yAxisConfig.ts
@@ -18,13 +18,20 @@ export const getYAxisFormattedValue = (
} else {
const decimalDigits = decimalSplitted[1].split('');
decimalPrecision = decimalDigits.length;
+ let nonZeroCtr = 0;
for (let idx = 0; idx < decimalDigits.length; idx += 1) {
if (decimalDigits[idx] !== '0') {
- decimalPrecision = idx + 1;
+ nonZeroCtr += 1;
+ if (nonZeroCtr >= 2) {
+ decimalPrecision = idx + 1;
+ }
+ } else if (nonZeroCtr) {
+ decimalPrecision = idx;
break;
}
}
}
+
return formattedValueToString(
getValueFormat(format)(
parseFloat(value),