From 09f884d55f56ce7fc93544ac182d5b2ceb7a4a8e Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 12 Nov 2021 17:28:28 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1230=20fix=EF=BC=9A=20=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=98=88=E5=80=BC=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chartPreview.vue | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index 32ca37074..cab83c95d 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -521,6 +521,26 @@ export default { if (chartItem.type === 'endpointInfo') { seriesItem.theData.type = 'line' } + if ((chartItem.type === 'line' || chartItem.type === 'stackArea' || chartItem.type === 'bar') && chartItem.param && chartItem.param.threshold) { + seriesItem.theData.markLine = { + silent: true, + symbol: ['circle', 'circle'], + label: { + distance: this.computeDistance(chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(chartItem.param.threshold)), + formatter (params) { + return chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(params.value) + } + }, + lineStyle: { + color: '#d64f40', + width: 2, + type: 'dotted' + }, + data: [{ + yAxis: Number(chartItem.param.threshold) + }] + } + } // 图表中每条线的名字,后半部分 let host = ''// up, if (queryItem.metric.__name__) {