rapid-spreadjs 1.0.186 → 1.0.188
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 +34 -14
- 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 +34 -14
- 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/dist/utils/echarts-all.d.ts +1 -105
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5328,8 +5328,32 @@ const EChartsUtilsAll = {
|
|
|
5328
5328
|
chart50: (config, xDataArr, yDataArr) => {
|
|
5329
5329
|
let lineData = JSON.parse(config.chartLinesJson);
|
|
5330
5330
|
let title = '', xName = config.chartXName, yName = config.chartYName;
|
|
5331
|
-
//
|
|
5332
|
-
const
|
|
5331
|
+
// 判断某个子数组的值是否全部为 "/" 或 null(即该条线无任何有效数据)
|
|
5332
|
+
const isAllEmpty = (arr) => {
|
|
5333
|
+
if (!Array.isArray(arr))
|
|
5334
|
+
return true;
|
|
5335
|
+
if (arr.length === 0)
|
|
5336
|
+
return true;
|
|
5337
|
+
return arr.every((v) => v == null || v === '/' || v === '');
|
|
5338
|
+
};
|
|
5339
|
+
// 同步过滤:将 yDataArr 中“值全为空”的子数组剔除,同时按索引对应剔除 lineData 中同一条线配置,
|
|
5340
|
+
// 保证剩余的线其图例名/颜色与 y 数据一一对应
|
|
5341
|
+
const validIndexes = [];
|
|
5342
|
+
for (let i = 0; i < yDataArr.length; i++) {
|
|
5343
|
+
if (!isAllEmpty(yDataArr[i])) {
|
|
5344
|
+
validIndexes.push(i);
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5347
|
+
const filteredYDataArr = validIndexes.map((i) => yDataArr[i]);
|
|
5348
|
+
const filteredLineData = Array.isArray(lineData) ? validIndexes.map((i) => lineData[i]) : [];
|
|
5349
|
+
// 折线数量:以过滤后实际有数据的线条数为准
|
|
5350
|
+
const lineCount = filteredYDataArr.length;
|
|
5351
|
+
// 后续统一使用过滤后的数据
|
|
5352
|
+
lineData = filteredLineData;
|
|
5353
|
+
// 没有任何有效数据时,直接返回空配置,避免后续空数组访问报错
|
|
5354
|
+
if (lineCount === 0) {
|
|
5355
|
+
return {};
|
|
5356
|
+
}
|
|
5333
5357
|
// x轴原始数据(共享一份)
|
|
5334
5358
|
const xDataSourceOld = xDataArr[0];
|
|
5335
5359
|
const allData = [];
|
|
@@ -5337,7 +5361,7 @@ const EChartsUtilsAll = {
|
|
|
5337
5361
|
const point = { x: item };
|
|
5338
5362
|
// 将每条线的 y 值都收进同一个点对象,key 为 y0/y1/y2...
|
|
5339
5363
|
for (let i = 0; i < lineCount; i++) {
|
|
5340
|
-
point['y' + i] = (
|
|
5364
|
+
point['y' + i] = (filteredYDataArr[i] || [])[index];
|
|
5341
5365
|
}
|
|
5342
5366
|
allData.push(point);
|
|
5343
5367
|
});
|
|
@@ -5353,7 +5377,7 @@ const EChartsUtilsAll = {
|
|
|
5353
5377
|
const nullCounts = [];
|
|
5354
5378
|
for (let i = 0; i < lineCount; i++) {
|
|
5355
5379
|
let cnt = 0;
|
|
5356
|
-
(
|
|
5380
|
+
(filteredYDataArr[i] || []).forEach((item) => {
|
|
5357
5381
|
if (item == null || item == '/') {
|
|
5358
5382
|
cnt++;
|
|
5359
5383
|
}
|
|
@@ -5361,7 +5385,7 @@ const EChartsUtilsAll = {
|
|
|
5361
5385
|
nullCounts.push(cnt);
|
|
5362
5386
|
}
|
|
5363
5387
|
// 若任意一条线存在非空值,则按“所有线均非空”过滤出有效点;否则保留全部点(与 chart50 上限/下限过滤逻辑保持语义一致)
|
|
5364
|
-
const hasAnyValid = nullCounts.some((cnt, i) => cnt < (
|
|
5388
|
+
const hasAnyValid = nullCounts.some((cnt, i) => cnt < (filteredYDataArr[i] || []).length);
|
|
5365
5389
|
allData.forEach((item) => {
|
|
5366
5390
|
if (!hasAnyValid) {
|
|
5367
5391
|
for (let i = 0; i < lineCount; i++) {
|
|
@@ -23984,22 +24008,18 @@ const FormulaUtils = {
|
|
|
23984
24008
|
optional: false,
|
|
23985
24009
|
},
|
|
23986
24010
|
{
|
|
23987
|
-
name: '
|
|
23988
|
-
repeatable: false,
|
|
23989
|
-
optional: false,
|
|
23990
|
-
},
|
|
23991
|
-
{
|
|
23992
|
-
name: '目标点y坐标',
|
|
24011
|
+
name: '目标点坐标,格式如 (3.5,6.5)',
|
|
23993
24012
|
repeatable: false,
|
|
23994
24013
|
optional: false,
|
|
23995
24014
|
},
|
|
23996
24015
|
],
|
|
23997
24016
|
funCallback: (spread, sheet, retData) => {
|
|
23998
|
-
// 如果传递的参数小于
|
|
23999
|
-
if (retData.allCellVals.length <
|
|
24017
|
+
// 如果传递的参数小于2个,则返回/
|
|
24018
|
+
if (retData.allCellVals.length < 2) {
|
|
24000
24019
|
return '/';
|
|
24001
24020
|
}
|
|
24002
|
-
|
|
24021
|
+
const pointStrArr = retData.allCellVals[1].replace('(', '').replace(')', '').split(',');
|
|
24022
|
+
let points = retData.allCellVals[0], xPoint = pointStrArr[0], yPoint = pointStrArr[1];
|
|
24003
24023
|
// 1. 格式校验
|
|
24004
24024
|
if (typeof points !== 'string' || !points)
|
|
24005
24025
|
return '/';
|