echarts修改
This commit is contained in:
parent
fdda6f0f6d
commit
179f52c42c
|
|
@ -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>
|
||||
Loading…
Reference in New Issue