refine only layout of code
This commit is contained in:
@@ -26,8 +26,12 @@ export function setLineChartData(baseData, xMax, xMin, isPercent, yMax, yMin) {
|
||||
let e = 2;
|
||||
let f = baseData[1].y;
|
||||
b = (e*d - a*d - f*a - f*c) / (e - c - a)
|
||||
if(isPercent) b = b >= 1 ? 1 : b <= 0 ? 0 : b;
|
||||
else b = b >= yMax ? yMax : b <= yMin ? yMin : b;
|
||||
if(isPercent) {
|
||||
b = b >= 1 ? 1 : b <= 0 ? 0 : b;
|
||||
}
|
||||
else {
|
||||
b = b >= yMax ? yMax : b <= yMin ? yMin : b;
|
||||
}
|
||||
|
||||
// y 軸最大值
|
||||
let ma = 9;
|
||||
@@ -37,10 +41,16 @@ export function setLineChartData(baseData, xMax, xMin, isPercent, yMax, yMin) {
|
||||
let me = 11;
|
||||
let mf;
|
||||
mf = (mb*me - mb*mc -md*me + md*ma) / (ma - mc);
|
||||
if(isPercent) mf = mf >= 1 ? 1 : mf <= 0 ? 0 : mf;
|
||||
else mf = mf >= yMax ? yMax : mf <= yMin ? yMin : mf;
|
||||
if(isPercent) {
|
||||
mf = mf >= 1 ? 1 : mf <= 0 ? 0 : mf;
|
||||
}
|
||||
else {
|
||||
mf = mf >= yMax ? yMax : mf <= yMin ? yMin : mf;
|
||||
}
|
||||
|
||||
// 添加最小值
|
||||
// The unshift() method of Array instances adds the specified elements to
|
||||
// the beginning of an array and returns the new length of the array.
|
||||
data.unshift({
|
||||
x: xMin,
|
||||
y: b,
|
||||
@@ -177,7 +187,9 @@ export function formatTime(seconds) {
|
||||
result += `${remainingSeconds}s`;
|
||||
|
||||
return result.trim(); // 去除最后一个空格
|
||||
} else return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 只顯示最大的兩個單位
|
||||
|
||||
Reference in New Issue
Block a user