rapid-spreadjs 1.0.190 → 1.0.191

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
@@ -5331,13 +5331,13 @@ const EChartsUtilsAll = {
5331
5331
  chart50: (config, xDataArr, yDataArr) => {
5332
5332
  let lineData = JSON.parse(config.chartLinesJson);
5333
5333
  let title = '', xName = config.chartXName, yName = config.chartYName;
5334
- // 判断某个子数组的值是否全部为 "/" 或 null(即该条线无任何有效数据)
5334
+ // 判断某个子数组的值是否全部为 "/"、null、空串或 0(即该条线无任何有效数据)
5335
5335
  const isAllEmpty = (arr) => {
5336
5336
  if (!Array.isArray(arr))
5337
5337
  return true;
5338
5338
  if (arr.length === 0)
5339
5339
  return true;
5340
- return arr.every((v) => v == null || v === '/' || v === '');
5340
+ return arr.every((v) => v == null || v === '/' || v === '' || v === 0);
5341
5341
  };
5342
5342
  // 同步过滤:将 yDataArr 中“值全为空”的子数组剔除,同时按索引对应剔除 lineData 中同一条线配置,
5343
5343
  // 保证剩余的线其图例名/颜色与 y 数据一一对应
@@ -5389,8 +5389,11 @@ const EChartsUtilsAll = {
5389
5389
  }
5390
5390
  // 若任意一条线存在非空值,则按“所有线均非空”过滤出有效点;否则保留全部点(与 chart50 上限/下限过滤逻辑保持语义一致)
5391
5391
  const hasAnyValid = nullCounts.some((cnt, i) => cnt < (filteredYDataArr[i] || []).length);
5392
+ // 过滤后的 x 原始值(与过滤后的 y 一一对应,避免 x/y 长度错位)
5393
+ const validXValues = [];
5392
5394
  allData.forEach((item) => {
5393
5395
  if (!hasAnyValid) {
5396
+ validXValues.push(item.x);
5394
5397
  for (let i = 0; i < lineCount; i++) {
5395
5398
  yDataSources[i].push(item['y' + i]);
5396
5399
  }
@@ -5406,6 +5409,7 @@ const EChartsUtilsAll = {
5406
5409
  }
5407
5410
  }
5408
5411
  if (allValid) {
5412
+ validXValues.push(item.x);
5409
5413
  for (let i = 0; i < lineCount; i++) {
5410
5414
  yDataSources[i].push(item['y' + i]);
5411
5415
  }
@@ -5415,16 +5419,16 @@ const EChartsUtilsAll = {
5415
5419
  let xData = [];
5416
5420
  let markLineData = [];
5417
5421
  // x和y轴的字体大小
5418
- const xyFontSize = 10;
5419
- // 组装 x 轴与 markLine(所有线共用同一套 x 值)
5420
- xDataSourceOld.forEach((item, index) => {
5422
+ const xFontSize = 8, yFontSize = 10;
5423
+ // 组装 x 轴与 markLine(基于过滤后的 x,与 y 数据一一对应)
5424
+ validXValues.forEach((item, index) => {
5421
5425
  const val045 = Number(EChartsUtilsComm.getRound(item ** 0.45, 0.001));
5422
5426
  markLineData.push({
5423
5427
  name: item + '',
5424
5428
  xAxis: val045,
5425
5429
  label: {
5426
- show: xDataSourceOld.length >= 6 && index % 2 != 0 && index < 6 ? false : true,
5427
- fontSize: xyFontSize,
5430
+ show: validXValues.length >= 6 && index % 2 != 0 && index < 6 ? false : true,
5431
+ fontSize: xFontSize,
5428
5432
  },
5429
5433
  });
5430
5434
  xData.push(val045);
@@ -5448,7 +5452,7 @@ const EChartsUtilsAll = {
5448
5452
  let obj = {
5449
5453
  name: name,
5450
5454
  type: 'line',
5451
- smooth: true,
5455
+ // smooth: true,
5452
5456
  symbol: symbol,
5453
5457
  symbolSize: 5,
5454
5458
  z: 10,
@@ -5465,6 +5469,9 @@ const EChartsUtilsAll = {
5465
5469
  symbol: '',
5466
5470
  silent: true,
5467
5471
  label: {
5472
+ fontSize: 18,
5473
+ rotate: 45,
5474
+ padding: [8, 0, 0, 0],
5468
5475
  position: 'start',
5469
5476
  formatter: (data) => {
5470
5477
  return data.name;
@@ -5550,7 +5557,7 @@ const EChartsUtilsAll = {
5550
5557
  show: true,
5551
5558
  text: xName,
5552
5559
  left: 'center',
5553
- bottom: 0,
5560
+ bottom: -5,
5554
5561
  textStyle: {
5555
5562
  fontSize: 12,
5556
5563
  fontWeight: 'normal',
@@ -5575,8 +5582,8 @@ const EChartsUtilsAll = {
5575
5582
  // max: xData.length > 0 ? xData[xData.length - 1] + 0.1 : null,
5576
5583
  min: xData.length > 0 ? (Math.min(...xData) > 0.2 ? Math.min(...xData) - 0.2 : 0) : null,
5577
5584
  max: xData.length > 0 ? Math.max(...xData) + 0.2 : null,
5578
- // 控制x轴是否为反方向,如果x轴录入的数据从左到右为从大到小的顺序,则开启反方向
5579
- inverse: xData.length > 0 ? (xData[0] > xData[xData.length - 1] ? true : false) : false,
5585
+ // // 控制x轴是否为反方向,如果x轴录入的数据从左到右为从大到小的顺序,则开启反方向
5586
+ // inverse: xData.length > 0 ? (xData[0] > xData[xData.length - 1] ? true : false) : false
5580
5587
  },
5581
5588
  yAxis: [
5582
5589
  {
@@ -5596,7 +5603,7 @@ const EChartsUtilsAll = {
5596
5603
  max: 100,
5597
5604
  splitNumber: 10,
5598
5605
  axisLabel: {
5599
- fontSize: xyFontSize,
5606
+ fontSize: yFontSize,
5600
5607
  },
5601
5608
  },
5602
5609
  ],