CN-932 fix: 折线图类的组件代码优化

This commit is contained in:
刘洪洪
2023-03-21 11:21:29 +08:00
parent 9d210a0d07
commit ef70c1ac23
3 changed files with 86 additions and 143 deletions

View File

@@ -402,25 +402,15 @@ export default {
}
if (!this.isUnitTesting) {
const chartOption = this.myChart.getOption()
if (this.lineRefer === 'Average' && this.showMarkLine) {
chartOption.series.forEach((t) => {
if (this.showMarkLine) {
chartOption.series.forEach(t => {
if (t.name === echartsData[0].name) {
t.markLine.data = [{ yAxis: echartsData[0].analysis.avg }]
}
})
} else if (this.lineRefer === '95th Percentile' && this.showMarkLine) {
chartOption.series.forEach((t) => {
if (t.name === echartsData[0].name) {
t.markLine.data = [{ yAxis: echartsData[0].analysis.p95 }]
}
})
} else if (this.lineRefer === 'Maximum' && this.showMarkLine) {
chartOption.series.forEach((t) => {
if (t.name === echartsData[0].name) {
t.markLine.data = [{ yAxis: echartsData[0].analysis.max }]
t.markLine.data = [{ yAxis: echartsData[0].analysis[getMarkLineByLineRefer(this.lineRefer)] }]
}
})
}
this.myChart.setOption(chartOption)
}
},