fix:1 检测->事件类型饼图legend宽度随分辨率而改变代码补充

This commit is contained in:
hanyuxia
2023-11-17 14:13:04 +08:00
parent f95dc60cd3
commit a0af36b7c0

View File

@@ -443,13 +443,13 @@ export default {
securityTypeOption.series[0].data = data.map(d => { securityTypeOption.series[0].data = data.map(d => {
return { value: d.count, name: d.eventType } return { value: d.count, name: d.eventType }
}) })
if (data.length > 6) { if (chartDom) {
const dom = document.getElementById('eventSeverityPiesecurityEvent') let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
if (dom) { if (data.length > 6) {
const oneColumnWidth = (dom.clientWidth * 0.56) / 2 - 30 oneColumnWidth = (chartDom.clientWidth * 0.56) / 2 - 30
securityTypeOption.legend.formatter = function (name) { }
return format.truncateText(name, oneColumnWidth, '12px') securityTypeOption.legend.formatter = function (name) {
} return format.truncateText(name, oneColumnWidth, '12px')
} }
} }
detectionChart.setOption(securityTypeOption) detectionChart.setOption(securityTypeOption)
@@ -496,13 +496,13 @@ export default {
securityTypeOption.series[0].data = data.map(d => { securityTypeOption.series[0].data = data.map(d => {
return { value: d.count, name: d.eventType, itemStyle: { color: getAttackColor(d.eventType) } } return { value: d.count, name: d.eventType, itemStyle: { color: getAttackColor(d.eventType) } }
}) })
if (data.length > 6) { if (chartDom) {
const dom = document.getElementById('detectionCategoryPersecurityEvent') let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
if (dom) { if (data.length > 6) {
const oneColumnWidth = (dom.clientWidth * 0.56) / 2 - 30 oneColumnWidth = (chartDom.clientWidth * 0.56) / 2 - 30
securityTypeOption.legend.formatter = function (name) { }
return format.truncateText(name, oneColumnWidth, '12px') securityTypeOption.legend.formatter = function (name) {
} return format.truncateText(name, oneColumnWidth, '12px')
} }
} }
detectionChart.setOption(securityTypeOption) detectionChart.setOption(securityTypeOption)