2023-12-27 16:08:43 +08:00
|
|
|
|
import { tooLongFormatter } from '@/views/charts/charts/tools'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
import unitConvert from '@/utils/unit-convert'
|
|
|
|
|
|
import _ from 'lodash'
|
2023-10-22 18:29:34 +08:00
|
|
|
|
import { dateFormatByAppearance, xAxisTimeFormatter, xAxisTimeRich } from '@/utils/date-util'
|
2023-01-04 15:41:06 +08:00
|
|
|
|
import { unitTypes } from '@/utils/constants'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
|
2022-02-22 17:34:20 +08:00
|
|
|
|
const severitySeriesIndexMappings = [
|
|
|
|
|
|
{ value: 'critical', index: '0' },
|
|
|
|
|
|
{ value: 'high', index: '1' },
|
|
|
|
|
|
{ value: 'medium', index: '2' },
|
2022-02-26 23:45:38 +08:00
|
|
|
|
{ value: 'low', index: '3' },
|
2022-02-22 17:34:20 +08:00
|
|
|
|
{ value: 'info', index: '4' }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
export function getSeriesIndex (type) {
|
|
|
|
|
|
const mapping = severitySeriesIndexMappings.find(m => m.value === type.toLowerCase())
|
|
|
|
|
|
return mapping && mapping.index ? _.cloneDeep(mapping.index) : null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-04 18:16:06 +08:00
|
|
|
|
export const activeAttackColor = ['#51a9ee', '#49bcf2', '#4ad7eb', '#4cd4c8',
|
|
|
|
|
|
'#7acc7e', '#a7db69']
|
|
|
|
|
|
|
2022-02-17 19:28:48 +08:00
|
|
|
|
const activeAttackColorMappings = [
|
2022-02-22 22:22:15 +08:00
|
|
|
|
{ value: 'command and control', color: '#51a9ee' },
|
|
|
|
|
|
{ value: 'payload delivery', color: '#49bcf2' },
|
|
|
|
|
|
{ value: 'cryptomining', color: '#4ad7eb' },
|
2022-02-17 19:28:48 +08:00
|
|
|
|
{ value: 'phishing', color: '#4cd4c8' },
|
|
|
|
|
|
{ value: 'dga', color: '#7acc7e' },
|
|
|
|
|
|
{ value: 'ddos', color: '#a7db69' }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
export function getAttackColor (type) {
|
|
|
|
|
|
const mapping = activeAttackColorMappings.find(m => m.value === type)
|
|
|
|
|
|
return mapping && mapping.color ? _.cloneDeep(mapping.color) : null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const severityColorMappings = [
|
2022-02-22 22:22:15 +08:00
|
|
|
|
{ value: 'critical', color: '#d84c4c' },
|
|
|
|
|
|
{ value: 'high', color: '#ff9a79' },
|
|
|
|
|
|
{ value: 'medium', color: '#ffb65a' },
|
|
|
|
|
|
{ value: 'low', color: '#ffdd4a' },
|
|
|
|
|
|
{ value: 'info', color: '#d7c668' }
|
2022-02-17 19:28:48 +08:00
|
|
|
|
]
|
2024-08-12 18:31:19 +08:00
|
|
|
|
const severityNumberColorMappings = [
|
|
|
|
|
|
{ value: 5, color: '#d84c4c' },
|
|
|
|
|
|
{ value: 4, color: '#ff9a79' },
|
|
|
|
|
|
{ value: 3, color: '#ffb65a' },
|
|
|
|
|
|
{ value: 2, color: '#ffdd4a' },
|
|
|
|
|
|
{ value: 1, color: '#d7c668' }
|
|
|
|
|
|
]
|
2022-02-17 19:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
export function getSeverityColor (type) {
|
|
|
|
|
|
const mapping = severityColorMappings.find(m => m.value === type)
|
|
|
|
|
|
return mapping && mapping.color ? _.cloneDeep(mapping.color) : null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-12 18:31:19 +08:00
|
|
|
|
export function getSeverityNumberColor (type) {
|
|
|
|
|
|
const mapping = severityNumberColorMappings.find(m => m.value === type)
|
|
|
|
|
|
return mapping && mapping.color ? _.cloneDeep(mapping.color) : null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-02-17 19:28:48 +08:00
|
|
|
|
export const multipleBarOption = {
|
|
|
|
|
|
legend: {
|
|
|
|
|
|
icon: 'circle',
|
|
|
|
|
|
top: 10,
|
2022-03-09 15:05:46 +08:00
|
|
|
|
right: 30,
|
2022-02-17 19:28:48 +08:00
|
|
|
|
itemWidth: 10, // 设置宽度
|
2022-02-21 10:52:14 +08:00
|
|
|
|
itemHeight: 10 // 设置高度
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2023-03-13 15:16:59 +08:00
|
|
|
|
tooltip: {
|
2023-12-09 10:16:41 +08:00
|
|
|
|
trigger: 'axis',
|
|
|
|
|
|
axisPointer: {
|
|
|
|
|
|
type: 'shadow'
|
2023-03-13 15:16:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
dataset: {
|
|
|
|
|
|
source: [
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
2023-10-22 18:29:34 +08:00
|
|
|
|
xAxis: [{
|
|
|
|
|
|
type: 'time',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: {
|
2022-02-21 10:52:14 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#eaedef'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
axisLabel: {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
formatter: xAxisTimeFormatter,
|
|
|
|
|
|
rich: xAxisTimeRich,
|
2022-02-21 10:52:14 +08:00
|
|
|
|
color: '#737373',
|
2022-03-09 15:05:46 +08:00
|
|
|
|
interval: 'auto'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2023-10-22 18:29:34 +08:00
|
|
|
|
splitNumber: 8,
|
2022-02-21 10:52:14 +08:00
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}],
|
2022-02-17 19:28:48 +08:00
|
|
|
|
yAxis: {
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
show: true,
|
2022-02-21 10:52:14 +08:00
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#eaedef'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
axisLabel: {
|
|
|
|
|
|
color: '#737373'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
2022-06-10 16:35:03 +08:00
|
|
|
|
},
|
2022-12-08 16:09:46 +08:00
|
|
|
|
minInterval: 1
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
top: 40,
|
|
|
|
|
|
left: 25,
|
2023-12-29 14:13:54 +08:00
|
|
|
|
right: 40,
|
2022-02-17 19:28:48 +08:00
|
|
|
|
bottom: 20,
|
|
|
|
|
|
containLabel: true
|
|
|
|
|
|
},
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
2022-02-22 22:22:15 +08:00
|
|
|
|
name: 'critical',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
type: 'bar',
|
2022-03-17 17:56:38 +08:00
|
|
|
|
stack: 'eventSeverityTrend',
|
2022-03-09 15:05:46 +08:00
|
|
|
|
emphasis: {
|
2023-12-09 10:16:41 +08:00
|
|
|
|
focus: 'none'
|
2022-03-09 15:05:46 +08:00
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
seriesLayoutBy: 'row',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: '#d84c4c'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-02-22 22:22:15 +08:00
|
|
|
|
name: 'high',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
type: 'bar',
|
2022-03-17 17:56:38 +08:00
|
|
|
|
stack: 'eventSeverityTrend',
|
2022-03-09 15:05:46 +08:00
|
|
|
|
emphasis: {
|
2023-12-09 10:16:41 +08:00
|
|
|
|
focus: 'none'
|
2022-03-09 15:05:46 +08:00
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
seriesLayoutBy: 'row',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: '#ff9a79'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-02-22 22:22:15 +08:00
|
|
|
|
name: 'medium',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
type: 'bar',
|
2022-03-17 17:56:38 +08:00
|
|
|
|
stack: 'eventSeverityTrend',
|
2022-03-09 15:05:46 +08:00
|
|
|
|
emphasis: {
|
2023-12-09 10:16:41 +08:00
|
|
|
|
focus: 'none'
|
2022-03-09 15:05:46 +08:00
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
seriesLayoutBy: 'row',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: '#ffb65a'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-02-22 22:22:15 +08:00
|
|
|
|
name: 'low',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
type: 'bar',
|
2022-03-17 17:56:38 +08:00
|
|
|
|
stack: 'eventSeverityTrend',
|
2022-03-09 15:05:46 +08:00
|
|
|
|
emphasis: {
|
2023-12-09 10:16:41 +08:00
|
|
|
|
focus: 'none'
|
2022-03-09 15:05:46 +08:00
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
seriesLayoutBy: 'row',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: '#ffdd4a'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-02-22 22:22:15 +08:00
|
|
|
|
name: 'info',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
type: 'bar',
|
2022-03-17 17:56:38 +08:00
|
|
|
|
stack: 'eventSeverityTrend',
|
2022-03-09 15:05:46 +08:00
|
|
|
|
emphasis: {
|
2023-12-09 10:16:41 +08:00
|
|
|
|
focus: 'none'
|
2022-03-09 15:05:46 +08:00
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
seriesLayoutBy: 'row',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: '#d7c668'
|
|
|
|
|
|
}
|
2022-02-21 10:52:14 +08:00
|
|
|
|
}
|
2022-02-17 19:28:48 +08:00
|
|
|
|
]
|
2022-02-21 10:52:14 +08:00
|
|
|
|
}
|
2024-08-09 18:34:59 +08:00
|
|
|
|
export const barOption = {
|
|
|
|
|
|
legend: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
|
axisPointer: {
|
|
|
|
|
|
type: 'shadow'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
xAxis: [{
|
|
|
|
|
|
type: 'time',
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#eaedef'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
formatter: xAxisTimeFormatter,
|
|
|
|
|
|
rich: xAxisTimeRich,
|
|
|
|
|
|
color: '#737373',
|
|
|
|
|
|
interval: 'auto'
|
|
|
|
|
|
},
|
|
|
|
|
|
splitNumber: 8,
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}
|
|
|
|
|
|
}],
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#eaedef'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
color: '#737373'
|
|
|
|
|
|
},
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
minInterval: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
top: 30,
|
|
|
|
|
|
left: 25,
|
|
|
|
|
|
right: 40,
|
|
|
|
|
|
bottom: 20,
|
|
|
|
|
|
containLabel: true
|
|
|
|
|
|
},
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'event',
|
|
|
|
|
|
type: 'bar',
|
|
|
|
|
|
emphasis: {
|
|
|
|
|
|
focus: 'none'
|
|
|
|
|
|
},
|
|
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
seriesLayoutBy: 'row',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: '#43a3cf'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
2022-02-17 19:28:48 +08:00
|
|
|
|
export const pieForSeverity = {
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
appendToBody: true
|
|
|
|
|
|
},
|
2022-03-04 18:16:06 +08:00
|
|
|
|
color: activeAttackColor,
|
2023-06-30 18:07:46 +08:00
|
|
|
|
animation: true,
|
2022-02-17 19:28:48 +08:00
|
|
|
|
legend: {
|
|
|
|
|
|
orient: 'vertical',
|
|
|
|
|
|
type: 'plain',
|
2023-11-17 13:54:21 +08:00
|
|
|
|
left: '44%',
|
2022-02-17 19:28:48 +08:00
|
|
|
|
top: 'middle',
|
|
|
|
|
|
icon: 'circle',
|
|
|
|
|
|
itemWidth: 10, // 设置宽度
|
|
|
|
|
|
itemHeight: 10, // 设置高度
|
|
|
|
|
|
itemGap: 10,
|
|
|
|
|
|
formatter: tooLongFormatter,
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'pie',
|
|
|
|
|
|
selectedMode: 'single',
|
2023-06-30 18:07:46 +08:00
|
|
|
|
radius: ['43%', '65%'],
|
2023-11-17 13:54:21 +08:00
|
|
|
|
center: ['22%', '50%'],
|
2022-02-17 19:28:48 +08:00
|
|
|
|
data: [],
|
|
|
|
|
|
label: {
|
2022-02-21 10:52:14 +08:00
|
|
|
|
show: false
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
labelLine: {
|
|
|
|
|
|
show: false
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
formatter: function (param, index, callback) {
|
|
|
|
|
|
return `${param.name}: ${param.value}`
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
export const activeAttackBar = {
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
|
trigger: 'item',
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
width: '20px',
|
|
|
|
|
|
overflow: 'truncate'
|
|
|
|
|
|
},
|
|
|
|
|
|
formatter: function (param, index, callback) {
|
2024-08-23 16:11:07 +08:00
|
|
|
|
const valueList = param.value[2].split(',')
|
|
|
|
|
|
const fieldList = param.value[3].split(',')
|
|
|
|
|
|
let tooltip = ''
|
|
|
|
|
|
fieldList.forEach((ite, ind) => {
|
|
|
|
|
|
tooltip += `${ite}: ${valueList[ind]}<br>`
|
|
|
|
|
|
})
|
|
|
|
|
|
return tooltip
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
className: 'nz-chart-tooltip',
|
2024-08-15 14:14:17 +08:00
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false },
|
2022-02-21 10:52:14 +08:00
|
|
|
|
axisLabel: {
|
|
|
|
|
|
show: false
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
top: 20,
|
2022-02-25 13:39:08 +08:00
|
|
|
|
left: 100,
|
2022-02-18 17:54:22 +08:00
|
|
|
|
right: 70,
|
|
|
|
|
|
bottom: 20
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
type: 'category',
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false },
|
2022-02-21 10:52:14 +08:00
|
|
|
|
axisLabel: {
|
2022-03-11 15:40:33 +08:00
|
|
|
|
show: true,
|
2022-03-17 17:56:38 +08:00
|
|
|
|
width: 95,
|
|
|
|
|
|
overflow: 'truncate'
|
2022-03-11 15:40:33 +08:00
|
|
|
|
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
2022-03-11 15:40:33 +08:00
|
|
|
|
},
|
2022-03-17 17:56:38 +08:00
|
|
|
|
triggerEvent: true
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
series: [{
|
|
|
|
|
|
barWidth: 5,
|
2022-02-21 10:52:14 +08:00
|
|
|
|
barMaxHeight: 20,
|
2022-02-17 19:28:48 +08:00
|
|
|
|
itemStyle: {
|
2022-12-14 14:43:38 +08:00
|
|
|
|
color: function (params) {
|
|
|
|
|
|
const colorList = ['#d1bd50', '#c9d150', '#fddd52', '#ffb65a', '#fe845d']
|
|
|
|
|
|
return colorList[params.dataIndex]
|
2022-02-17 19:28:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [],
|
|
|
|
|
|
type: 'bar',
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
position: 'right',
|
|
|
|
|
|
valueAnimation: true,
|
|
|
|
|
|
formatter: function (param, index, callback) {
|
|
|
|
|
|
return `${unitConvert(param.value[0], 'number').join(' ')}`
|
2022-02-21 10:52:14 +08:00
|
|
|
|
}
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
barCategoryGap: '10%'
|
|
|
|
|
|
}]
|
2022-02-21 10:52:14 +08:00
|
|
|
|
}
|
2022-03-18 18:25:50 +08:00
|
|
|
|
export const metricOption = {
|
|
|
|
|
|
tooltip: {
|
2022-03-30 15:37:55 +08:00
|
|
|
|
show: true,
|
2022-03-18 18:25:50 +08:00
|
|
|
|
trigger: 'axis',
|
2022-03-30 15:37:55 +08:00
|
|
|
|
formatter (params) {
|
2022-03-21 11:45:58 +08:00
|
|
|
|
let str = '<div>'
|
2022-03-30 15:37:55 +08:00
|
|
|
|
const item = params[0]
|
2022-03-21 11:45:58 +08:00
|
|
|
|
const tData = item.data[0]
|
|
|
|
|
|
str += '<div style="margin-bottom: 5px">'
|
2022-04-28 18:11:49 +08:00
|
|
|
|
str += dateFormatByAppearance(tData)
|
2022-03-21 11:45:58 +08:00
|
|
|
|
str += '</div>'
|
|
|
|
|
|
str += '<div class="cn-chart-tooltip-box">'
|
|
|
|
|
|
str += item.marker
|
|
|
|
|
|
str += `<span class="cn-chart-tooltip-content">
|
|
|
|
|
|
${item.seriesName}
|
|
|
|
|
|
</span>`
|
2023-01-04 15:50:49 +08:00
|
|
|
|
if (item.seriesName === 'dns response time' || item.seriesName === 'http response time') {
|
|
|
|
|
|
// http response time这种情况在ui上未找到,保险起见,添加以防不测
|
2023-01-04 15:41:06 +08:00
|
|
|
|
str += `<span class="cn-chart-tooltip-value">
|
|
|
|
|
|
${unitConvert(item.data[1], unitTypes.time).join(' ')}
|
2022-03-21 11:45:58 +08:00
|
|
|
|
</span>`
|
2023-01-04 15:41:06 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
str += `<span class="cn-chart-tooltip-value">
|
|
|
|
|
|
${unitConvert(item.data[1], unitTypes.percent, '', '', 0).join(' ')}
|
|
|
|
|
|
</span>`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-21 11:45:58 +08:00
|
|
|
|
str += '</div>'
|
|
|
|
|
|
return str
|
|
|
|
|
|
},
|
|
|
|
|
|
className: 'nz-chart-tooltip',
|
|
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important',
|
2022-03-18 18:25:50 +08:00
|
|
|
|
textStyle: {
|
|
|
|
|
|
width: '20px',
|
|
|
|
|
|
overflow: 'truncate'
|
|
|
|
|
|
},
|
2022-03-21 11:45:58 +08:00
|
|
|
|
appendToBody: true
|
2022-03-18 18:25:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
type: 'time',
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
animation: false,
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
left: 0,
|
|
|
|
|
|
bottom: 2,
|
|
|
|
|
|
top: 5,
|
|
|
|
|
|
right: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
legend: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
series: [
|
2022-03-30 15:37:55 +08:00
|
|
|
|
{
|
2023-01-04 15:41:06 +08:00
|
|
|
|
name: 'http error ratio',
|
2022-03-30 15:37:55 +08:00
|
|
|
|
type: 'line',
|
|
|
|
|
|
legendHoverLink: false,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
width: 1,
|
|
|
|
|
|
type: 'dashed'
|
2022-03-18 18:25:50 +08:00
|
|
|
|
},
|
2022-03-30 15:37:55 +08:00
|
|
|
|
color: '#ec836c',
|
|
|
|
|
|
data: [],
|
|
|
|
|
|
showSymbol: false
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-01-04 15:41:06 +08:00
|
|
|
|
name: 'http error ratio',
|
2022-03-30 15:37:55 +08:00
|
|
|
|
type: 'line',
|
|
|
|
|
|
legendHoverLink: false,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
width: 1,
|
|
|
|
|
|
type: 'solid'
|
2022-03-18 18:25:50 +08:00
|
|
|
|
},
|
2022-03-30 15:37:55 +08:00
|
|
|
|
areaStyle: {
|
|
|
|
|
|
color: 'rgba(244, 187, 174, 0.59)'
|
|
|
|
|
|
},
|
|
|
|
|
|
color: '#ec836c',
|
|
|
|
|
|
data: [],
|
|
|
|
|
|
showSymbol: false
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-01-04 15:41:06 +08:00
|
|
|
|
name: 'http error ratio',
|
2022-03-30 15:37:55 +08:00
|
|
|
|
type: 'line',
|
|
|
|
|
|
legendHoverLink: false,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
width: 1,
|
|
|
|
|
|
type: 'dashed'
|
|
|
|
|
|
},
|
2024-08-23 16:11:07 +08:00
|
|
|
|
color: '#E48F3E',
|
2022-03-30 15:37:55 +08:00
|
|
|
|
data: [],
|
|
|
|
|
|
showSymbol: false
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2022-03-18 18:25:50 +08:00
|
|
|
|
}
|
2024-08-09 16:09:49 +08:00
|
|
|
|
export const lineOption = {
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
type: 'time',
|
|
|
|
|
|
data: [],
|
|
|
|
|
|
axisTick: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLine: {
|
2024-08-19 15:48:46 +08:00
|
|
|
|
show: true
|
2024-08-09 16:09:49 +08:00
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
formatter: xAxisTimeFormatter,
|
|
|
|
|
|
rich: xAxisTimeRich
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
2024-08-19 15:48:46 +08:00
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}
|
2024-08-09 16:09:49 +08:00
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
top: '12px',
|
|
|
|
|
|
left: '30px',
|
|
|
|
|
|
bottom: '30px',
|
|
|
|
|
|
right: '20px'
|
|
|
|
|
|
},
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
2024-08-14 15:25:50 +08:00
|
|
|
|
name: 'match',
|
2024-08-09 16:09:49 +08:00
|
|
|
|
data: [],
|
|
|
|
|
|
type: 'line',
|
|
|
|
|
|
color: '#ff9a79',
|
2024-08-19 15:48:46 +08:00
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
label: {
|
|
|
|
|
|
position: 'insideStartTop'
|
|
|
|
|
|
},
|
|
|
|
|
|
data: []
|
|
|
|
|
|
}
|
2024-08-09 16:09:49 +08:00
|
|
|
|
}
|
2024-08-12 17:29:50 +08:00
|
|
|
|
],
|
|
|
|
|
|
tooltip: {
|
2024-08-23 17:52:54 +08:00
|
|
|
|
trigger: 'axis',
|
|
|
|
|
|
formatter: function (params) {
|
|
|
|
|
|
const param = JSON.parse(JSON.stringify(params[0]))
|
|
|
|
|
|
param.marker = param.marker.replace('#ff9a79', param.data[2])
|
|
|
|
|
|
const str = `<div style="display: flex;justify-content: space-between"><div>${param.marker}${param.seriesName}</div><div>${param.data[1]}</div></div>`
|
|
|
|
|
|
return `${param.axisValueLabel}<br />${str}`
|
|
|
|
|
|
},
|
|
|
|
|
|
show: true
|
2024-08-12 17:29:50 +08:00
|
|
|
|
}
|
2024-08-09 16:09:49 +08:00
|
|
|
|
}
|