rapid-spreadjs 1.0.71 → 1.0.72

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
@@ -8066,6 +8066,112 @@ const EChartsUtilsAll = {
8066
8066
  // console.log('计算值x =', x50.toFixed(2));
8067
8067
  return option;
8068
8068
  },
8069
+ /**
8070
+ * 电流I(mA)与时间t(min)关系图
8071
+ * @param config 折线配置
8072
+ * @param xDataArr x轴原始数据(二维数组)
8073
+ * @param yDataArr y轴原始数据(二维数组)
8074
+ * @returns 返回ECharts配置项
8075
+ */
8076
+ chart390: (config, xDataArr, yDataArr) => {
8077
+ let lineData = JSON.parse(config.chartLinesJson);
8078
+ let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName;
8079
+ let legendData = [], seriesData = [];
8080
+ lineData.forEach((item, index) => {
8081
+ legendData.push(item.legend);
8082
+ seriesData.push({
8083
+ name: item.legend,
8084
+ type: 'line',
8085
+ data: xDataArr[0].map((x, idx) => [x, yDataArr[index][idx]]),
8086
+ symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
8087
+ lineStyle: {
8088
+ color: item.lineColor,
8089
+ // width: 2,
8090
+ type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
8091
+ },
8092
+ smooth: true, // 平滑曲线
8093
+ });
8094
+ });
8095
+ // 判断y轴数据是否为/、‘’、null、undefined或者没有数据
8096
+ let yValIsAllNull = false;
8097
+ /*if(trendLineY.length==0){
8098
+ yValIsAllNull = true;
8099
+ }else{
8100
+ let noDataCount = 0;
8101
+
8102
+ trendLineY.forEach((item)=>{
8103
+ if(item==null || item ==undefined ||item=='/'||item==''){
8104
+ noDataCount ++;
8105
+ }
8106
+ });
8107
+
8108
+ if(noDataCount==trendLineY.length){
8109
+ yValIsAllNull = true;
8110
+ }
8111
+ }*/
8112
+ // 配置图表选项
8113
+ var option = {
8114
+ title: [
8115
+ {
8116
+ show: true,
8117
+ text: title,
8118
+ left: 'center',
8119
+ top: 5,
8120
+ textStyle: {
8121
+ fontSize: 12,
8122
+ fontWeight: 'normal',
8123
+ },
8124
+ },
8125
+ {
8126
+ show: true,
8127
+ text: xName,
8128
+ left: 'center',
8129
+ bottom: 0,
8130
+ textStyle: {
8131
+ fontSize: 12,
8132
+ fontWeight: 'normal',
8133
+ },
8134
+ },
8135
+ ],
8136
+ // 图例,参考文档:https://echarts.apache.org/zh/option.html#legend
8137
+ legend: {
8138
+ top: '2px',
8139
+ right: '5px',
8140
+ data: legendData,
8141
+ selectedMode: 'multiple', // 用于控制图例的选择模式(single:单选、multiple:多选、false:禁止选择)
8142
+ },
8143
+ grid: {
8144
+ // show: true,//是否显示外边框线
8145
+ // borderColor: '#f00',//外边框线颜色
8146
+ top: 25,
8147
+ left: !yValIsAllNull ? 25 : 25,
8148
+ right: 10,
8149
+ bottom: 20,
8150
+ containLabel: true,
8151
+ },
8152
+ xAxis: {
8153
+ type: 'value',
8154
+ name: 'X轴',
8155
+ min: 0, // 从 x=0 开始
8156
+ //max: xEnd, // 扩展到后推位置
8157
+ interval: 30, // 设置刻度间隔为10
8158
+ axisLine: { show: true },
8159
+ },
8160
+ yAxis: {
8161
+ type: 'value',
8162
+ name: yName,
8163
+ nameGap: !yValIsAllNull ? 30 : 5,
8164
+ nameRotate: 90,
8165
+ nameLocation: 'middle',
8166
+ min: 0, // 向下多显示 -10
8167
+ //max: Math.max(...yData) + 10, // 基于数据最大值
8168
+ interval: 10, // 设置刻度间隔为10
8169
+ axisLine: { show: true },
8170
+ },
8171
+ series: seriesData,
8172
+ };
8173
+ return option;
8174
+ },
8069
8175
  };
8070
8176
 
8071
8177
  /**
@@ -8314,6 +8420,9 @@ const EChartsUtils = {
8314
8420
  else if (config.chartType == 370) {
8315
8421
  option = EChartsUtilsAll.chart370(config, xDataArr, yDataArr, sheet);
8316
8422
  }
8423
+ else if (config.chartType == 390) {
8424
+ option = EChartsUtilsAll.chart390(config, xDataArr, yDataArr);
8425
+ }
8317
8426
  if (option && typeof option === 'object') {
8318
8427
  //如果是隐藏的图表,则需要禁用ECharts的动画效果
8319
8428
  //原因是:如果ECharts使用了动画效果,图表渲染完成可能需要0.5秒,但是在导出ECharts统计图为图片的场景下时,可能在图表还没有渲染完成(动画效果还没结束)前就要获取图像了,此时可能就会造成获取到的图像内容丢失的情况