rapid-spreadjs 1.0.182 → 1.0.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +98 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +98 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5227,6 +5227,17 @@ const EChartsUtilsAll = {
|
|
|
5227
5227
|
yAxisMax = null;
|
|
5228
5228
|
seriesData = [];
|
|
5229
5229
|
}
|
|
5230
|
+
let yMinVal = 0, yMaxVal = 0;
|
|
5231
|
+
let allYVal = [];
|
|
5232
|
+
if (seriesData.length > 0) {
|
|
5233
|
+
seriesData.forEach((item) => {
|
|
5234
|
+
item.data.forEach((itemData) => {
|
|
5235
|
+
allYVal.push(itemData.value[1]);
|
|
5236
|
+
});
|
|
5237
|
+
});
|
|
5238
|
+
yMinVal = Number(EChartsUtilsComm.getRound(Math.min(...allYVal) - 0.02, 0.01));
|
|
5239
|
+
yMaxVal = Number(EChartsUtilsComm.getRound(Math.max(...allYVal) + 0.02, 0.01));
|
|
5240
|
+
}
|
|
5230
5241
|
let option = {
|
|
5231
5242
|
grid: {
|
|
5232
5243
|
// show: true,//是否显示外边框线
|
|
@@ -5293,8 +5304,8 @@ const EChartsUtilsAll = {
|
|
|
5293
5304
|
yAxis: [
|
|
5294
5305
|
{
|
|
5295
5306
|
type: 'value',
|
|
5296
|
-
max: !yValIsAllNull ?
|
|
5297
|
-
min: !yValIsAllNull ?
|
|
5307
|
+
max: !yValIsAllNull ? yMaxVal : 0,
|
|
5308
|
+
min: !yValIsAllNull ? yMinVal : 0,
|
|
5298
5309
|
name: yName,
|
|
5299
5310
|
nameGap: !yValIsAllNull ? 40 : 25,
|
|
5300
5311
|
nameRotate: 90,
|
|
@@ -16769,6 +16780,79 @@ const FormulaUtils = {
|
|
|
16769
16780
|
// return calcVal(retArrVals[0], accuracy);
|
|
16770
16781
|
},
|
|
16771
16782
|
},
|
|
16783
|
+
{
|
|
16784
|
+
funName: 'YJROUNDKX',
|
|
16785
|
+
funDesc: '计算科学计数修约',
|
|
16786
|
+
funDefaultVal: null,
|
|
16787
|
+
funParams: [
|
|
16788
|
+
{
|
|
16789
|
+
name: '数值',
|
|
16790
|
+
repeatable: false,
|
|
16791
|
+
optional: false,
|
|
16792
|
+
},
|
|
16793
|
+
{
|
|
16794
|
+
name: '修约位数',
|
|
16795
|
+
repeatable: false,
|
|
16796
|
+
optional: false,
|
|
16797
|
+
},
|
|
16798
|
+
],
|
|
16799
|
+
funCallback: (spread, sheet, retData) => {
|
|
16800
|
+
let symbol = '/';
|
|
16801
|
+
//如果传递的参数小于2个(第一个参数为修约的数值,第二个参数为修约位数),则返回符号
|
|
16802
|
+
if (retData.allCellVals.length < 2) {
|
|
16803
|
+
return symbol;
|
|
16804
|
+
}
|
|
16805
|
+
//判断要修约的值和精度是否为数字,不是则返回符号
|
|
16806
|
+
if (!FormulaUtils.commFun.isNumber(retData.allCellVals[0]) || !FormulaUtils.commFun.isNumber(retData.allCellVals[1])) {
|
|
16807
|
+
return symbol;
|
|
16808
|
+
}
|
|
16809
|
+
let retArrVals = FormulaUtils.commFun.convertToInt(retData.allCellVals);
|
|
16810
|
+
//修约位数(正式以配置中为优先级获取,如业务系统中就要根据配置来判断)
|
|
16811
|
+
let accuracy = Math.floor(retArrVals[1]);
|
|
16812
|
+
//小于等于0时,返回原始数据
|
|
16813
|
+
if (accuracy <= 0 || retArrVals[0] == 0) {
|
|
16814
|
+
return retArrVals[0];
|
|
16815
|
+
}
|
|
16816
|
+
/**
|
|
16817
|
+
* 将数字转换为统一的标准科学计数法表达字符串
|
|
16818
|
+
* @param {number} num - 需要转换的数字
|
|
16819
|
+
* @param {number} [digits] - 有效数字位数(默认自动推断)
|
|
16820
|
+
* @returns {string} 如 "1.34*10^-2"、"1.34"、"1.34*10³"
|
|
16821
|
+
*/
|
|
16822
|
+
const toScientificNotation = (num, digits) => {
|
|
16823
|
+
if (num === 0)
|
|
16824
|
+
return '0';
|
|
16825
|
+
if (!isFinite(num))
|
|
16826
|
+
return String(num);
|
|
16827
|
+
// 1. 确定有效数字位数:未指定时从原数推断
|
|
16828
|
+
if (digits === undefined) {
|
|
16829
|
+
const str = String(Math.abs(num));
|
|
16830
|
+
// 去除小数点和前导零,剩余即为有效数字
|
|
16831
|
+
digits = str.replace(/^0*\.?0*/, '').replace('.', '').length || 1;
|
|
16832
|
+
}
|
|
16833
|
+
// 2. 利用 toExponential 获取标准化系数和指数
|
|
16834
|
+
// 例如: (134).toExponential(2) => "1.34e+2"
|
|
16835
|
+
const expStr = num.toExponential(digits - 1);
|
|
16836
|
+
const [coefStr, expPart] = expStr.split('e');
|
|
16837
|
+
const exponent = parseInt(expPart, 10);
|
|
16838
|
+
// 3. 清理系数尾部多余的零(如 1.340 → 1.34)
|
|
16839
|
+
const coefficient = parseFloat(coefStr).toString();
|
|
16840
|
+
// 4. 根据指数值格式化输出
|
|
16841
|
+
if (exponent === 0) {
|
|
16842
|
+
// 指数为0:直接返回系数,如 "1.34"
|
|
16843
|
+
return coefficient;
|
|
16844
|
+
}
|
|
16845
|
+
// 上标映射表
|
|
16846
|
+
const superscripts = { '-': '⁻', '0': '⁰', '1': '¹', '2': '²', '3': '³', '4': '⁴', '5': '⁵', '6': '⁶', '7': '⁷', '8': '⁸', '9': '⁹' };
|
|
16847
|
+
const expDisplay = String(exponent)
|
|
16848
|
+
.split('')
|
|
16849
|
+
.map((ch) => superscripts[ch] || ch)
|
|
16850
|
+
.join('');
|
|
16851
|
+
return `${coefficient}*10${expDisplay}`;
|
|
16852
|
+
};
|
|
16853
|
+
return toScientificNotation(retArrVals[0], accuracy);
|
|
16854
|
+
},
|
|
16855
|
+
},
|
|
16772
16856
|
{
|
|
16773
16857
|
funName: 'YJDZ',
|
|
16774
16858
|
funDesc: '按照单元格点选顺序,优先提取最后一个有数据的单元格值',
|
|
@@ -19628,10 +19712,18 @@ const FormulaUtils = {
|
|
|
19628
19712
|
getddn.y2 = array_x[_index];
|
|
19629
19713
|
getddn.x = dn;
|
|
19630
19714
|
if (_index == array_y.length) {
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
|
|
19715
|
+
if (dn < array_y[0]) {
|
|
19716
|
+
getddn.x1 = array_y[_index - _index];
|
|
19717
|
+
getddn.x2 = array_y[_index - _index + 1];
|
|
19718
|
+
getddn.y1 = array_x[_index - _index];
|
|
19719
|
+
getddn.y2 = array_x[_index - _index + 1];
|
|
19720
|
+
}
|
|
19721
|
+
else {
|
|
19722
|
+
getddn.x1 = array_y[_index - 2];
|
|
19723
|
+
getddn.x2 = array_y[_index - 1];
|
|
19724
|
+
getddn.y1 = array_x[_index - 2];
|
|
19725
|
+
getddn.y2 = array_x[_index - 1];
|
|
19726
|
+
}
|
|
19635
19727
|
getddn.x = dn;
|
|
19636
19728
|
}
|
|
19637
19729
|
else if (_index == 0) {
|