fix:修改当刻度为百分比时的 小数问题
This commit is contained in:
@@ -326,16 +326,18 @@ function asciiCompute(num,ascii,units,dot=2){
|
|||||||
if(!num && num!==0 && num!=='0'){
|
if(!num && num!==0 && num!=='0'){
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
num=Number(num)
|
num=Number(num);
|
||||||
let carry=0;
|
let carry=0;
|
||||||
if(num > 1){
|
if(num > 1){
|
||||||
let log=Math.log(num)/Math.log(ascii)
|
let log=Math.log(num)/Math.log(ascii);
|
||||||
carry = parseInt(log)
|
carry = parseInt(log)
|
||||||
num = num / Math.pow(ascii,carry)
|
num = num / Math.pow(ascii,carry)
|
||||||
}
|
}
|
||||||
if(Number.isInteger(num)){
|
if(Number.isInteger(num)){
|
||||||
|
console.log(num +' '+units[carry],dot);
|
||||||
return num +' '+units[carry];
|
return num +' '+units[carry];
|
||||||
}else{
|
}else{
|
||||||
|
console.log(num.toFixed(dot) +' '+units[carry],dot);
|
||||||
return num.toFixed(dot) +' '+units[carry];
|
return num.toFixed(dot) +' '+units[carry];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -655,7 +657,7 @@ export default {
|
|||||||
//console.log(value);
|
//console.log(value);
|
||||||
}
|
}
|
||||||
//console.log( Math.floor(value+1)/Math.pow(10,pow));
|
//console.log( Math.floor(value+1)/Math.pow(10,pow));
|
||||||
return Math.floor(value+1)/Math.pow(10,pow);
|
return Math.ceil(value+1)/Math.pow(10,pow);
|
||||||
}
|
}
|
||||||
if(type ==='Time'){
|
if(type ==='Time'){
|
||||||
return value
|
return value
|
||||||
@@ -721,6 +723,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Interval:function(value,copies,type,interValType){
|
Interval:function(value,copies,type,interValType){
|
||||||
|
if(interValType==='max'&&value<1){
|
||||||
|
if(value<1){
|
||||||
|
value=1;
|
||||||
|
}
|
||||||
|
return value?value:1;
|
||||||
|
}
|
||||||
|
|
||||||
if(value<1024&&type==='Data'){
|
if(value<1024&&type==='Data'){
|
||||||
let interVal=value/copies;
|
let interVal=value/copies;
|
||||||
return interVal
|
return interVal
|
||||||
@@ -755,9 +764,6 @@ export default {
|
|||||||
interVal = interVal || 1;
|
interVal = interVal || 1;
|
||||||
return interVal
|
return interVal
|
||||||
}
|
}
|
||||||
if(interValType==='max'){
|
|
||||||
return value?value:1;
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
// let interVal=value/copies;
|
// let interVal=value/copies;
|
||||||
// interVal = interVal || 1;
|
// interVal = interVal || 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user