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>