echarts修改
This commit is contained in:
parent
fdda6f0f6d
commit
179f52c42c
|
|
@ -479,7 +479,6 @@
|
||||||
maskClick(e) {
|
maskClick(e) {
|
||||||
this.rangetime = e;
|
this.rangetime = e;
|
||||||
},
|
},
|
||||||
// 处理图表数据 - 修改getServerData方法
|
|
||||||
getServerData(val) {
|
getServerData(val) {
|
||||||
const chartDataList = val.map(item => {
|
const chartDataList = val.map(item => {
|
||||||
const series = [];
|
const series = [];
|
||||||
|
|
@ -491,7 +490,7 @@
|
||||||
const highValNum = item.highVal ? Number(item.highVal) || 0 : null;
|
const highValNum = item.highVal ? Number(item.highVal) || 0 : null;
|
||||||
const lowValNum = item.lowVal ? Number(item.lowVal) || 0 : null;
|
const lowValNum = item.lowVal ? Number(item.lowVal) || 0 : null;
|
||||||
|
|
||||||
// 正常数据线 - 实线
|
// 正常数据线
|
||||||
series.push({
|
series.push({
|
||||||
name: item.itemName,
|
name: item.itemName,
|
||||||
data: mainData,
|
data: mainData,
|
||||||
|
|
@ -501,46 +500,34 @@
|
||||||
show: true
|
show: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// 最高阈值线 - 尝试不同方式设置虚线
|
// 最高阈值线 - 使用虚线
|
||||||
if (highValNum !== null) {
|
if (highValNum !== null) {
|
||||||
series.push({
|
series.push({
|
||||||
name: `最高阈值: ${highValNum}`,
|
name: `最高阈值: ${highValNum}`,
|
||||||
data: Array(this.timeList?.length || 0).fill(highValNum),
|
data: Array(this.timeList?.length || 0).fill(highValNum),
|
||||||
color: "#FF4242",
|
color: "#FF4242",
|
||||||
// 尝试不同的虚线设置方式
|
lineType: "dash",
|
||||||
lineType: "dash", // 或者尝试 "dashed", "dot", "dashdot"
|
|
||||||
dashLength: 10, // 设置虚线段的长度
|
|
||||||
gapLength: 5, // 设置间隔的长度
|
|
||||||
pointShape: "none",
|
pointShape: "none",
|
||||||
show: true,
|
show: true
|
||||||
// 使用自定义样式
|
|
||||||
custom: {
|
|
||||||
lineDash: [10, 5] // 数组格式:[线段长度, 间隔长度]
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 最低阈值线
|
// 最低阈值线 - 使用虚线
|
||||||
if (lowValNum !== null) {
|
if (lowValNum !== null) {
|
||||||
series.push({
|
series.push({
|
||||||
name: `最低阈值: ${lowValNum}`,
|
name: `最低阈值: ${lowValNum}`,
|
||||||
data: Array(this.timeList?.length || 0).fill(lowValNum),
|
data: Array(this.timeList?.length || 0).fill(lowValNum),
|
||||||
color: "#19D58A",
|
color: "#19D58A",
|
||||||
lineType: "dash",
|
lineType: "dash",
|
||||||
dashLength: 10,
|
|
||||||
gapLength: 5,
|
|
||||||
pointShape: "none",
|
pointShape: "none",
|
||||||
show: true,
|
show: true
|
||||||
custom: {
|
|
||||||
lineDash: [10, 5]
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categories: this.timeList.slice(0, 50) || [],
|
categories: this.timeList.slice(0, 50) || [],
|
||||||
series: series,
|
series: series,
|
||||||
chartOpts: this.getChartOpts(item.itemName, item.unit)
|
chartOpts: this.getChartOpts(item.itemName, item.unit, true) // 禁用默认图例
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -549,7 +536,7 @@
|
||||||
...item,
|
...item,
|
||||||
chartData: chartDataList[index] ? chartDataList[index].series : [],
|
chartData: chartDataList[index] ? chartDataList[index].series : [],
|
||||||
categories: chartDataList[index] ? chartDataList[index].categories : [],
|
categories: chartDataList[index] ? chartDataList[index].categories : [],
|
||||||
chartOpts: chartDataList[index] ? chartDataList[index].chartOpts : this.getChartOpts(item.itemName, item.unit)
|
chartOpts: chartDataList[index] ? chartDataList[index].chartOpts : this.getChartOpts(item.itemName, item.unit, true)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -967,4 +954,5 @@
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue