Merge pull request #13703 from dataease/pr@dev-v2@chart-transDecimal-fix

fix(图表): 修复数值格式后的值出现-0或者-0.00(即负零)的问题,将视为0或者0.00 #13222
This commit is contained in:
jianneng-fit2cloud 2024-11-29 20:17:33 +08:00 committed by GitHub
commit ed6a8d1e4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,7 +51,11 @@ function transUnit(value, formatter) {
}
function transDecimal(value, formatter) {
return value.toFixed(formatter.decimalCount)
const resultV = value.toFixed(formatter.decimalCount)
if (Object.is(parseFloat(resultV), -0)) {
return resultV.slice(1)
}
return resultV
}
function transSeparatorAndSuffix(value, formatter) {