fix(图表): 修复数值格式化遇到科学计数法时,数值无法完成格式化显示空的问题

This commit is contained in:
jianneng-fit2cloud
2026-06-16 10:40:49 +08:00
committed by jianneng-fit2cloud
parent b666924fb6
commit ea0f6d6b95

View File

@@ -111,6 +111,10 @@ function retain(value, n) {
const tran = Math.round(value * Math.pow(10, n)) / Math.pow(10, n)
let tranV = tran.toString()
const newVal = tranV.indexOf('.')
// 遇到科学计数法时用 toFixed(n) 转成普通小数字符串
if (/e/i.test(tranV)) {
tranV = tran.toFixed(n)
}
if (newVal < 0) {
tranV += '.'
}