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) { 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>