我已经找到它用于 80:20 的计算。
首先,我从样条数据中找到了大于或等于 80 的系列中的第一个值。
i.e. >= 80
假设它是DataX
然后找出数组中的那个索引加上一个 for DataX
。
i.e. DataX location is DataIndex = index+1
(因为数组从第 0 个计算开始需要加一)
公式是
DataX : DataIndex :: 80: ?
let the question mark is xIndexOf80
然后 xIndexOf80 = (DataIndex *80)/(DataX )。
xIndexOf80 is nothing but position of 80 on X axis.
它会在 X 轴上为您提供准确的标记
function findInetrSectionPoint(arrSplineData) {
var intLen = arrSplineData.length;
for (var index = 0; index < intLen; index++) {
if (arrSplineData[index] >= 80) {
interSectPoint = ((index + 1) * 80) / arrSplineData[index] - 1;
break;
}
}
return interSectPoint;
}
这是Plunker