2022-07-08 14:11:30 +08:00
|
|
|
import { chartColor1, chartColor2, chartColor3 } from '@/utils/constants'
|
2022-07-11 16:36:11 +08:00
|
|
|
import * as echarts from 'echarts'
|
2022-07-08 09:34:09 +08:00
|
|
|
|
|
|
|
|
export const pieChartOption1 = {
|
|
|
|
|
color: chartColor1,
|
|
|
|
|
legend: {
|
|
|
|
|
orient: 'vertical',
|
2022-07-11 16:36:11 +08:00
|
|
|
top: 45,
|
|
|
|
|
left: '50%',
|
|
|
|
|
itemGap: 4,
|
2022-07-08 09:34:09 +08:00
|
|
|
itemWidth: 15,
|
2022-07-11 16:36:11 +08:00
|
|
|
itemHeight: 7,
|
|
|
|
|
textStyle: {
|
|
|
|
|
fontFamily: 'SimHei',
|
|
|
|
|
rich: {
|
|
|
|
|
a: {
|
|
|
|
|
width: 35,
|
|
|
|
|
align: 'left'
|
|
|
|
|
},
|
|
|
|
|
b: {
|
|
|
|
|
width: 6,
|
|
|
|
|
align: 'left',
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: '#575757'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
formatter: function (name) {
|
|
|
|
|
const data = pieChartOption1.series[0].data
|
|
|
|
|
let value
|
|
|
|
|
data.forEach(t => {
|
|
|
|
|
if (t.name === name) {
|
|
|
|
|
value = t.describe
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const arr = ['{a|' + ' ' + name + '}' + '{b|' + value + '}']
|
|
|
|
|
return arr
|
|
|
|
|
}
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
2022-07-11 16:36:11 +08:00
|
|
|
right: '50%',
|
2022-07-08 09:34:09 +08:00
|
|
|
name: 'Access From',
|
|
|
|
|
type: 'pie',
|
2022-07-11 16:36:11 +08:00
|
|
|
radius: ['40%', '60%'],
|
2022-07-08 09:34:09 +08:00
|
|
|
avoidLabelOverlap: false,
|
|
|
|
|
label: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
labelLine: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
export const pieChartOption2 = {
|
|
|
|
|
legend: {
|
|
|
|
|
orient: 'vertical',
|
2022-07-11 16:36:11 +08:00
|
|
|
top: 45,
|
|
|
|
|
left: '50%',
|
|
|
|
|
itemGap: 4,
|
2022-07-08 09:34:09 +08:00
|
|
|
itemWidth: 15,
|
2022-07-11 16:36:11 +08:00
|
|
|
itemHeight: 7,
|
|
|
|
|
textStyle: {
|
|
|
|
|
fontFamily: 'SimHei',
|
|
|
|
|
rich: {
|
|
|
|
|
a: {
|
|
|
|
|
width: 35,
|
|
|
|
|
align: 'left'
|
|
|
|
|
},
|
|
|
|
|
b: {
|
|
|
|
|
width: 6,
|
|
|
|
|
align: 'left',
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: '#575757'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
formatter: function (name) {
|
|
|
|
|
const data = pieChartOption2.series[0].data
|
|
|
|
|
let value
|
|
|
|
|
data.forEach(t => {
|
|
|
|
|
if (t.name === name) {
|
|
|
|
|
value = t.describe
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const arr = ['{a|' + ' ' + name + '}' + '{b|' + value + '}']
|
|
|
|
|
return arr
|
|
|
|
|
}
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
color: chartColor2,
|
|
|
|
|
series: [
|
|
|
|
|
{
|
2022-07-11 16:36:11 +08:00
|
|
|
right: '50%',
|
2022-07-08 09:34:09 +08:00
|
|
|
name: 'Access From',
|
|
|
|
|
type: 'pie',
|
2022-07-11 16:36:11 +08:00
|
|
|
radius: ['40%', '60%'],
|
2022-07-08 09:34:09 +08:00
|
|
|
avoidLabelOverlap: false,
|
|
|
|
|
label: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
labelLine: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
export const stackedLineChartOption = {
|
2022-07-08 14:11:30 +08:00
|
|
|
color: chartColor3,
|
2022-07-08 09:34:09 +08:00
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
axisPointer: {
|
|
|
|
|
type: 'cross',
|
|
|
|
|
label: {
|
|
|
|
|
backgroundColor: '#6a7985'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
type: 'scroll',
|
|
|
|
|
top: 10,
|
|
|
|
|
left: 20,
|
2022-07-11 16:36:11 +08:00
|
|
|
itemGap: 60,
|
|
|
|
|
itemWidth: 11,
|
2022-07-08 09:34:09 +08:00
|
|
|
itemHeight: 14
|
|
|
|
|
},
|
|
|
|
|
grid: {
|
2022-07-08 14:11:30 +08:00
|
|
|
top: '30%',
|
2022-07-08 09:34:09 +08:00
|
|
|
left: '1%',
|
|
|
|
|
right: '2%',
|
|
|
|
|
bottom: 15,
|
|
|
|
|
containLabel: true
|
|
|
|
|
},
|
|
|
|
|
xAxis: [
|
|
|
|
|
{
|
2022-07-11 16:36:11 +08:00
|
|
|
type: 'time',
|
|
|
|
|
splitNumber: 12,
|
|
|
|
|
axisLabel: {
|
|
|
|
|
formatter: function (value) {
|
|
|
|
|
const data = new Date(value)
|
|
|
|
|
const h = data.getHours() > 9 ? data.getHours() : '0' + data.getHours()
|
|
|
|
|
const m = data.getMinutes() > 9 ? data.getMinutes() : '0' + data.getMinutes()
|
|
|
|
|
return h + ':' + m
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-08 09:34:09 +08:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis: [
|
|
|
|
|
{
|
|
|
|
|
type: 'value'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Total',
|
|
|
|
|
type: 'line',
|
|
|
|
|
stack: 'Total',
|
2022-07-11 16:36:11 +08:00
|
|
|
symbol: 'circle',
|
2022-07-08 09:34:09 +08:00
|
|
|
smooth: true,
|
|
|
|
|
showSymbol: false,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
lineStyle: {
|
|
|
|
|
color: chartColor3[0],
|
|
|
|
|
width: 1
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: chartColor3[0]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: chartColor3[0]
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Inbound',
|
|
|
|
|
type: 'line',
|
|
|
|
|
stack: 'Total',
|
2022-07-11 16:36:11 +08:00
|
|
|
symbol: 'circle',
|
2022-07-08 09:34:09 +08:00
|
|
|
smooth: true,
|
|
|
|
|
showSymbol: false,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
lineStyle: {
|
|
|
|
|
color: chartColor3[1],
|
|
|
|
|
width: 1
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: chartColor3[1]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: chartColor3[1]
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Outbound',
|
|
|
|
|
type: 'line',
|
|
|
|
|
stack: 'Total',
|
2022-07-11 16:36:11 +08:00
|
|
|
symbol: 'circle',
|
2022-07-08 09:34:09 +08:00
|
|
|
smooth: true,
|
|
|
|
|
showSymbol: false,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
lineStyle: {
|
|
|
|
|
color: chartColor3[2],
|
|
|
|
|
width: 1
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: chartColor3[2]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: chartColor3[2]
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Internal',
|
|
|
|
|
type: 'line',
|
|
|
|
|
stack: 'Total',
|
2022-07-11 16:36:11 +08:00
|
|
|
symbol: 'circle',
|
2022-07-08 09:34:09 +08:00
|
|
|
smooth: true,
|
|
|
|
|
showSymbol: false,
|
2022-07-11 16:36:11 +08:00
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
2022-07-08 09:34:09 +08:00
|
|
|
lineStyle: {
|
2022-07-11 16:36:11 +08:00
|
|
|
color: chartColor3[3],
|
|
|
|
|
width: 1
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
areaStyle: {
|
2022-07-11 16:36:11 +08:00
|
|
|
opacity: 0.1,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: chartColor3[3]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: chartColor3[3]
|
|
|
|
|
}
|
|
|
|
|
])
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Other',
|
|
|
|
|
type: 'line',
|
|
|
|
|
stack: 'Total',
|
2022-07-11 16:36:11 +08:00
|
|
|
symbol: 'circle',
|
2022-07-08 09:34:09 +08:00
|
|
|
smooth: true,
|
|
|
|
|
showSymbol: false,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
lineStyle: {
|
|
|
|
|
color: chartColor3[4],
|
|
|
|
|
width: 1
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: chartColor3[4]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: chartColor3[4]
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
data: []
|
2022-07-08 09:34:09 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|