From 366bb8f17f176b7eace741ee8b683424d26cccb9 Mon Sep 17 00:00:00 2001 From: hanyuxia Date: Tue, 7 Nov 2023 10:50:49 +0800 Subject: [PATCH] =?UTF-8?q?CN-1443=20Detections-Security=20events=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=B8=AD=EF=BC=8CEvent=20type=20=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=90=8D=E7=A7=B0=E8=A2=AB?= =?UTF-8?q?=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/charts/charts/tools.js | 5 ++++- src/views/detections/Index.vue | 4 ++++ src/views/detections/options/detectionOptions.js | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/views/charts/charts/tools.js b/src/views/charts/charts/tools.js index 49c3f800..210cdd21 100644 --- a/src/views/charts/charts/tools.js +++ b/src/views/charts/charts/tools.js @@ -338,7 +338,10 @@ export function axisFormatter (params) { return str } export function tooLongFormatter (name) { - return format.truncateText(name, 110, '12px') + return format.truncateText(name, 150, '12px') +} +export function tooLongFormatterFor2Columns (name) { + return format.truncateText(name, 83, '12px') } export function timeHorizontalFormatter (params) { let str = '
' diff --git a/src/views/detections/Index.vue b/src/views/detections/Index.vue index 15999dba..7eb19bb1 100644 --- a/src/views/detections/Index.vue +++ b/src/views/detections/Index.vue @@ -138,6 +138,7 @@ import { useRoute } from 'vue-router' import Loading from '@/components/common/Loading' import ChartTabs from '@/components/common/ChartTabs' import { useStore } from 'vuex' +import { tooLongFormatterFor2Columns } from '@/views/charts/charts/tools' export default { name: 'Index', @@ -478,6 +479,9 @@ export default { securityTypeOption.series[0].data = data.map(d => { return { value: d.count, name: d.eventType, itemStyle: { color: getAttackColor(d.eventType) } } }) + if(data.length > 6){ + securityTypeOption.legend.formatter = tooLongFormatterFor2Columns + } detectionChart.setOption(securityTypeOption) const vm = this diff --git a/src/views/detections/options/detectionOptions.js b/src/views/detections/options/detectionOptions.js index 8c909b0e..86368359 100644 --- a/src/views/detections/options/detectionOptions.js +++ b/src/views/detections/options/detectionOptions.js @@ -187,7 +187,7 @@ export const pieForSeverity = { legend: { orient: 'vertical', type: 'plain', - left: '60%', + left: '52%', top: 'middle', icon: 'circle', itemWidth: 10, // 设置宽度 @@ -203,7 +203,7 @@ export const pieForSeverity = { type: 'pie', selectedMode: 'single', radius: ['43%', '65%'], - center: ['30%', '50%'], + center: ['26%', '50%'], data: [], label: { show: false