NEZ-3435 fix: 修复科学计数法导致的Y轴显示错误
This commit is contained in:
@@ -188,6 +188,7 @@ export default {
|
|||||||
const self = this
|
const self = this
|
||||||
const leftUnit = this.chartInfo.unit
|
const leftUnit = this.chartInfo.unit
|
||||||
const leftUnitCompute = chartDataFormat.getUnit(leftUnit)
|
const leftUnitCompute = chartDataFormat.getUnit(leftUnit)
|
||||||
|
console.log(leftUnitCompute)
|
||||||
const rightUnit = this.$lodash.get(this.chartInfo, 'param.rightYAxis.unit', 2)
|
const rightUnit = this.$lodash.get(this.chartInfo, 'param.rightYAxis.unit', 2)
|
||||||
const rightUnitCompute = chartDataFormat.getUnit(rightUnit)
|
const rightUnitCompute = chartDataFormat.getUnit(rightUnit)
|
||||||
const incrs = leftUnitCompute.ascii == 1024 ? this.incrs : undefined
|
const incrs = leftUnitCompute.ascii == 1024 ? this.incrs : undefined
|
||||||
@@ -291,7 +292,10 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
scale: 'left',
|
scale: 'left',
|
||||||
values: (u, vals, space) => vals.map(v => leftUnitCompute.compute(v, null, -1, decimals) + ''),
|
values: (u, vals, space) => vals.map(v => {
|
||||||
|
console.log(v)
|
||||||
|
return leftUnitCompute.compute(v, null, -1, decimals) + ''
|
||||||
|
}),
|
||||||
incrs: incrs,
|
incrs: incrs,
|
||||||
gap: 5,
|
gap: 5,
|
||||||
stroke: self.color[self.theme].label,
|
stroke: self.color[self.theme].label,
|
||||||
|
|||||||
@@ -542,7 +542,10 @@ function asciiCompute (num, ascii, units, dot = 2, isBits = false) {
|
|||||||
num = Math.abs(num)
|
num = Math.abs(num)
|
||||||
let carry = 0
|
let carry = 0
|
||||||
if (num > 1) {
|
if (num > 1) {
|
||||||
const log = Math.log(num) / Math.log(ascii)
|
let log = Math.log(num) / Math.log(ascii)
|
||||||
|
if (!numberWithEConvent(log)) {
|
||||||
|
log = 0
|
||||||
|
}
|
||||||
carry = parseInt(log)
|
carry = parseInt(log)
|
||||||
num = num / Math.pow(ascii, carry)
|
num = num / Math.pow(ascii, carry)
|
||||||
}
|
}
|
||||||
@@ -554,6 +557,10 @@ function asciiCompute (num, ascii, units, dot = 2, isBits = false) {
|
|||||||
if (Number.isInteger(num)) {
|
if (Number.isInteger(num)) {
|
||||||
return num * SIGN + ' ' + units[carry]
|
return num * SIGN + ' ' + units[carry]
|
||||||
} else {
|
} else {
|
||||||
|
if (!numberWithEConvent(num)) {
|
||||||
|
console.log(units, carry)
|
||||||
|
return num * SIGN + ' ' + units[carry]
|
||||||
|
}
|
||||||
return num.toFixed(dot) * SIGN + ' ' + units[carry]
|
return num.toFixed(dot) * SIGN + ' ' + units[carry]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user