rapid-spreadjs 1.0.71 → 1.0.73

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