diff --git a/nezha-fronted/src/components/charts/chart-bar-statistics.vue b/nezha-fronted/src/components/charts/chart-bar-statistics.vue index 510f253e3..6278b4398 100644 --- a/nezha-fronted/src/components/charts/chart-bar-statistics.vue +++ b/nezha-fronted/src/components/charts/chart-bar-statistics.vue @@ -294,7 +294,6 @@ export default { // 设置数据, filter区分 setData (chartItem, seriesItem, panelId, filter, legend, area, errorMsg) { this.data = chartItem - const self = this if (chartItem.type === 'bar') { this.option.xAxis = { type: 'category', @@ -366,6 +365,24 @@ export default { obj.name = legend[index].name obj.data = [[legendShow, item.value]] obj.stack = true + obj.markLine = { + silent: true, + symbol: ['circle', 'circle'], + label: { + distance: this.computeDistance(chartDataFormat.getUnit(chartItem.unit ? chartItem.unit : 2).compute(chartItem.param.threshold)), + formatter: function (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) + }] + } nweSeriesItem.push(obj) }) seriesItem = nweSeriesItem @@ -417,6 +434,12 @@ export default { this.endLoading() } }, + computeDistance: function (str) { + const span = document.querySelector('.temp-dom') + span.textContent = str + const txtWidth = parseFloat(window.getComputedStyle(span).width) + return Number('-' + (txtWidth + 5)) + }, formatLegend (chartWidth, name) { if (!name) { return '' diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 5290e13b9..6d29837fc 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -2211,278 +2211,277 @@ export default { } } - -