rapid-spreadjs 1.0.91 → 1.0.92

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 CHANGED
@@ -626,11 +626,11 @@ const SheetUtils = {
626
626
  // return GC.Spread.Sheets.CalcEngine.rangeToFormula(cellRange);
627
627
  },
628
628
  /**
629
- * 获取工作表中所有纯值或公式单元格的范围选择字符串
629
+ * 获取工作表中所有纯值、无值或公式单元格的范围选择字符串
630
630
  * @param sheet 工作表对象
631
- * @param isFormulaCells 是否获取公式单元格,默认为:false
631
+ * @param getType 获取类型(1:纯值、2:无值、3:公式),默认为:1
632
632
  */
633
- getCellsRangeStr: (sheet, isFormulaCells = false) => {
633
+ getCellsRangeStr: (sheet, getType = 1) => {
634
634
  const range = { row: 0, col: 1, rowCount: sheet.getRowCount(), colCount: 77 };
635
635
  // 所有单元格对象集合
636
636
  const allCells = SheetUtils.getAllCellObjsByRanges(sheet, [range]);
@@ -640,8 +640,10 @@ const SheetUtils = {
640
640
  allCells.forEach((cell) => {
641
641
  const value = sheet.getValue(cell.row, cell.col);
642
642
  const formula = sheet.getFormula(cell.row, cell.col);
643
- // 非公式+有值(非空) || 公式
644
- if ((!isFormulaCells && !formula && value !== null && value !== undefined && value !== '') || (isFormulaCells && formula)) {
643
+ // 非公式+有值(非空) || 无值 || 公式
644
+ if ((getType == 1 && !formula && value !== null && value !== undefined && value !== '') ||
645
+ (getType == 2 && (value == null || value == undefined || value == '')) ||
646
+ (getType == 3 && formula)) {
645
647
  retCells.push(cell);
646
648
  }
647
649
  });
@@ -8104,19 +8106,23 @@ const EChartsUtilsAll = {
8104
8106
  let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName;
8105
8107
  let legendData = [], seriesData = [];
8106
8108
  lineData.forEach((item, index) => {
8107
- legendData.push(item.legend);
8108
- seriesData.push({
8109
- name: item.legend,
8110
- type: 'line',
8111
- data: xDataArr[0].filter((x) => x != 0 && x != null && x != undefined && x != '/').map((x, idx) => [x, yDataArr[index][idx]]),
8112
- symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
8113
- lineStyle: {
8114
- color: item.lineColor,
8115
- // width: 2,
8116
- type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
8117
- },
8118
- smooth: true, // 平滑曲线
8119
- });
8109
+ // 排除x轴和y轴所有数据都为0的
8110
+ if (xDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/') &&
8111
+ yDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/')) {
8112
+ legendData.push(item.legend);
8113
+ seriesData.push({
8114
+ name: item.legend,
8115
+ type: 'line',
8116
+ data: xDataArr[0].filter((x) => x != 0 && x != null && x != undefined && x != '/').map((x, idx) => [x, yDataArr[index][idx]]),
8117
+ symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
8118
+ lineStyle: {
8119
+ color: item.lineColor,
8120
+ // width: 2,
8121
+ type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
8122
+ },
8123
+ smooth: true, // 平滑曲线
8124
+ });
8125
+ }
8120
8126
  });
8121
8127
  // 判断y轴数据是否为/、‘’、null、undefined或者没有数据
8122
8128
  let yValIsAllNull = false;
@@ -8180,7 +8186,7 @@ const EChartsUtilsAll = {
8180
8186
  name: 'X轴',
8181
8187
  min: 0, // 从 x=0 开始
8182
8188
  //max: xEnd, // 扩展到后推位置
8183
- interval: 30, // 设置刻度间隔为10
8189
+ //interval: 30, // 设置刻度间隔为10
8184
8190
  axisLine: { show: true },
8185
8191
  },
8186
8192
  yAxis: {
@@ -8490,9 +8496,9 @@ const EChartsUtilsAll = {
8490
8496
  if (!yValIsAllNull) {
8491
8497
  // 计算多项式回归系数(阶数为2)
8492
8498
  const coefficients = polynomialRegression(xData, yData, 2);
8493
- a = coefficients[2].toFixed(2);
8494
- b = coefficients[1].toFixed(2);
8495
- c = coefficients[0].toFixed(2);
8499
+ a = coefficients[2].toFixed(4);
8500
+ b = coefficients[1].toFixed(4);
8501
+ c = coefficients[0].toFixed(4);
8496
8502
  const minX = Math.min(...xData);
8497
8503
  const step = (maxX - minX) / 100;
8498
8504
  for (let x = minX; x <= maxX; x += step) {
@@ -8553,7 +8559,7 @@ const EChartsUtilsAll = {
8553
8559
  fontSize: 14,
8554
8560
  padding: [10, 0, 0, 0],
8555
8561
  },
8556
- interval: 0.05, // 设置刻度间隔为0.05
8562
+ //interval: 0.05, // 设置刻度间隔为0.05
8557
8563
  min: 0,
8558
8564
  max: maxX + 0.05,
8559
8565
  },