mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 11:21:44 +08:00
fix(图表): 修复数值格式化遇到科学计数法时,数值无法完成格式化显示空的问题
This commit is contained in:
@@ -110,6 +110,10 @@ function retain(value, n) {
|
||||
if (!n) return Math.round(value)
|
||||
const tran = Math.round(value * Math.pow(10, n)) / Math.pow(10, n)
|
||||
let tranV = tran.toString()
|
||||
// 遇到科学计数法时用 toFixed(n) 转成普通小数字符串
|
||||
if (/e/i.test(tranV)) {
|
||||
tranV = tran.toFixed(n)
|
||||
}
|
||||
const newVal = tranV.indexOf('.')
|
||||
if (newVal < 0) {
|
||||
tranV += '.'
|
||||
|
||||
Reference in New Issue
Block a user