diff --git a/src/views/detections/options/detectionOptions.js b/src/views/detections/options/detectionOptions.js index 35d09d0e..86cb4f62 100644 --- a/src/views/detections/options/detectionOptions.js +++ b/src/views/detections/options/detectionOptions.js @@ -289,16 +289,33 @@ export const activeAttackBar = { } export const metricOption = { tooltip: { - appendToBody: true, + show:true, trigger: 'axis', + formatter(params){ + let str = '
' + let item = params[0] + const tData = item.data[0] + str += '
' + str += window.$dayJs.tz(tData).format('YYYY-MM-DD HH:mm:ss') + str += '
' + str += '
' + str += item.marker + str += ` + ${item.seriesName} + ` + str += ` + ${unitConvert(item.data[1], item.data[2]).join(' ')} + ` + str += '
' + return str + }, + className: 'nz-chart-tooltip', + extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important', textStyle: { width: '20px', overflow: 'truncate' }, - //formatter: axisFormatter, - show: true, - className: 'nz-chart-tooltip', - extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important' + appendToBody: true }, xAxis: { type: 'time', diff --git a/src/views/detections/overview/DetectionPerformanceEventAppOverview.vue b/src/views/detections/overview/DetectionPerformanceEventAppOverview.vue index 2d481770..bf278a79 100644 --- a/src/views/detections/overview/DetectionPerformanceEventAppOverview.vue +++ b/src/views/detections/overview/DetectionPerformanceEventAppOverview.vue @@ -67,6 +67,7 @@ import { unitTypes } from '@/utils/constants' import { getSecond } from '@/utils/date-util' import { get } from '@/utils/http' import * as echarts from 'echarts' +import { markRaw } from 'vue' import { metricOption } from '@/views/detections/options/detectionOptions' import { sortBy,reverseSortBy } from '@/utils/tools' export default { @@ -127,7 +128,7 @@ export default { }, initChart(){ - this.metricChart = echarts.init(document.getElementById('detectionMetricChartDomain')) + this.metricChart = markRaw(echarts.init(document.getElementById('detectionMetricChartDomain'))) this.chartOptionMetric = _.cloneDeep(this.chartOption) this.metricList.sort(reverseSortBy(0))//将返回的数据按时间降序排序,方便找到实线和虚线的交点 diff --git a/src/views/detections/overview/DetectionPerformanceEventDomainOverview.vue b/src/views/detections/overview/DetectionPerformanceEventDomainOverview.vue index 469d0eaf..735b31e9 100644 --- a/src/views/detections/overview/DetectionPerformanceEventDomainOverview.vue +++ b/src/views/detections/overview/DetectionPerformanceEventDomainOverview.vue @@ -96,6 +96,7 @@ import { eventSeverityColor,unitTypes ,topDomain} from '@/utils/constants' import { getSecond } from '@/utils/date-util' import { get } from '@/utils/http' import * as echarts from 'echarts' +import { markRaw } from 'vue' import { metricOption } from '@/views/detections/options/detectionOptions' import { sortBy,reverseSortBy } from '@/utils/tools' export default { @@ -186,7 +187,7 @@ export default { }, initChart(){ - this.metricChart = echarts.init(document.getElementById('detectionMetricChartDomain')) + this.metricChart = markRaw(echarts.init(document.getElementById('detectionMetricChartDomain')))//使用markRaw的原因:vue3+echart5 遇到的坑 Cannot read properties of undefined (reading 'type') this.chartOptionMetric = _.cloneDeep(this.chartOption) this.metricList.sort(reverseSortBy(0))//将返回的数据按时间降序排序,方便找到实线和虚线的交点 diff --git a/src/views/detections/overview/DetectionPerformanceEventIpOverview.vue b/src/views/detections/overview/DetectionPerformanceEventIpOverview.vue index adee696e..0d433a0f 100644 --- a/src/views/detections/overview/DetectionPerformanceEventIpOverview.vue +++ b/src/views/detections/overview/DetectionPerformanceEventIpOverview.vue @@ -87,6 +87,7 @@ import { unitTypes } from '@/utils/constants' import { getSecond } from '@/utils/date-util' import { get } from '@/utils/http' import * as echarts from 'echarts' +import { markRaw } from 'vue' import { metricOption } from '@/views/detections/options/detectionOptions' import { sortBy,reverseSortBy } from '@/utils/tools' export default { @@ -149,7 +150,7 @@ export default { }, initChart(){ - this.metricChart = echarts.init(document.getElementById('detectionMetricChartIp')) + this.metricChart = markRaw(echarts.init(document.getElementById('detectionMetricChartIp'))) this.chartOptionMetric = _.cloneDeep(this.chartOption) this.metricList.sort(reverseSortBy(0))//将返回的数据按时间降序排序,方便找到实线和虚线的交点