rapid-spreadjs 1.0.103 → 1.0.105
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 +335 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +335 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/utils/echarts-all.d.ts +150 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4071,6 +4071,40 @@ const EChartsUtilsAll = {
|
|
|
4071
4071
|
xDataSource2 = isTwoLine ? xDataArr[1] : [], // [1.5, 2.4, 3.6, 4.3, 5.4],
|
|
4072
4072
|
yDataSource1 = yDataArr[0], // [2.25, 2.29, 2.34, 2.29, 2.23],
|
|
4073
4073
|
yDataSource2 = isTwoLine ? yDataArr[1] : []; // [2.27, 2.32, 2.36, 2.33, 2.26];
|
|
4074
|
+
let xDataLs1 = [], yDataLs1 = [];
|
|
4075
|
+
xDataSource1.forEach((x, index) => {
|
|
4076
|
+
if (x != '/' &&
|
|
4077
|
+
x != 0 &&
|
|
4078
|
+
x != null &&
|
|
4079
|
+
x != undefined &&
|
|
4080
|
+
yDataSource1[index] != '/' &&
|
|
4081
|
+
yDataSource1[index] != 0 &&
|
|
4082
|
+
yDataSource1[index] != null &&
|
|
4083
|
+
yDataSource1[index] != undefined) {
|
|
4084
|
+
xDataLs1.push(x);
|
|
4085
|
+
yDataLs1.push(yDataSource1[index]);
|
|
4086
|
+
}
|
|
4087
|
+
});
|
|
4088
|
+
xDataSource1 = xDataLs1;
|
|
4089
|
+
yDataSource1 = yDataLs1;
|
|
4090
|
+
if (isTwoLine) {
|
|
4091
|
+
let xDataLs2 = [], yDataLs2 = [];
|
|
4092
|
+
xDataSource2.forEach((x, index) => {
|
|
4093
|
+
if (x != '/' &&
|
|
4094
|
+
x != 0 &&
|
|
4095
|
+
x != null &&
|
|
4096
|
+
x != undefined &&
|
|
4097
|
+
yDataSource2[index] != '/' &&
|
|
4098
|
+
yDataSource2[index] != 0 &&
|
|
4099
|
+
yDataSource2[index] != null &&
|
|
4100
|
+
yDataSource2[index] != undefined) {
|
|
4101
|
+
xDataLs2.push(x);
|
|
4102
|
+
yDataLs2.push(yDataSource2[index]);
|
|
4103
|
+
}
|
|
4104
|
+
});
|
|
4105
|
+
xDataSource2 = xDataLs2;
|
|
4106
|
+
yDataSource2 = yDataLs2;
|
|
4107
|
+
}
|
|
4074
4108
|
let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName, legendName = '图例1';
|
|
4075
4109
|
const lineFunc = (xDataSource, yDataSource, isShowMarkPoint, isShowMarkLine, isTwoLineData) => {
|
|
4076
4110
|
//原始数据
|
|
@@ -8612,7 +8646,7 @@ const EChartsUtilsAll = {
|
|
|
8612
8646
|
return option;
|
|
8613
8647
|
},
|
|
8614
8648
|
/**
|
|
8615
|
-
*
|
|
8649
|
+
* 土工合成材料(拉拔摩擦特性)
|
|
8616
8650
|
* @param config 折线配置
|
|
8617
8651
|
* @param xDataArr x轴原始数据(二维数组)
|
|
8618
8652
|
* @param yDataArr y轴原始数据(二维数组)
|
|
@@ -8779,6 +8813,303 @@ const EChartsUtilsAll = {
|
|
|
8779
8813
|
};
|
|
8780
8814
|
return option;
|
|
8781
8815
|
},
|
|
8816
|
+
/**
|
|
8817
|
+
* 土工合成材料(有效孔径)
|
|
8818
|
+
* @param config 折线配置
|
|
8819
|
+
* @param xDataArr x轴原始数据(二维数组)
|
|
8820
|
+
* @param yDataArr y轴原始数据(二维数组)
|
|
8821
|
+
* @returns 返回ECharts配置项
|
|
8822
|
+
*/
|
|
8823
|
+
chart470: (config, xDataArr, yDataArr, sheet) => {
|
|
8824
|
+
let lineData = JSON.parse(config.chartLinesJson);
|
|
8825
|
+
const chartExtJson = config.chartExtJson == null || config.chartExtJson == undefined ? null : JSON.parse(config.chartExtJson);
|
|
8826
|
+
let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName, color = lineData[0].lineColor;
|
|
8827
|
+
// 原始数据
|
|
8828
|
+
const xData = xDataArr[0];
|
|
8829
|
+
const yData = yDataArr[0];
|
|
8830
|
+
// 线性内插法函数:根据y值计算对应的x值
|
|
8831
|
+
function interpolateX(targetY, xData, yData) {
|
|
8832
|
+
// 查找目标y值所在区间
|
|
8833
|
+
for (let i = 0; i < yData.length - 1; i++) {
|
|
8834
|
+
if ((yData[i] >= targetY && yData[i + 1] <= targetY) || (yData[i] <= targetY && yData[i + 1] >= targetY)) {
|
|
8835
|
+
// 线性插值公式: x = x1 + (x2 - x1) * (targetY - y1) / (y2 - y1)
|
|
8836
|
+
const x1 = xData[i];
|
|
8837
|
+
const x2 = xData[i + 1];
|
|
8838
|
+
const y1 = yData[i];
|
|
8839
|
+
const y2 = yData[i + 1];
|
|
8840
|
+
return x1 + ((x2 - x1) * (targetY - y1)) / (y2 - y1);
|
|
8841
|
+
}
|
|
8842
|
+
}
|
|
8843
|
+
return null; // 如果目标y值不在数据范围内
|
|
8844
|
+
}
|
|
8845
|
+
// 计算y=5和y=10对应的x值
|
|
8846
|
+
const xAtY5 = interpolateX(5, xData, yData);
|
|
8847
|
+
const xAtY10 = interpolateX(10, xData, yData);
|
|
8848
|
+
// console.log('y=5时,x=' + (xAtY5 ? xAtY5 : ''));
|
|
8849
|
+
// console.log('y=10时,x=' + (xAtY10 ? xAtY10 : ''));
|
|
8850
|
+
let yValIsAllNull = false;
|
|
8851
|
+
if (xData.length == 0 ||
|
|
8852
|
+
yData.length == 0 ||
|
|
8853
|
+
(!xData.some((x) => x != '' && x != '/' && x != null && x != undefined) &&
|
|
8854
|
+
!yData.some((x) => x != '' && x != '/' && x != null && x != undefined))) {
|
|
8855
|
+
yValIsAllNull = true;
|
|
8856
|
+
}
|
|
8857
|
+
if (xData.filter((x) => x == 0).length == xData.length || yData.filter((x) => x == 0).length == yData.length) {
|
|
8858
|
+
yValIsAllNull = true;
|
|
8859
|
+
}
|
|
8860
|
+
// 输出x轴内插值
|
|
8861
|
+
if (chartExtJson != null) {
|
|
8862
|
+
if (chartExtJson.tghcclYxkj5 != null && chartExtJson.tghcclYxkj5 != undefined) {
|
|
8863
|
+
sheet.setValue(chartExtJson.tghcclYxkj5.row, chartExtJson.tghcclYxkj5.col, xAtY5 ? xAtY5 : '/');
|
|
8864
|
+
}
|
|
8865
|
+
if (chartExtJson.tghcclYxkj10 != null && chartExtJson.tghcclYxkj10 != undefined) {
|
|
8866
|
+
sheet.setValue(chartExtJson.tghcclYxkj10.row, chartExtJson.tghcclYxkj10.col, xAtY10 ? xAtY10 : '/');
|
|
8867
|
+
}
|
|
8868
|
+
}
|
|
8869
|
+
// 配置图表选项
|
|
8870
|
+
const option = {
|
|
8871
|
+
title: [
|
|
8872
|
+
{
|
|
8873
|
+
show: true,
|
|
8874
|
+
text: title,
|
|
8875
|
+
left: 'center',
|
|
8876
|
+
top: 2,
|
|
8877
|
+
textStyle: {
|
|
8878
|
+
fontSize: 14,
|
|
8879
|
+
fontWeight: 'normal',
|
|
8880
|
+
},
|
|
8881
|
+
},
|
|
8882
|
+
{
|
|
8883
|
+
show: true,
|
|
8884
|
+
text: xName,
|
|
8885
|
+
left: 'center',
|
|
8886
|
+
bottom: 0,
|
|
8887
|
+
textStyle: {
|
|
8888
|
+
fontSize: 12,
|
|
8889
|
+
fontWeight: 'normal',
|
|
8890
|
+
},
|
|
8891
|
+
},
|
|
8892
|
+
],
|
|
8893
|
+
tooltip: {
|
|
8894
|
+
trigger: 'axis',
|
|
8895
|
+
formatter: function (params) {
|
|
8896
|
+
return `标准颗粒直径: ${params[0].value[0].toFixed(3)} mm<br>过筛率: ${params[0].value[1].toFixed(2)} %`;
|
|
8897
|
+
},
|
|
8898
|
+
},
|
|
8899
|
+
grid: {
|
|
8900
|
+
top: 25,
|
|
8901
|
+
left: 25,
|
|
8902
|
+
right: 15,
|
|
8903
|
+
bottom: 20,
|
|
8904
|
+
containLabel: true,
|
|
8905
|
+
},
|
|
8906
|
+
xAxis: {
|
|
8907
|
+
name: xName,
|
|
8908
|
+
nameLocation: 'end',
|
|
8909
|
+
nameGap: 20,
|
|
8910
|
+
nameTextStyle: {
|
|
8911
|
+
fontSize: 12,
|
|
8912
|
+
},
|
|
8913
|
+
type: 'log', // 设置为对数坐标轴
|
|
8914
|
+
axisLine: {
|
|
8915
|
+
lineStyle: {
|
|
8916
|
+
color: '#333',
|
|
8917
|
+
},
|
|
8918
|
+
},
|
|
8919
|
+
min: 0.01, // 设置最小值为0.01
|
|
8920
|
+
max: 1, // 设置最大值为1
|
|
8921
|
+
axisLabel: {
|
|
8922
|
+
formatter: function (value) {
|
|
8923
|
+
return value.toFixed(2); // 格式化x轴标签显示
|
|
8924
|
+
},
|
|
8925
|
+
},
|
|
8926
|
+
// 增加纵向网格线
|
|
8927
|
+
splitLine: {
|
|
8928
|
+
show: true,
|
|
8929
|
+
lineStyle: {
|
|
8930
|
+
color: '#f0f0f0',
|
|
8931
|
+
width: 1,
|
|
8932
|
+
type: 'solid',
|
|
8933
|
+
},
|
|
8934
|
+
},
|
|
8935
|
+
// 设置更多的刻度点
|
|
8936
|
+
minorTick: {
|
|
8937
|
+
show: true,
|
|
8938
|
+
},
|
|
8939
|
+
minorSplitLine: {
|
|
8940
|
+
show: true,
|
|
8941
|
+
lineStyle: {
|
|
8942
|
+
color: '#f0f0f0',
|
|
8943
|
+
width: 1,
|
|
8944
|
+
type: 'solid',
|
|
8945
|
+
},
|
|
8946
|
+
},
|
|
8947
|
+
},
|
|
8948
|
+
yAxis: {
|
|
8949
|
+
type: 'value', // 普通坐标轴
|
|
8950
|
+
name: yName,
|
|
8951
|
+
nameLocation: 'middle', // 名称居中显示
|
|
8952
|
+
nameGap: 25, // 名称与轴线的距离
|
|
8953
|
+
nameTextStyle: {
|
|
8954
|
+
fontSize: 12,
|
|
8955
|
+
},
|
|
8956
|
+
axisLine: {
|
|
8957
|
+
lineStyle: {
|
|
8958
|
+
color: '#333',
|
|
8959
|
+
},
|
|
8960
|
+
},
|
|
8961
|
+
min: 0,
|
|
8962
|
+
max: 25,
|
|
8963
|
+
// 保持横向网格线
|
|
8964
|
+
splitLine: {
|
|
8965
|
+
show: true,
|
|
8966
|
+
lineStyle: {
|
|
8967
|
+
color: '#f0f0f0',
|
|
8968
|
+
width: 1,
|
|
8969
|
+
},
|
|
8970
|
+
},
|
|
8971
|
+
},
|
|
8972
|
+
series: yValIsAllNull
|
|
8973
|
+
? []
|
|
8974
|
+
: [
|
|
8975
|
+
{
|
|
8976
|
+
name: '孔径分布',
|
|
8977
|
+
type: 'line',
|
|
8978
|
+
data: xData.map((x, i) => [x, yData[i]]), // 组合x和y数据
|
|
8979
|
+
smooth: true, // 平滑曲线
|
|
8980
|
+
lineStyle: {
|
|
8981
|
+
width: 2,
|
|
8982
|
+
type: 'solid', // 实线
|
|
8983
|
+
},
|
|
8984
|
+
// 设置数据点样式为实心点
|
|
8985
|
+
showSymbol: true, // 确保显示数据点
|
|
8986
|
+
symbol: 'circle', // 实心圆点
|
|
8987
|
+
symbolSize: 8, // 点的大小
|
|
8988
|
+
itemStyle: {
|
|
8989
|
+
color: color, // 数据点颜色
|
|
8990
|
+
borderColor: '#fff', // 数据点边框颜色
|
|
8991
|
+
borderWidth: 1, // 数据点边框宽度
|
|
8992
|
+
},
|
|
8993
|
+
markPoint: {
|
|
8994
|
+
symbol: 'circle', // 使用简单的圆点作为标记
|
|
8995
|
+
symbolSize: 8, // 标记点大小
|
|
8996
|
+
data: [
|
|
8997
|
+
{
|
|
8998
|
+
name: 'y=5',
|
|
8999
|
+
coord: [xAtY5, 5], // 标记点坐标
|
|
9000
|
+
value: 5,
|
|
9001
|
+
itemStyle: {
|
|
9002
|
+
color: 'red', // 红色标记点
|
|
9003
|
+
},
|
|
9004
|
+
label: {
|
|
9005
|
+
show: true,
|
|
9006
|
+
formatter: `(${xAtY5.toFixed(3)},5)`, // 显示(x值,y值)
|
|
9007
|
+
position: 'right',
|
|
9008
|
+
fontSize: 12,
|
|
9009
|
+
},
|
|
9010
|
+
},
|
|
9011
|
+
{
|
|
9012
|
+
name: 'y=10',
|
|
9013
|
+
coord: [xAtY10, 10],
|
|
9014
|
+
value: 10,
|
|
9015
|
+
itemStyle: {
|
|
9016
|
+
color: 'red', // 红色标记点
|
|
9017
|
+
},
|
|
9018
|
+
label: {
|
|
9019
|
+
show: true,
|
|
9020
|
+
formatter: `(${xAtY10.toFixed(3)},10)`, // 显示(x值,y值)
|
|
9021
|
+
position: 'right',
|
|
9022
|
+
fontSize: 12,
|
|
9023
|
+
},
|
|
9024
|
+
},
|
|
9025
|
+
],
|
|
9026
|
+
},
|
|
9027
|
+
markLine: {
|
|
9028
|
+
symbol: 'none', // 去掉连线箭头
|
|
9029
|
+
data: [
|
|
9030
|
+
// y=5的水平虚线(从y轴到点)
|
|
9031
|
+
[
|
|
9032
|
+
{
|
|
9033
|
+
coord: [0.01, 5], // 起点:x轴最小值,y=5
|
|
9034
|
+
lineStyle: {
|
|
9035
|
+
type: 'dashed',
|
|
9036
|
+
color: 'red',
|
|
9037
|
+
width: 1,
|
|
9038
|
+
},
|
|
9039
|
+
},
|
|
9040
|
+
{
|
|
9041
|
+
coord: [xAtY5, 5], // 终点:标记点的x坐标,y=5
|
|
9042
|
+
lineStyle: {
|
|
9043
|
+
type: 'dashed',
|
|
9044
|
+
color: 'red',
|
|
9045
|
+
width: 1,
|
|
9046
|
+
},
|
|
9047
|
+
},
|
|
9048
|
+
],
|
|
9049
|
+
// y=5的垂直虚线(从x轴到点)
|
|
9050
|
+
[
|
|
9051
|
+
{
|
|
9052
|
+
coord: [xAtY5, 0], // 起点:标记点的x坐标,y轴最小值
|
|
9053
|
+
lineStyle: {
|
|
9054
|
+
type: 'dashed',
|
|
9055
|
+
color: 'red',
|
|
9056
|
+
width: 1,
|
|
9057
|
+
},
|
|
9058
|
+
},
|
|
9059
|
+
{
|
|
9060
|
+
coord: [xAtY5, 5], // 终点:标记点的坐标
|
|
9061
|
+
lineStyle: {
|
|
9062
|
+
type: 'dashed',
|
|
9063
|
+
color: 'red',
|
|
9064
|
+
width: 1,
|
|
9065
|
+
},
|
|
9066
|
+
},
|
|
9067
|
+
],
|
|
9068
|
+
// y=10的水平虚线(从y轴到点)
|
|
9069
|
+
[
|
|
9070
|
+
{
|
|
9071
|
+
coord: [0.01, 10], // 起点:x轴最小值,y=10
|
|
9072
|
+
lineStyle: {
|
|
9073
|
+
type: 'dashed',
|
|
9074
|
+
color: 'red',
|
|
9075
|
+
width: 1,
|
|
9076
|
+
},
|
|
9077
|
+
},
|
|
9078
|
+
{
|
|
9079
|
+
coord: [xAtY10, 10], // 终点:标记点的x坐标,y=10
|
|
9080
|
+
lineStyle: {
|
|
9081
|
+
type: 'dashed',
|
|
9082
|
+
color: 'red',
|
|
9083
|
+
width: 1,
|
|
9084
|
+
},
|
|
9085
|
+
},
|
|
9086
|
+
],
|
|
9087
|
+
// y=10的垂直虚线(从x轴到点)
|
|
9088
|
+
[
|
|
9089
|
+
{
|
|
9090
|
+
coord: [xAtY10, 0], // 起点:标记点的x坐标,y轴最小值
|
|
9091
|
+
lineStyle: {
|
|
9092
|
+
type: 'dashed',
|
|
9093
|
+
color: 'red',
|
|
9094
|
+
width: 1,
|
|
9095
|
+
},
|
|
9096
|
+
},
|
|
9097
|
+
{
|
|
9098
|
+
coord: [xAtY10, 10], // 终点:标记点的坐标
|
|
9099
|
+
lineStyle: {
|
|
9100
|
+
type: 'dashed',
|
|
9101
|
+
color: 'red',
|
|
9102
|
+
width: 1,
|
|
9103
|
+
},
|
|
9104
|
+
},
|
|
9105
|
+
],
|
|
9106
|
+
],
|
|
9107
|
+
},
|
|
9108
|
+
},
|
|
9109
|
+
],
|
|
9110
|
+
};
|
|
9111
|
+
return option;
|
|
9112
|
+
},
|
|
8782
9113
|
};
|
|
8783
9114
|
|
|
8784
9115
|
/**
|
|
@@ -9048,6 +9379,9 @@ const EChartsUtils = {
|
|
|
9048
9379
|
else if (config.chartType == 450) {
|
|
9049
9380
|
option = EChartsUtilsAll.chart450(config, xDataArr, yDataArr);
|
|
9050
9381
|
}
|
|
9382
|
+
else if (config.chartType == 470) {
|
|
9383
|
+
option = EChartsUtilsAll.chart470(config, xDataArr, yDataArr, sheet);
|
|
9384
|
+
}
|
|
9051
9385
|
if (option && typeof option === 'object') {
|
|
9052
9386
|
//如果是隐藏的图表,则需要禁用ECharts的动画效果
|
|
9053
9387
|
//原因是:如果ECharts使用了动画效果,图表渲染完成可能需要0.5秒,但是在导出ECharts统计图为图片的场景下时,可能在图表还没有渲染完成(动画效果还没结束)前就要获取图像了,此时可能就会造成获取到的图像内容丢失的情况
|