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.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,8 +618,10 @@ 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);
624
626
  }
625
627
  });
@@ -8082,19 +8084,23 @@ const EChartsUtilsAll = {
8082
8084
  let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName;
8083
8085
  let legendData = [], seriesData = [];
8084
8086
  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
- });
8087
+ // 排除x轴和y轴所有数据都为0的
8088
+ if (xDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/') &&
8089
+ yDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/')) {
8090
+ legendData.push(item.legend);
8091
+ seriesData.push({
8092
+ name: item.legend,
8093
+ type: 'line',
8094
+ data: xDataArr[0].filter((x) => x != 0 && x != null && x != undefined && x != '/').map((x, idx) => [x, yDataArr[index][idx]]),
8095
+ symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
8096
+ lineStyle: {
8097
+ color: item.lineColor,
8098
+ // width: 2,
8099
+ type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
8100
+ },
8101
+ smooth: true, // 平滑曲线
8102
+ });
8103
+ }
8098
8104
  });
8099
8105
  // 判断y轴数据是否为/、‘’、null、undefined或者没有数据
8100
8106
  let yValIsAllNull = false;
@@ -8158,7 +8164,7 @@ const EChartsUtilsAll = {
8158
8164
  name: 'X轴',
8159
8165
  min: 0, // 从 x=0 开始
8160
8166
  //max: xEnd, // 扩展到后推位置
8161
- interval: 30, // 设置刻度间隔为10
8167
+ //interval: 30, // 设置刻度间隔为10
8162
8168
  axisLine: { show: true },
8163
8169
  },
8164
8170
  yAxis: {
@@ -8468,9 +8474,9 @@ const EChartsUtilsAll = {
8468
8474
  if (!yValIsAllNull) {
8469
8475
  // 计算多项式回归系数(阶数为2)
8470
8476
  const coefficients = polynomialRegression(xData, yData, 2);
8471
- a = coefficients[2].toFixed(2);
8472
- b = coefficients[1].toFixed(2);
8473
- c = coefficients[0].toFixed(2);
8477
+ a = coefficients[2].toFixed(4);
8478
+ b = coefficients[1].toFixed(4);
8479
+ c = coefficients[0].toFixed(4);
8474
8480
  const minX = Math.min(...xData);
8475
8481
  const step = (maxX - minX) / 100;
8476
8482
  for (let x = minX; x <= maxX; x += step) {
@@ -8531,7 +8537,7 @@ const EChartsUtilsAll = {
8531
8537
  fontSize: 14,
8532
8538
  padding: [10, 0, 0, 0],
8533
8539
  },
8534
- interval: 0.05, // 设置刻度间隔为0.05
8540
+ //interval: 0.05, // 设置刻度间隔为0.05
8535
8541
  min: 0,
8536
8542
  max: maxX + 0.05,
8537
8543
  },