想要实现的效果: Echarts折线堆叠图中有曲线和一条直线,要求上下拖动这条直线实时显示数据,直线是因为后端返回的接口里数值都是一样的就是直线了,
if (this.analysisModel.amplificationData.amplificationParam.graphType === '1') {
for (let i = 0; i < thresholdLineData.length; i++) {
let thresholdArr = thresholdLineData[i].split('|')
let thr = []
for (let j = 0; j < this._CycleCount; j++) {
console.log(this._CycleCount);
thr.push(thresholdArr[0])
}
let color = 'blue'
if (thresholdArr[1] === '0') {
color = '#1E90FF'
} else if (thresholdArr[1] === '1') {
color = '#FFD700'
} else if (thresholdArr[1] === '2') {
color = '#90EE90'
} else if (thresholdArr[1] === '3') {
color = '#FF4500'
}
let series = {
name: '阈值线',
type: 'line',
data: thr,
showSymbol: false,
showAllSymbol: false,
sampling: 'average',//降采样策略,
itemStyle : {
normal : {
color: color,
lineStyle:{
color: color,
width: 2
}
}
},
}
seriesData.push(series)
}
}