rapid-spreadjs 1.0.91 → 1.0.93

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.esm.js CHANGED
@@ -604,11 +604,11 @@ const SheetUtils = {
604
604
  // return GC.Spread.Sheets.CalcEngine.rangeToFormula(cellRange);
605
605
  },
606
606
  /**
607
- * 获取工作表中所有纯值或公式单元格的范围选择字符串
607
+ * 获取工作表中所有纯值、无值或公式单元格的范围选择字符串
608
608
  * @param sheet 工作表对象
609
- * @param isFormulaCells 是否获取公式单元格,默认为:false
609
+ * @param getType 获取类型(1:纯值、2:无值、3:公式),默认为:1
610
610
  */
611
- getCellsRangeStr: (sheet, isFormulaCells = false) => {
611
+ getCellsRangeStr: (sheet, getType = 1) => {
612
612
  const range = { row: 0, col: 1, rowCount: sheet.getRowCount(), colCount: 77 };
613
613
  // 所有单元格对象集合
614
614
  const allCells = SheetUtils.getAllCellObjsByRanges(sheet, [range]);
@@ -618,9 +618,15 @@ const SheetUtils = {
618
618
  allCells.forEach((cell) => {
619
619
  const value = sheet.getValue(cell.row, cell.col);
620
620
  const formula = sheet.getFormula(cell.row, cell.col);
621
- // 非公式+有值(非空) || 公式
622
- if ((!isFormulaCells && !formula && value !== null && value !== undefined && value !== '') || (isFormulaCells && formula)) {
621
+ // 非公式+有值(非空) || 无值 || 公式
622
+ if ((getType == 1 && !formula && value !== null && value !== undefined && value !== '') ||
623
+ (getType == 2 && (value == null || value == undefined || value == '')) ||
624
+ (getType == 3 && formula)) {
623
625
  retCells.push(cell);
626
+ // 如果为无值类型,则设置单元格格式为文本格式
627
+ if (getType == 2 && (value == null || value == undefined || value == '')) {
628
+ sheet.setFormatter(0, 0, '@');
629
+ }
624
630
  }
625
631
  });
626
632
  // 辅助函数:将列索引转为大写字母(如 0->A, 1->B, 26->AA)
@@ -8082,19 +8088,23 @@ const EChartsUtilsAll = {
8082
8088
  let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName;
8083
8089
  let legendData = [], seriesData = [];
8084
8090
  lineData.forEach((item, index) => {
8085
- legendData.push(item.legend);
8086
- seriesData.push({
8087
- name: item.legend,
8088
- type: 'line',
8089
- data: xDataArr[0].filter((x) => x != 0 && x != null && x != undefined && x != '/').map((x, idx) => [x, yDataArr[index][idx]]),
8090
- symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
8091
- lineStyle: {
8092
- color: item.lineColor,
8093
- // width: 2,
8094
- type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
8095
- },
8096
- smooth: true, // 平滑曲线
8097
- });
8091
+ // 排除x轴和y轴所有数据都为0的
8092
+ if (xDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/') &&
8093
+ yDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/')) {
8094
+ legendData.push(item.legend);
8095
+ seriesData.push({
8096
+ name: item.legend,
8097
+ type: 'line',
8098
+ data: xDataArr[0].filter((x) => x != 0 && x != null && x != undefined && x != '/').map((x, idx) => [x, yDataArr[index][idx]]),
8099
+ symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
8100
+ lineStyle: {
8101
+ color: item.lineColor,
8102
+ // width: 2,
8103
+ type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
8104
+ },
8105
+ smooth: true, // 平滑曲线
8106
+ });
8107
+ }
8098
8108
  });
8099
8109
  // 判断y轴数据是否为/、‘’、null、undefined或者没有数据
8100
8110
  let yValIsAllNull = false;
@@ -8158,7 +8168,7 @@ const EChartsUtilsAll = {
8158
8168
  name: 'X轴',
8159
8169
  min: 0, // 从 x=0 开始
8160
8170
  //max: xEnd, // 扩展到后推位置
8161
- interval: 30, // 设置刻度间隔为10
8171
+ //interval: 30, // 设置刻度间隔为10
8162
8172
  axisLine: { show: true },
8163
8173
  },
8164
8174
  yAxis: {
@@ -8468,9 +8478,9 @@ const EChartsUtilsAll = {
8468
8478
  if (!yValIsAllNull) {
8469
8479
  // 计算多项式回归系数(阶数为2)
8470
8480
  const coefficients = polynomialRegression(xData, yData, 2);
8471
- a = coefficients[2].toFixed(2);
8472
- b = coefficients[1].toFixed(2);
8473
- c = coefficients[0].toFixed(2);
8481
+ a = coefficients[2].toFixed(4);
8482
+ b = coefficients[1].toFixed(4);
8483
+ c = coefficients[0].toFixed(4);
8474
8484
  const minX = Math.min(...xData);
8475
8485
  const step = (maxX - minX) / 100;
8476
8486
  for (let x = minX; x <= maxX; x += step) {
@@ -8531,7 +8541,7 @@ const EChartsUtilsAll = {
8531
8541
  fontSize: 14,
8532
8542
  padding: [10, 0, 0, 0],
8533
8543
  },
8534
- interval: 0.05, // 设置刻度间隔为0.05
8544
+ //interval: 0.05, // 设置刻度间隔为0.05
8535
8545
  min: 0,
8536
8546
  max: maxX + 0.05,
8537
8547
  },