mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-30 13:42:00 +08:00
fix: y-axis generic time unit conversion (#1088)
* fix: y-axis generic time unit conversion
This commit is contained in:
parent
6fb6a576aa
commit
f5d10b72f0
@ -18,13 +18,20 @@ export const getYAxisFormattedValue = (
|
|||||||
} else {
|
} else {
|
||||||
const decimalDigits = decimalSplitted[1].split('');
|
const decimalDigits = decimalSplitted[1].split('');
|
||||||
decimalPrecision = decimalDigits.length;
|
decimalPrecision = decimalDigits.length;
|
||||||
|
let nonZeroCtr = 0;
|
||||||
for (let idx = 0; idx < decimalDigits.length; idx += 1) {
|
for (let idx = 0; idx < decimalDigits.length; idx += 1) {
|
||||||
if (decimalDigits[idx] !== '0') {
|
if (decimalDigits[idx] !== '0') {
|
||||||
decimalPrecision = idx + 1;
|
nonZeroCtr += 1;
|
||||||
|
if (nonZeroCtr >= 2) {
|
||||||
|
decimalPrecision = idx + 1;
|
||||||
|
}
|
||||||
|
} else if (nonZeroCtr) {
|
||||||
|
decimalPrecision = idx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return formattedValueToString(
|
return formattedValueToString(
|
||||||
getValueFormat(format)(
|
getValueFormat(format)(
|
||||||
parseFloat(value),
|
parseFloat(value),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user