diff --git a/nezha-fronted/src/components/charts/chart-alert-list.vue b/nezha-fronted/src/components/charts/chart-alert-list.vue index 800913aae..aa91dc934 100644 --- a/nezha-fronted/src/components/charts/chart-alert-list.vue +++ b/nezha-fronted/src/components/charts/chart-alert-list.vue @@ -523,6 +523,15 @@ export default { document.querySelector('.getTextWidth').remove(); return Number('-'+(width+5)); }, + returnMarkArea:function(){ + if(this.currentMsg){ + if(this.currentMsg.alertRule.operator=='>'||this.currentMsg.alertRule.operator=='>='){ + return[{yAxis:this.currentMsg.alertRule.threshold},{}] + }else{ + return[{},{yAxis:this.currentMsg.alertRule.threshold}] + } + } + }, detail(obj) { this.chartDatas = []; this.legend = []; @@ -642,14 +651,7 @@ export default { opacity:0.2 }, data:[ - [ - { - yAxis: this.currentMsg.alertRule.threshold - }, - { - yAxis: this.currentMsg.alertRule.operator==">="||this.currentMsg.alertRule.operator=='>'?'max':'min' - } - ] + this.returnMarkArea() ] } }; diff --git a/nezha-fronted/src/components/page/alert/list.vue b/nezha-fronted/src/components/page/alert/list.vue index b6bc100c9..73ab27987 100644 --- a/nezha-fronted/src/components/page/alert/list.vue +++ b/nezha-fronted/src/components/page/alert/list.vue @@ -552,16 +552,7 @@ color:'#d64f40', opacity:0.2 }, - data:[ - [ - { - yAxis: this.currentMsg.alertRule.threshold - }, - { - yAxis: this.currentMsg.alertRule.operator==">="||this.currentMsg.alertRule.operator=='>'?'max':'min' - } - ] - ] + data:[this.returnMarkArea()] } }; if(this.currentMsg.alertRule.operator=='=='||this.currentMsg.alertRule.operator=='!='){ @@ -616,6 +607,15 @@ document.querySelector('.getTextWidth').remove(); return Number('-'+(width+5)); }, + returnMarkArea:function(){ + if(this.currentMsg){ + if(this.currentMsg.alertRule.operator=='>'||this.currentMsg.alertRule.operator=='>='){ + return[{yAxis:this.currentMsg.alertRule.threshold},{}] + }else{ + return[{},{yAxis:this.currentMsg.alertRule.threshold}] + } + } + }, detail(obj) { this.chartDatas = []; this.legend = [];