NEZ-953 fix: 优化tooltip数字

This commit is contained in:
chenjinsong
2021-08-31 16:49:31 +08:00
parent aedc414fd6
commit 0e6a2a8a33
5 changed files with 23 additions and 51 deletions

View File

@@ -817,6 +817,14 @@ export function hideTableTooltip () {
dom.innerHTML = ''
}
/* 数字转换保留小数,数字很小时转为科学计数法, dot为保留几位小数 */
export function formatScientificNotation (value, dot = 2) {
let val = value ? parseFloat(Number(value).toFixed(dot)) : 0
if (val === 0) {
val = Number(value).toPrecision(dot + 1)
}
return val
}
/* function getTdDom(dom) {
let tagName = dom.tagName;
if (tagName.toLowerCase() === 'td') {