echarts修改

This commit is contained in:
978184212@qq.com 2025-12-08 19:21:06 +08:00
parent fdda6f0f6d
commit 179f52c42c
1 changed files with 9 additions and 21 deletions

View File

@ -479,7 +479,6 @@
maskClick(e) {
this.rangetime = e;
},
// - getServerData
getServerData(val) {
const chartDataList = val.map(item => {
const series = [];
@ -491,7 +490,7 @@
const highValNum = item.highVal ? Number(item.highVal) || 0 : null;
const lowValNum = item.lowVal ? Number(item.lowVal) || 0 : null;
// 线 - 线
// 线
series.push({
name: item.itemName,
data: mainData,
@ -501,46 +500,34 @@
show: true
});
// 线 - 线
// 线 - 使线
if (highValNum !== null) {
series.push({
name: `最高阈值: ${highValNum}`,
data: Array(this.timeList?.length || 0).fill(highValNum),
color: "#FF4242",
// 线
lineType: "dash", // "dashed", "dot", "dashdot"
dashLength: 10, // 线
gapLength: 5, //
lineType: "dash",
pointShape: "none",
show: true,
// 使
custom: {
lineDash: [10, 5] // [线, ]
}
show: true
});
}
// 线
// 线 - 使线
if (lowValNum !== null) {
series.push({
name: `最低阈值: ${lowValNum}`,
data: Array(this.timeList?.length || 0).fill(lowValNum),
color: "#19D58A",
lineType: "dash",
dashLength: 10,
gapLength: 5,
pointShape: "none",
show: true,
custom: {
lineDash: [10, 5]
}
show: true
});
}
return {
categories: this.timeList.slice(0, 50) || [],
series: series,
chartOpts: this.getChartOpts(item.itemName, item.unit)
chartOpts: this.getChartOpts(item.itemName, item.unit, true) //
};
});
@ -549,7 +536,7 @@
...item,
chartData: chartDataList[index] ? chartDataList[index].series : [],
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;
margin-top: 20rpx;
}
</style>