2021-06-20 13:31:55 +08:00
|
|
|
/**
|
|
|
|
|
* @author 陈劲松
|
|
|
|
|
* @date 2021/6/16
|
|
|
|
|
* @description chart option和一些工具
|
|
|
|
|
*/
|
2021-07-05 22:58:12 +08:00
|
|
|
import { format } from 'echarts'
|
2021-07-21 22:46:08 +08:00
|
|
|
import { unitTypes } from '@/utils/constants'
|
|
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2021-07-05 22:58:12 +08:00
|
|
|
import _ from 'lodash'
|
2021-07-06 17:51:17 +08:00
|
|
|
export const chartColor = ['#5370C6', '#90CC74', '#FAC858', '#EE6666',
|
|
|
|
|
'#73BFDE', '#3BA172', '#FC8452', '#9960B4',
|
|
|
|
|
'#E97CCC', '#FEA69E', '#0F8AB2', '#57CBAC',
|
|
|
|
|
'#5888BC', '#63B6AC', '#EDC6B2', '#D5746B']
|
2021-07-06 10:55:09 +08:00
|
|
|
export function getChartColor (index) {
|
|
|
|
|
return chartColor[index % chartColor.length]
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
const line = {
|
2021-07-06 15:57:27 +08:00
|
|
|
tooltip: {
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
textStyle: {
|
2021-07-06 16:34:10 +08:00
|
|
|
width: '20px',
|
2021-07-06 15:57:27 +08:00
|
|
|
overflow: 'truncate'
|
|
|
|
|
},
|
2021-07-07 15:51:52 +08:00
|
|
|
formatter: axiosFormatter,
|
2021-07-15 19:21:23 +08:00
|
|
|
show: true,
|
2021-07-06 16:34:10 +08:00
|
|
|
className: 'nz-chart-tooltip',
|
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important'
|
2021-07-06 15:57:27 +08:00
|
|
|
},
|
2021-06-20 13:31:55 +08:00
|
|
|
xAxis: {
|
|
|
|
|
type: 'time'
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
2021-07-07 15:51:52 +08:00
|
|
|
type: 'value',
|
|
|
|
|
axisLabel: {
|
2021-07-21 22:46:08 +08:00
|
|
|
formatter: function (value, index, a, b) {
|
|
|
|
|
return unitConvert(value, unitTypes.number).join(' ')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
minInterval: 1
|
2021-06-20 13:31:55 +08:00
|
|
|
},
|
2021-07-05 22:58:12 +08:00
|
|
|
animation: false,
|
2021-06-20 13:31:55 +08:00
|
|
|
grid: {
|
|
|
|
|
left: 55,
|
2021-07-10 12:30:06 +08:00
|
|
|
bottom: 30,
|
2021-08-16 18:36:13 +08:00
|
|
|
top: 100,
|
2021-07-10 12:30:06 +08:00
|
|
|
right: 25
|
2021-06-20 13:31:55 +08:00
|
|
|
},
|
2021-07-06 10:55:09 +08:00
|
|
|
color: chartColor,
|
2021-06-20 13:31:55 +08:00
|
|
|
legend: {
|
2021-07-15 19:21:23 +08:00
|
|
|
tooltip: {
|
|
|
|
|
show: true,
|
|
|
|
|
formatter: '{a}'
|
|
|
|
|
},
|
2021-06-20 13:31:55 +08:00
|
|
|
show: true,
|
2021-07-15 19:21:23 +08:00
|
|
|
right: 23,
|
2021-07-10 12:30:06 +08:00
|
|
|
top: 8,
|
2021-08-16 18:36:13 +08:00
|
|
|
padding: 2,
|
2021-06-20 13:31:55 +08:00
|
|
|
orient: 'horizontal',
|
|
|
|
|
icon: 'circle',
|
2021-08-16 18:36:13 +08:00
|
|
|
itemGap: 10,
|
2021-06-20 13:31:55 +08:00
|
|
|
itemWidth: 10,
|
|
|
|
|
textStyle: {
|
2021-08-16 18:36:13 +08:00
|
|
|
padding: [0, 0, 0, 2],
|
2021-06-20 13:31:55 +08:00
|
|
|
fontSize: 14
|
2021-07-05 22:58:12 +08:00
|
|
|
},
|
|
|
|
|
formatter: tooLongFormatter
|
2021-06-20 13:31:55 +08:00
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
fontSize: 14
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
2021-06-29 19:45:44 +08:00
|
|
|
name: '',
|
2021-06-20 13:31:55 +08:00
|
|
|
type: 'line',
|
2021-07-09 21:58:49 +08:00
|
|
|
smooth: false,
|
2021-06-20 13:31:55 +08:00
|
|
|
symbol: 'none',
|
2021-06-29 19:45:44 +08:00
|
|
|
data: []
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-07-05 17:40:43 +08:00
|
|
|
const lineWithStatistics = {
|
2021-07-06 15:57:27 +08:00
|
|
|
tooltip: {
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
textStyle: {
|
2021-07-06 16:34:10 +08:00
|
|
|
width: '20px',
|
2021-07-06 15:57:27 +08:00
|
|
|
overflow: 'truncate'
|
|
|
|
|
},
|
2021-07-07 15:51:52 +08:00
|
|
|
formatter: axiosFormatter,
|
2021-07-06 16:34:10 +08:00
|
|
|
className: 'nz-chart-tooltip',
|
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important'
|
2021-07-06 15:57:27 +08:00
|
|
|
},
|
2021-07-05 17:40:43 +08:00
|
|
|
xAxis: {
|
|
|
|
|
type: 'time'
|
|
|
|
|
},
|
2021-07-05 22:58:12 +08:00
|
|
|
animation: false,
|
2021-07-05 17:40:43 +08:00
|
|
|
yAxis: {
|
2021-07-07 15:51:52 +08:00
|
|
|
type: 'value',
|
|
|
|
|
axisLabel: {
|
2021-07-21 22:46:08 +08:00
|
|
|
formatter: function (value, index) {
|
|
|
|
|
return unitConvert(value, unitTypes.number).join(' ')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
minInterval: 1
|
2021-07-05 17:40:43 +08:00
|
|
|
},
|
2021-07-06 10:55:09 +08:00
|
|
|
color: chartColor,
|
2021-07-05 22:58:12 +08:00
|
|
|
grid: {
|
|
|
|
|
left: 55,
|
2021-07-10 11:18:40 +08:00
|
|
|
bottom: 30,
|
|
|
|
|
top: 20,
|
|
|
|
|
right: 20
|
2021-07-05 22:58:12 +08:00
|
|
|
},
|
2021-07-05 17:40:43 +08:00
|
|
|
legend: {
|
2021-07-05 22:58:12 +08:00
|
|
|
show: false
|
2021-07-05 17:40:43 +08:00
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
fontSize: 14
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: '',
|
|
|
|
|
type: 'line',
|
2021-07-09 21:58:49 +08:00
|
|
|
smooth: false,
|
2021-07-05 17:40:43 +08:00
|
|
|
symbol: 'none',
|
|
|
|
|
data: []
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
const lineStack = {
|
2021-07-06 15:57:27 +08:00
|
|
|
tooltip: {
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
textStyle: {
|
2021-07-06 16:34:10 +08:00
|
|
|
width: '20px',
|
2021-07-06 15:57:27 +08:00
|
|
|
overflow: 'truncate'
|
|
|
|
|
},
|
2021-07-07 15:51:52 +08:00
|
|
|
formatter: axiosFormatter,
|
2021-07-06 16:34:10 +08:00
|
|
|
className: 'nz-chart-tooltip',
|
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important'
|
2021-07-06 15:57:27 +08:00
|
|
|
},
|
2021-06-20 13:31:55 +08:00
|
|
|
xAxis: {
|
|
|
|
|
type: 'time'
|
|
|
|
|
},
|
2021-07-06 10:55:09 +08:00
|
|
|
color: chartColor,
|
2021-06-20 13:31:55 +08:00
|
|
|
yAxis: {
|
2021-07-07 15:51:52 +08:00
|
|
|
type: 'value',
|
|
|
|
|
axisLabel: {
|
2021-07-21 22:46:08 +08:00
|
|
|
formatter: function (value, index) {
|
|
|
|
|
return unitConvert(value, unitTypes.number).join(' ')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
minInterval: 1
|
2021-06-20 13:31:55 +08:00
|
|
|
},
|
|
|
|
|
grid: {
|
|
|
|
|
left: 55,
|
|
|
|
|
bottom: 45,
|
|
|
|
|
top: 10,
|
|
|
|
|
right: 180
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
show: true,
|
|
|
|
|
right: 30,
|
|
|
|
|
top: 'middle',
|
|
|
|
|
orient: 'vertical',
|
|
|
|
|
icon: 'circle',
|
|
|
|
|
itemGap: 20,
|
|
|
|
|
itemWidth: 10,
|
2021-07-05 22:58:12 +08:00
|
|
|
formatter: tooLongFormatter,
|
2021-06-20 13:31:55 +08:00
|
|
|
textStyle: {
|
|
|
|
|
padding: [0, 0, 0, 5],
|
|
|
|
|
fontSize: 14
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
fontSize: 14
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
2021-07-05 22:58:12 +08:00
|
|
|
name: '',
|
2021-06-20 13:31:55 +08:00
|
|
|
type: 'line',
|
|
|
|
|
stack: 'value',
|
|
|
|
|
areaStyle: {},
|
|
|
|
|
symbol: 'none',
|
2021-07-05 22:58:12 +08:00
|
|
|
data: []
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-06-23 10:41:11 +08:00
|
|
|
const pieWithTable = {
|
|
|
|
|
tooltip: {
|
2021-07-20 18:58:55 +08:00
|
|
|
appendToBody: true
|
2021-06-23 10:41:11 +08:00
|
|
|
},
|
2021-07-06 10:55:09 +08:00
|
|
|
color: chartColor,
|
2021-07-05 22:58:12 +08:00
|
|
|
animation: false,
|
2021-06-23 10:41:11 +08:00
|
|
|
legend: {
|
|
|
|
|
orient: 'vertical',
|
2021-06-23 15:57:34 +08:00
|
|
|
type: 'plain',
|
2021-07-05 22:58:12 +08:00
|
|
|
left: '60%',
|
|
|
|
|
top: 'middle',
|
2021-06-23 10:41:11 +08:00
|
|
|
icon: 'circle',
|
|
|
|
|
itemWidth: 10, // 设置宽度
|
|
|
|
|
itemHeight: 10, // 设置高度
|
2021-07-05 22:58:12 +08:00
|
|
|
itemGap: 20,
|
2021-07-20 18:58:55 +08:00
|
|
|
formatter: tooLongFormatter,
|
2021-07-10 12:30:06 +08:00
|
|
|
tooltip: {
|
|
|
|
|
show: true
|
2021-07-20 18:58:55 +08:00
|
|
|
}
|
2021-06-23 10:41:11 +08:00
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: 'pie',
|
2021-07-07 15:51:52 +08:00
|
|
|
selectedMode: 'single',
|
2021-07-10 12:30:06 +08:00
|
|
|
radius: ['42%', '65%'],
|
2021-06-25 19:11:00 +08:00
|
|
|
center: ['30%', '50%'],
|
|
|
|
|
data: [],
|
2021-07-05 22:58:12 +08:00
|
|
|
label: {
|
|
|
|
|
formatter: '{d}%'
|
|
|
|
|
},
|
2021-07-20 18:58:55 +08:00
|
|
|
tooltip: {
|
|
|
|
|
formatter: function (param, index, callback) {
|
2021-07-21 22:46:08 +08:00
|
|
|
return `${param.name}: ${unitConvert(param.value, param.data.unitType).join(' ')}`
|
2021-07-20 18:58:55 +08:00
|
|
|
}
|
|
|
|
|
},
|
2021-06-23 10:41:11 +08:00
|
|
|
emphasis: {
|
|
|
|
|
itemStyle: {
|
|
|
|
|
shadowBlur: 10,
|
|
|
|
|
shadowOffsetX: 0,
|
|
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-09-24 19:24:42 +08:00
|
|
|
const ipHostedDomain = {
|
|
|
|
|
color: chartColor,
|
|
|
|
|
animation: false,
|
|
|
|
|
legend: {
|
|
|
|
|
orient: 'vertical',
|
|
|
|
|
type: 'plain',
|
2021-09-28 17:36:46 +08:00
|
|
|
right: 50,
|
2021-09-24 19:24:42 +08:00
|
|
|
top: 'middle',
|
|
|
|
|
icon: 'circle',
|
|
|
|
|
itemWidth: 10, // 设置宽度
|
|
|
|
|
itemHeight: 10, // 设置高度
|
|
|
|
|
itemGap: 20,
|
|
|
|
|
tooltip: {
|
|
|
|
|
show: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: 'pie',
|
|
|
|
|
selectedMode: 'single',
|
|
|
|
|
radius: ['42%', '65%'],
|
2021-09-28 17:36:46 +08:00
|
|
|
center: ['40%', '50%'],
|
2021-09-24 19:24:42 +08:00
|
|
|
data: [],
|
|
|
|
|
label: {
|
|
|
|
|
formatter: '{d}%'
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
formatter: function (param, index, callback) {
|
|
|
|
|
return `${param.name}: ${unitConvert(param.value, param.data.unitType).join(' ')}`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
itemStyle: {
|
|
|
|
|
shadowBlur: 10,
|
|
|
|
|
shadowOffsetX: 0,
|
|
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-08-11 16:14:03 +08:00
|
|
|
const singleValueLine = {
|
2021-08-10 15:16:56 +08:00
|
|
|
tooltip: {
|
2021-08-16 18:08:38 +08:00
|
|
|
show: true,
|
|
|
|
|
enterable: true,
|
|
|
|
|
showContent: true,
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
textStyle: {
|
|
|
|
|
width: '20px',
|
|
|
|
|
overflow: 'truncate'
|
|
|
|
|
}
|
2021-08-10 15:16:56 +08:00
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'time',
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
animation: false,
|
|
|
|
|
grid: {
|
|
|
|
|
left: 0,
|
2021-08-13 18:57:49 +08:00
|
|
|
bottom: 2,
|
2021-08-11 16:14:03 +08:00
|
|
|
top: 5,
|
2021-08-10 15:16:56 +08:00
|
|
|
right: 0
|
|
|
|
|
},
|
|
|
|
|
color: chartColor,
|
|
|
|
|
legend: {
|
2021-08-13 18:57:49 +08:00
|
|
|
show: false
|
2021-08-10 15:16:56 +08:00
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: 'line',
|
2021-08-13 18:57:49 +08:00
|
|
|
legendHoverLink: false,
|
2021-08-10 15:16:56 +08:00
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: '#81C9FF',
|
|
|
|
|
lineStyle: {
|
2021-08-13 18:57:49 +08:00
|
|
|
width: 2
|
2021-08-10 15:16:56 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data: [],
|
|
|
|
|
showSymbol: false,
|
|
|
|
|
areaStyle: { color: '#C9EAFF' }
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-09-30 00:50:11 +08:00
|
|
|
export const entityListLineOption = {
|
|
|
|
|
tooltip: {
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
textStyle: {
|
|
|
|
|
width: '20px',
|
|
|
|
|
overflow: 'truncate'
|
|
|
|
|
},
|
|
|
|
|
formatter: axiosFormatter,
|
|
|
|
|
show: true,
|
|
|
|
|
className: 'nz-chart-tooltip',
|
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important'
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'time',
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
animation: false,
|
|
|
|
|
grid: {
|
|
|
|
|
left: 0,
|
|
|
|
|
bottom: 2,
|
|
|
|
|
top: 5,
|
|
|
|
|
right: 0
|
|
|
|
|
},
|
|
|
|
|
color: chartColor,
|
|
|
|
|
legend: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: 'line',
|
|
|
|
|
legendHoverLink: false,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
lineStyle: {
|
|
|
|
|
width: 2
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data: [],
|
|
|
|
|
showSymbol: false
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-08-19 18:50:50 +08:00
|
|
|
const relationShip = {
|
|
|
|
|
grid: {
|
|
|
|
|
left: 0,
|
|
|
|
|
bottom: 50,
|
|
|
|
|
top: 80,
|
|
|
|
|
right: 0
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: 'graph',
|
|
|
|
|
layout: 'force',
|
|
|
|
|
symbolSize: 40,
|
|
|
|
|
roam: true,
|
|
|
|
|
force: {
|
|
|
|
|
repulsion: 350
|
|
|
|
|
},
|
|
|
|
|
draggable: true,
|
|
|
|
|
label: { show: true },
|
|
|
|
|
edgeSymbol: ['none', 'arrow'],
|
|
|
|
|
edgeSymbolSize: 7,
|
|
|
|
|
data: [],
|
|
|
|
|
links: []
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-09-22 09:08:21 +08:00
|
|
|
const sankey = {
|
2021-09-18 17:48:52 +08:00
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'item',
|
|
|
|
|
triggerOn: 'mousemove'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
type: 'sankey',
|
|
|
|
|
data: [],
|
|
|
|
|
links: [],
|
|
|
|
|
levels: [
|
|
|
|
|
{
|
|
|
|
|
depth: 0,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
color: '#47D49C'
|
|
|
|
|
},
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: '#999'
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
depth: 1,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
color: '#A69BF5'
|
|
|
|
|
},
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: '#999'
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
depth: 2,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
color: '#73A0FA'
|
|
|
|
|
},
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: '#999'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2021-09-22 09:08:21 +08:00
|
|
|
const ipOpenPortBar = {
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
axisLine: { show: false }
|
|
|
|
|
},
|
|
|
|
|
grid: {
|
|
|
|
|
top: 30,
|
|
|
|
|
left: 60,
|
|
|
|
|
right: 50,
|
|
|
|
|
bottom: 50
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
series: [{
|
|
|
|
|
barWidth: 38,
|
|
|
|
|
data: [],
|
|
|
|
|
type: 'bar',
|
|
|
|
|
label: { show: true, position: 'top' },
|
|
|
|
|
barCategoryGap: '10%'
|
|
|
|
|
}]
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
const typeOptionMappings = [
|
|
|
|
|
{ value: 11, option: line }, // 常规折线图
|
2021-07-05 17:40:43 +08:00
|
|
|
{ value: 12, option: lineWithStatistics }, // 带统计表格的折线图
|
|
|
|
|
{ value: 13, option: lineStack }, // 折线堆叠图
|
2021-09-22 09:08:21 +08:00
|
|
|
{ value: 22, option: ipOpenPortBar }, // ip详情--开放端口的柱状图
|
2021-08-10 15:16:56 +08:00
|
|
|
{ value: 31, option: pieWithTable }, // 常规折线图
|
2021-09-24 19:24:42 +08:00
|
|
|
{ value: 33, option: ipHostedDomain }, // ip详情--托管域名
|
|
|
|
|
{ value: 34, option: ipHostedDomain }, // app详情--相关域名
|
2021-08-19 18:50:50 +08:00
|
|
|
{ value: 42, option: relationShip }, // 关系图
|
2021-09-22 09:08:21 +08:00
|
|
|
{ value: 43, option: sankey }, // 桑基图
|
2021-08-11 16:14:03 +08:00
|
|
|
{ value: 52, option: singleValueLine }
|
2021-06-20 13:31:55 +08:00
|
|
|
]
|
|
|
|
|
const typeCategory = {
|
2021-06-24 17:59:51 +08:00
|
|
|
MAP: 'map',
|
2021-06-20 13:31:55 +08:00
|
|
|
TABLE: 'table',
|
|
|
|
|
ECHARTS: 'echarts',
|
|
|
|
|
TITLE: 'title',
|
2021-07-01 21:39:10 +08:00
|
|
|
SINGLE: 'singleValue',
|
|
|
|
|
TABS: 'tabs'
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
|
|
|
|
export function getTypeCategory (type) {
|
2021-06-24 17:59:51 +08:00
|
|
|
if (isMap(type)) {
|
|
|
|
|
return typeCategory.MAP
|
|
|
|
|
} else if (isEcharts(type)) {
|
2021-06-20 13:31:55 +08:00
|
|
|
return typeCategory.ECHARTS
|
|
|
|
|
} else if (isTable(type)) {
|
|
|
|
|
return typeCategory.TABLE
|
|
|
|
|
} else if (isSingleValue(type)) {
|
|
|
|
|
return typeCategory.SINGLE
|
|
|
|
|
} else if (isTitle(type)) {
|
|
|
|
|
return typeCategory.TITLE
|
2021-07-01 21:39:10 +08:00
|
|
|
} else if (isTabs(type)) {
|
|
|
|
|
return typeCategory.TABS
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* 饼图柱状图等 */
|
|
|
|
|
export function isEcharts (type) {
|
2021-06-24 17:59:51 +08:00
|
|
|
return type >= 11 && type <= 50
|
|
|
|
|
}
|
|
|
|
|
/* 地图 */
|
|
|
|
|
export function isMap (type) {
|
|
|
|
|
return type >= 1 && type <= 10
|
|
|
|
|
}
|
|
|
|
|
/* 连线地图 */
|
|
|
|
|
export function isMapLine (type) {
|
|
|
|
|
return type === 1
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
2021-07-10 12:11:59 +08:00
|
|
|
/* 色块地图 */
|
|
|
|
|
export function isMapBlock (type) {
|
|
|
|
|
return type === 2
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
/* 带统计的折线图 */
|
|
|
|
|
export function isEchartsWithStatistics (type) {
|
|
|
|
|
return type === 12
|
|
|
|
|
}
|
2021-08-17 17:56:09 +08:00
|
|
|
/* 关系图 */
|
|
|
|
|
export function isRelationShip (type) {
|
|
|
|
|
return type === 42
|
|
|
|
|
}
|
2021-09-18 17:48:52 +08:00
|
|
|
/* 桑基图 */
|
|
|
|
|
export function isSankey (type) {
|
|
|
|
|
return type === 43
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
/* 单值 */
|
|
|
|
|
export function isSingleValue (type) {
|
|
|
|
|
return type >= 51 && type <= 60
|
|
|
|
|
}
|
|
|
|
|
/* 带折线图的单值 */
|
|
|
|
|
export function isSingleValueWithEcharts (type) {
|
|
|
|
|
return type === 52
|
|
|
|
|
}
|
2021-06-22 21:19:04 +08:00
|
|
|
/* 带Table的饼图 */
|
|
|
|
|
export function isEchartsWithTable (type) {
|
|
|
|
|
return type === 31
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
/* table */
|
|
|
|
|
export function isTable (type) {
|
|
|
|
|
return type >= 61 && type <= 70
|
|
|
|
|
}
|
2021-07-01 21:39:10 +08:00
|
|
|
/* title */
|
2021-06-20 13:31:55 +08:00
|
|
|
export function isTitle (type) {
|
2021-07-01 21:39:10 +08:00
|
|
|
return type === 93
|
|
|
|
|
}
|
|
|
|
|
/* tabs */
|
|
|
|
|
export function isTabs (type) {
|
|
|
|
|
return type === 91
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
2021-09-15 20:11:07 +08:00
|
|
|
/* IP实体基本信息 */
|
|
|
|
|
export function isIpBasicInfo (type) {
|
|
|
|
|
return type === 4
|
|
|
|
|
}
|
|
|
|
|
/* IP实体开放端口 */
|
|
|
|
|
export function isIpOpenPort (type) {
|
|
|
|
|
return type === 22
|
|
|
|
|
}
|
|
|
|
|
/* IP实体托管域名 */
|
|
|
|
|
export function isIpHostedDomain (type) {
|
|
|
|
|
return type === 33
|
|
|
|
|
}
|
2021-09-24 19:24:42 +08:00
|
|
|
/* APP实体相关域名 */
|
2021-09-22 23:05:18 +08:00
|
|
|
export function isAppRelatedDomain (type) {
|
|
|
|
|
return type === 34
|
|
|
|
|
}
|
|
|
|
|
/* APP实体基本信息 */
|
|
|
|
|
export function isAppBasicInfo (type) {
|
|
|
|
|
return type === 82
|
|
|
|
|
}
|
|
|
|
|
/* DOMAIN实体Whois */
|
|
|
|
|
export function isDomainWhois (type) {
|
|
|
|
|
return type === 83
|
|
|
|
|
}
|
|
|
|
|
/* DOMAIN实体DNS记录 */
|
|
|
|
|
export function isDomainDnsRecord (type) {
|
|
|
|
|
return type === 84
|
|
|
|
|
}
|
2021-09-16 21:19:48 +08:00
|
|
|
/* 组 */
|
|
|
|
|
export function isGroup (type) {
|
|
|
|
|
return type === 94
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
export function getOption (type) {
|
|
|
|
|
const mapping = typeOptionMappings.find(m => m.value === type)
|
2021-07-05 22:58:12 +08:00
|
|
|
return mapping && mapping.option ? _.cloneDeep(mapping.option) : null
|
2021-06-20 13:31:55 +08:00
|
|
|
}
|
|
|
|
|
export const layoutConstant = {
|
|
|
|
|
HEADER: 'header',
|
|
|
|
|
FOOTER: 'footer'
|
|
|
|
|
}
|
|
|
|
|
export function getLayout (type) {
|
|
|
|
|
const layout = []
|
|
|
|
|
if (!isSingleValue(type) && !isTitle(type)) {
|
|
|
|
|
layout.push(layoutConstant.HEADER)
|
|
|
|
|
}
|
|
|
|
|
if (type === 12 || type === 31) {
|
|
|
|
|
layout.push(layoutConstant.FOOTER)
|
|
|
|
|
}
|
|
|
|
|
return layout
|
|
|
|
|
}
|
2021-07-05 22:58:12 +08:00
|
|
|
|
|
|
|
|
function tooLongFormatter (name) {
|
|
|
|
|
return format.truncateText(name, 110, '12')
|
|
|
|
|
}
|
2021-07-07 15:51:52 +08:00
|
|
|
function axiosFormatter (params) {
|
|
|
|
|
let str = '<div>'
|
|
|
|
|
params.forEach((item, i) => {
|
|
|
|
|
const tData = item.data[0]
|
|
|
|
|
if (i === 0) {
|
|
|
|
|
str += '<div style="margin-bottom: 5px">'
|
|
|
|
|
str += window.$dayJs.tz(tData).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
str += '</div>'
|
|
|
|
|
}
|
|
|
|
|
str += '<div class="cn-chart-tooltip-box">'
|
|
|
|
|
str += item.marker
|
|
|
|
|
str += `<span class="cn-chart-tooltip-content">
|
|
|
|
|
${item.seriesName}
|
|
|
|
|
</span>`
|
|
|
|
|
str += `<span class="cn-chart-tooltip-value">
|
2021-07-21 22:46:08 +08:00
|
|
|
${unitConvert(item.data[1], item.data[2]).join(' ')}
|
2021-07-07 15:51:52 +08:00
|
|
|
</span>`
|
|
|
|
|
str += '</div>'
|
|
|
|
|
})
|
|
|
|
|
str += '</div>'
|
|
|
|
|
return str
|
|
|
|
|
}
|