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

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

View File

@@ -443,15 +443,15 @@ export default {
securityTypeOption.series[0].data = data.map(d => {
return { value: d.count, name: d.eventType }
})
if (chartDom) {
let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
if (data.length > 6) {
const dom = document.getElementById('eventSeverityPiesecurityEvent')
if (dom) {
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')
}
}
}
detectionChart.setOption(securityTypeOption)
const vm = this
@@ -496,15 +496,15 @@ export default {
securityTypeOption.series[0].data = data.map(d => {
return { value: d.count, name: d.eventType, itemStyle: { color: getAttackColor(d.eventType) } }
})
if (chartDom) {
let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
if (data.length > 6) {
const dom = document.getElementById('detectionCategoryPersecurityEvent')
if (dom) {
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')
}
}
}
detectionChart.setOption(securityTypeOption)
const vm = this