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 time unit (#1081)

Pranshu Chittora1a2ef4fde612
diff --git a/frontend/src/components/Graph/yAxisConfig.ts b/frontend/src/components/Graph/yAxisConfig.ts
index 0bb6cc9f64..839914f1ed 100644
--- a/frontend/src/components/Graph/yAxisConfig.ts
+++ b/frontend/src/components/Graph/yAxisConfig.ts
@@ -4,34 +4,39 @@ export const getYAxisFormattedValue = (
value: string,
format: string,
): string => {
- let numberValue: number = parseInt(value, 10);
let decimalPrecision: number | undefined;
+ const parsedValue = getValueFormat(format)(
+ parseFloat(value),
+ undefined,
+ undefined,
+ undefined,
+ );
try {
- const decimalSplitted = value.split('.');
+ const decimalSplitted = parsedValue.text.split('.');
if (decimalSplitted.length === 1) {
decimalPrecision = 0;
} 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') {
- nonZeroCtr += 1;
- if (nonZeroCtr >= 2) {
- decimalPrecision = idx + 1;
- break;
- }
+ decimalPrecision = idx + 1;
+ break;
}
}
- numberValue = parseFloat(value);
}
return formattedValueToString(
- getValueFormat(format)(numberValue, decimalPrecision, undefined, undefined),
+ getValueFormat(format)(
+ parseFloat(value),
+ decimalPrecision,
+ undefined,
+ undefined,
+ ),
);
} catch (error) {
console.error(error);
}
- return `${numberValue}`;
+ return `${parseFloat(value)}`;
};
export const getToolTipValue = (value: string, format: string): string => {