2022-07-06 21:08:12 +08:00
|
|
|
<template>
|
2022-07-15 14:27:11 +08:00
|
|
|
<div class="line network">
|
2022-07-12 20:13:51 +08:00
|
|
|
<div class="chart-drawing" id="chart"></div>
|
2022-07-21 10:19:03 +08:00
|
|
|
<div class="line-value-active"></div>
|
|
|
|
|
<div class="line-value" >
|
|
|
|
|
<div class="line-value-mpackets"
|
|
|
|
|
v-show="item.show"
|
|
|
|
|
:class=" {'is-active': activeShow === item.class, 'mousemove-cursor': mousemoveCursor === item.class}"
|
|
|
|
|
v-for="(item, index) in mpackets"
|
|
|
|
|
:key="index"
|
|
|
|
|
@mouseenter="mouseenter(item)"
|
|
|
|
|
@mouseleave="mouseleave(item)"
|
|
|
|
|
@click="activeChange(item, index)">
|
|
|
|
|
<div class="line-value-mpackets-name">
|
2022-07-14 17:07:07 +08:00
|
|
|
<div :class="item.class"></div>
|
|
|
|
|
<div class="mpackets-name">{{$t(item.name)}}</div>
|
|
|
|
|
</div>
|
2022-08-02 20:17:47 +08:00
|
|
|
<div><span>{{unitConvert(item.analysis.avg, unitTypes.number)[0]}}</span><span>{{unitConvert(item.analysis.avg, unitTypes.number)[1]}}packets/s</span></div>
|
2022-07-14 17:07:07 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-07-08 14:11:30 +08:00
|
|
|
<div class="line-select">
|
|
|
|
|
<div class="line-select-metric">
|
2022-07-08 09:34:09 +08:00
|
|
|
<span>{{$t('network.metric')}}:</span>
|
2022-07-08 14:11:30 +08:00
|
|
|
<div class="line-select__operation">
|
|
|
|
|
<el-select
|
|
|
|
|
size="mini"
|
2022-07-08 17:06:24 +08:00
|
|
|
v-model="value1"
|
2022-07-21 15:06:24 +08:00
|
|
|
popper-class="metric"
|
2022-07-21 10:19:03 +08:00
|
|
|
@change="metricSelectChange"
|
2022-07-08 14:11:30 +08:00
|
|
|
>
|
2022-07-08 17:06:24 +08:00
|
|
|
<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
2022-07-08 14:11:30 +08:00
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="line-select-reference-line">
|
2022-07-08 09:34:09 +08:00
|
|
|
<span>{{$t('network.referenceLine')}}:</span>
|
2022-07-08 14:11:30 +08:00
|
|
|
<div class="line-select__operation">
|
|
|
|
|
<el-select
|
|
|
|
|
size="mini"
|
2022-07-08 17:06:24 +08:00
|
|
|
v-model="value2"
|
2022-08-02 20:17:47 +08:00
|
|
|
:disabled="activeShow === ''"
|
2022-07-21 15:06:24 +08:00
|
|
|
popper-class="reference-line"
|
2022-07-30 15:30:03 +08:00
|
|
|
@change="referenceSelectChange"
|
2022-07-08 14:11:30 +08:00
|
|
|
>
|
2022-07-08 17:06:24 +08:00
|
|
|
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
2022-07-08 14:11:30 +08:00
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-07-08 09:34:09 +08:00
|
|
|
</div>
|
2022-07-06 21:08:12 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-07-08 09:34:09 +08:00
|
|
|
import * as echarts from 'echarts'
|
2022-07-14 17:07:07 +08:00
|
|
|
import { stackedLineChartOption } from '@/views/charts2/charts/options/echartOption'
|
2022-07-08 14:11:30 +08:00
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2022-07-21 10:19:03 +08:00
|
|
|
import { unitTypes, chartColor3, chartColor4 } from '@/utils/constants.js'
|
2022-07-11 16:36:11 +08:00
|
|
|
import { shallowRef } from 'vue'
|
2022-07-12 20:13:51 +08:00
|
|
|
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
2022-08-02 20:17:47 +08:00
|
|
|
import _ from 'lodash'
|
|
|
|
|
import { get } from '@/utils/http'
|
|
|
|
|
import { api } from '@/utils/api'
|
2022-08-05 15:50:54 +08:00
|
|
|
import { getSecond } from '@/utils/date-util'
|
2022-07-06 21:08:12 +08:00
|
|
|
export default {
|
2022-07-08 09:34:09 +08:00
|
|
|
name: 'NetworkOverviewLine',
|
|
|
|
|
props: {
|
2022-08-02 20:17:47 +08:00
|
|
|
chart: Object,
|
|
|
|
|
timeFilter: Object
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
setup () {
|
|
|
|
|
return {
|
|
|
|
|
myChart: shallowRef(null)
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-07-08 09:34:09 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2022-07-08 17:06:24 +08:00
|
|
|
options1: [
|
2022-07-08 09:34:09 +08:00
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
value: 'Bits/s',
|
|
|
|
|
label: 'Bits/s'
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
value: 'Packets/s',
|
|
|
|
|
label: 'Packets/s'
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
value: 'Sessions/s',
|
|
|
|
|
label: 'Sessions/s'
|
2022-07-11 16:36:11 +08:00
|
|
|
}
|
2022-07-08 17:06:24 +08:00
|
|
|
],
|
2022-07-21 15:06:24 +08:00
|
|
|
value1: 'Bits/s',
|
2022-07-08 17:06:24 +08:00
|
|
|
options2: [
|
|
|
|
|
{
|
|
|
|
|
value: 'Average',
|
|
|
|
|
label: 'Average'
|
|
|
|
|
},
|
2022-07-08 09:34:09 +08:00
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
value: '95th Percentile',
|
|
|
|
|
label: '95th Percentile'
|
2022-07-08 09:34:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
value: 'Maximum',
|
|
|
|
|
label: 'Maximum'
|
2022-07-11 16:36:11 +08:00
|
|
|
}
|
2022-07-08 14:11:30 +08:00
|
|
|
],
|
2022-07-21 15:06:24 +08:00
|
|
|
value2: 'Average',
|
2022-07-14 17:07:07 +08:00
|
|
|
mpackets: [
|
2022-08-02 20:17:47 +08:00
|
|
|
{ analysis: {}, name: 'network.total', class: 'total', show: true, positioning: 0, data: [] },
|
|
|
|
|
{ analysis: {}, name: 'network.inbound', class: 'inbound', show: true, positioning: 1, data: [] },
|
|
|
|
|
{ analysis: {}, name: 'network.outbound', class: 'outbound', show: true, positioning: 2, data: [] },
|
|
|
|
|
{ analysis: {}, name: 'network.internal', class: 'internal', show: true, positioning: 3, data: [] },
|
|
|
|
|
{ analysis: {}, name: 'network.through', class: 'through', show: true, positioning: 4, data: [] },
|
|
|
|
|
{ analysis: {}, name: 'network.other', class: 'other', show: true, positioning: 5, data: [] }
|
2022-07-14 17:07:07 +08:00
|
|
|
],
|
2022-07-11 16:36:11 +08:00
|
|
|
unitConvert,
|
2022-07-12 20:13:51 +08:00
|
|
|
unitTypes,
|
2022-07-14 17:07:07 +08:00
|
|
|
chartDateObject: [],
|
2022-07-21 10:19:03 +08:00
|
|
|
timer: null,
|
2022-08-02 20:17:47 +08:00
|
|
|
activeShow: '',
|
2022-07-21 10:19:03 +08:00
|
|
|
mousemoveCursor: '',
|
|
|
|
|
leftOffset: 0,
|
2022-07-30 15:30:03 +08:00
|
|
|
sizes: [3, 4, 6, 8, 9, 10],
|
2022-08-02 20:17:47 +08:00
|
|
|
echartsLabelValue: '',
|
|
|
|
|
echartsType: 'Bits/s',
|
|
|
|
|
echartsData: {}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
activeShow (n) {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.handleActiveBar(n)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
init (val) {
|
|
|
|
|
if (!val) {
|
|
|
|
|
val = 'Bits/s'
|
|
|
|
|
}
|
|
|
|
|
const params = {
|
2022-08-05 15:50:54 +08:00
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime)
|
2022-08-02 20:17:47 +08:00
|
|
|
}
|
|
|
|
|
get(api.netWorkOverview.totalTrafficAnalysis, params).then((res) => {
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
res.data.result.forEach((t, i) => {
|
|
|
|
|
if (t.type === 'bytes' && val === 'Bits/s') {
|
|
|
|
|
this.mpackets[0].analysis = t.totalBitsRate.analysis
|
|
|
|
|
this.mpackets[1].analysis = t.inboundBitsRate.analysis
|
|
|
|
|
this.mpackets[2].analysis = t.outboundBitsRate.analysis
|
|
|
|
|
this.mpackets[3].analysis = t.internalBitsRate.analysis
|
|
|
|
|
this.mpackets[4].analysis = t.externalBitsRate.analysis
|
2022-08-05 15:50:54 +08:00
|
|
|
this.mpackets[5].analysis = t.other.analysis
|
2022-08-02 20:17:47 +08:00
|
|
|
this.mpackets[0].data = t.totalBitsRate.values ? t.totalBitsRate.values : []
|
|
|
|
|
this.mpackets[1].data = t.inboundBitsRate.values ? t.inboundBitsRate.values : []
|
|
|
|
|
this.mpackets[2].data = t.outboundBitsRate.values ? t.outboundBitsRate.values : []
|
|
|
|
|
this.mpackets[3].data = t.internalBitsRate.values ? t.internalBitsRate.values : []
|
|
|
|
|
this.mpackets[4].data = t.externalBitsRate.values ? t.externalBitsRate.values : []
|
2022-08-05 15:50:54 +08:00
|
|
|
this.mpackets[5].data = t.other.values ? t.other.values : []
|
|
|
|
|
this.mpackets.forEach(t => {
|
|
|
|
|
if (t.name !== 'network.total' && t.analysis.avg == 0) {
|
|
|
|
|
t.show = false
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-08-02 20:17:47 +08:00
|
|
|
this.echartsInit(this.mpackets)
|
|
|
|
|
} else if (t.type === 'packets' && val === 'Packets/s') {
|
|
|
|
|
this.mpackets[0].analysis = t.totalPacketsRate.analysis
|
|
|
|
|
this.mpackets[1].analysis = t.inboundPacketsRate.analysis
|
|
|
|
|
this.mpackets[2].analysis = t.outboundPacketsRate.analysis
|
|
|
|
|
this.mpackets[3].analysis = t.internalPacketsRate.analysis
|
|
|
|
|
this.mpackets[4].analysis = t.externalPacketsRate.analysis
|
2022-08-05 15:50:54 +08:00
|
|
|
this.mpackets[5].analysis = t.other.analysis
|
2022-08-02 20:17:47 +08:00
|
|
|
this.mpackets[0].data = t.totalPacketsRate.values ? t.totalPacketsRate.values : []
|
|
|
|
|
this.mpackets[1].data = t.inboundPacketsRate.values ? t.inboundPacketsRate.values : []
|
|
|
|
|
this.mpackets[2].data = t.outboundPacketsRate.values ? t.outboundPacketsRate.values : []
|
|
|
|
|
this.mpackets[3].data = t.internalPacketsRate.values ? t.internalPacketsRate.values : []
|
|
|
|
|
this.mpackets[4].data = t.externalPacketsRate.values ? t.externalPacketsRate.values : []
|
2022-08-05 15:50:54 +08:00
|
|
|
this.mpackets[5].data = t.other.values ? t.other.values : []
|
|
|
|
|
this.mpackets.forEach(t => {
|
|
|
|
|
if (t.name !== 'network.total' && t.analysis.avg == 0) {
|
|
|
|
|
t.show = false
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-08-02 20:17:47 +08:00
|
|
|
this.echartsInit(this.mpackets)
|
|
|
|
|
} else if (t.type === 'sessions' && val === 'Sessions/s') {
|
|
|
|
|
this.mpackets[0].analysis = t.totalSessionsRate.analysis
|
|
|
|
|
this.mpackets[0].data = t.totalSessionsRate.values ? t.totalSessionsRate.values : []
|
|
|
|
|
this.echartsInit(this.mpackets)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
echartsInit (echartsData) {
|
|
|
|
|
const _this = this
|
|
|
|
|
echartsData = echartsData.filter(t => t.show === true)
|
|
|
|
|
const dom = document.getElementById('chart')
|
|
|
|
|
this.myChart = echarts.init(dom)
|
|
|
|
|
this.chartOption = stackedLineChartOption
|
2022-07-21 10:19:03 +08:00
|
|
|
const chartOption = this.chartOption.series[0]
|
2022-08-02 20:17:47 +08:00
|
|
|
this.chartOption.series = echartsData.map((t, i) => {
|
2022-07-21 10:19:03 +08:00
|
|
|
return {
|
|
|
|
|
...chartOption,
|
|
|
|
|
name: t.name,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: chartColor3[t.positioning],
|
|
|
|
|
width: 1
|
|
|
|
|
},
|
2022-08-05 15:50:54 +08:00
|
|
|
stack: t.name !== 'network.total' ? 'network.total' : '',
|
2022-07-21 10:19:03 +08:00
|
|
|
symbolSize: function (value, params) {
|
|
|
|
|
return _this.symbolSizeSortChange(i, value[0])
|
|
|
|
|
},
|
|
|
|
|
itemStyle: {
|
|
|
|
|
emphasis: {
|
|
|
|
|
borderColor: chartColor4[t.positioning],
|
|
|
|
|
borderWidth: 2,
|
|
|
|
|
shadowColor: chartColor4[t.positioning],
|
2022-08-02 20:17:47 +08:00
|
|
|
shadowBlur: this.sizes[t.positioning] + 2
|
2022-07-21 10:19:03 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: chartColor3[t.positioning]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: chartColor3[t.positioning]
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
},
|
2022-08-02 20:17:47 +08:00
|
|
|
data: t.data.map(v => [Number(v[0]) * 1000, Number(v[1])]),
|
2022-07-26 17:18:54 +08:00
|
|
|
markLine: {
|
|
|
|
|
silent: true,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: '#B4B1A8'
|
|
|
|
|
},
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
label: {
|
|
|
|
|
formatter (params) {
|
|
|
|
|
const arr = unitConvert(params.value, unitTypes.number).join('')
|
2022-07-30 15:30:03 +08:00
|
|
|
return _this.echartsLabelValue + '(' + arr + 'packets/s' + ')'
|
2022-07-26 17:18:54 +08:00
|
|
|
},
|
|
|
|
|
position: 'insideStartTop',
|
|
|
|
|
color: '#717171',
|
|
|
|
|
fontFamily: 'NotoSansSChineseRegular'
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
}
|
|
|
|
|
})
|
2022-08-02 20:17:47 +08:00
|
|
|
if (this.echartsLabelValue === 'Average') {
|
|
|
|
|
this.chartOption.series.forEach((t, i) => {
|
|
|
|
|
t.markLine.data = [
|
|
|
|
|
{
|
|
|
|
|
yAxis: echartsData[i].analysis.avg
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
} else if (this.echartsLabelValue === '95th Percentile') {
|
|
|
|
|
this.chartOption.series.forEach((t, i) => {
|
|
|
|
|
t.markLine.data = [
|
|
|
|
|
{ yAxis: echartsData[i].analysis.p95 }
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
} else if (this.echartsLabelValue === 'Maximum') {
|
|
|
|
|
this.chartOption.series.forEach((t, i) => {
|
|
|
|
|
t.markLine.data = [
|
|
|
|
|
{ yAxis: echartsData[i].analysis.max }
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
this.chartOption.tooltip.formatter = (params) => {
|
|
|
|
|
params.forEach(t => {
|
|
|
|
|
t.seriesName = this.$t(t.seriesName)
|
|
|
|
|
})
|
|
|
|
|
const str = stackedLineTooltipFormatter(params)
|
|
|
|
|
return str
|
|
|
|
|
}
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
},
|
|
|
|
|
activeChange (item, index) {
|
2022-08-02 20:17:47 +08:00
|
|
|
if (!this.echartsLabelValue) {
|
|
|
|
|
this.echartsLabelValue = 'Average'
|
|
|
|
|
} else {
|
|
|
|
|
this.echartsLabelValue = this.echartsLabelValue
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
this.activeShow = item.class
|
|
|
|
|
this.legendSelectChange(item, index)
|
2022-08-02 20:17:47 +08:00
|
|
|
this.init(this.echartsType)
|
2022-07-21 10:19:03 +08:00
|
|
|
},
|
|
|
|
|
mouseenter (item) {
|
|
|
|
|
this.mousemoveCursor = item.class
|
|
|
|
|
this.handleActiveBar(item.class)
|
|
|
|
|
},
|
|
|
|
|
mouseleave () {
|
|
|
|
|
this.mousemoveCursor = ''
|
|
|
|
|
},
|
|
|
|
|
dispatchLegendSelectAction (name) {
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
type: 'legendSelect',
|
|
|
|
|
name: name
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
dispatchLegendUnSelectAction (name) {
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
type: 'legendUnSelect',
|
|
|
|
|
name: name
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
legendSelectChange (item, index) {
|
2022-08-02 20:17:47 +08:00
|
|
|
if (item.data.length <= 0) return ''
|
|
|
|
|
if (index === 'index') {
|
|
|
|
|
this.dispatchLegendSelectAction(item.name)
|
|
|
|
|
} else if (this.mpackets[index].name == item.name) {
|
|
|
|
|
this.dispatchLegendSelectAction(item.name)
|
2022-07-21 10:19:03 +08:00
|
|
|
this.mpackets.forEach((t) => {
|
2022-08-02 20:17:47 +08:00
|
|
|
if (t.name !== item.name) {
|
|
|
|
|
this.dispatchLegendUnSelectAction(t.name)
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-08-02 20:17:47 +08:00
|
|
|
handleActiveBar (value) {
|
|
|
|
|
if (document.querySelector('.network .line-value-mpackets.is-active')) {
|
|
|
|
|
const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.network .line-value-mpackets.is-active')
|
|
|
|
|
const activeBar = document.querySelector('.network .line-value-active')
|
|
|
|
|
activeBar.style.cssText += `width: ${clientWidth}px; left: ${offsetLeft + this.leftOffset + clientLeft}px;`
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
},
|
|
|
|
|
resize () {
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
},
|
|
|
|
|
metricSelectChange (val) {
|
2022-08-02 20:17:47 +08:00
|
|
|
this.echartsType = val
|
2022-07-21 10:19:03 +08:00
|
|
|
if (val === 'Sessions/s') {
|
|
|
|
|
this.mpackets.forEach((t, i) => {
|
|
|
|
|
if (i !== 0) {
|
|
|
|
|
t.show = false
|
|
|
|
|
}
|
|
|
|
|
this.legendSelectChange(t, 0)
|
|
|
|
|
})
|
2022-08-05 15:50:54 +08:00
|
|
|
this.activeShow = 'total'
|
2022-08-02 20:17:47 +08:00
|
|
|
} else if (!this.activeShow) {
|
|
|
|
|
this.mpackets.forEach((t, i) => {
|
|
|
|
|
t.show = true
|
|
|
|
|
this.legendSelectChange(t, 'index')
|
|
|
|
|
})
|
|
|
|
|
} else if (this.activeShow) {
|
|
|
|
|
this.activeShow = 'total'
|
2022-07-21 10:19:03 +08:00
|
|
|
this.mpackets.forEach((t, i) => {
|
|
|
|
|
t.show = true
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-08-02 20:17:47 +08:00
|
|
|
this.handleActiveBar()
|
|
|
|
|
this.init(val)
|
2022-07-21 10:19:03 +08:00
|
|
|
},
|
2022-07-30 15:30:03 +08:00
|
|
|
referenceSelectChange (val) {
|
2022-08-02 20:17:47 +08:00
|
|
|
this.echartsLabelValue = val
|
2022-07-30 15:30:03 +08:00
|
|
|
this.timer = setTimeout(() => {
|
2022-08-02 20:17:47 +08:00
|
|
|
this.init(this.echartsType)
|
2022-07-30 15:30:03 +08:00
|
|
|
}, 200)
|
|
|
|
|
},
|
2022-07-21 10:19:03 +08:00
|
|
|
symbolSizeSortChange (index, time) {
|
|
|
|
|
const dataIntegrationArray = []
|
|
|
|
|
if (stackedLineChartOption.series[0]) {
|
|
|
|
|
const totalData = stackedLineChartOption.series[0].data.find(t => t[0] === time) // [time, value]
|
|
|
|
|
dataIntegrationArray.push(totalData)
|
|
|
|
|
totalData[2] = 0
|
|
|
|
|
}
|
|
|
|
|
if (stackedLineChartOption.series[1]) {
|
|
|
|
|
const inboundData = stackedLineChartOption.series[1].data.find(t => t[0] === time)
|
|
|
|
|
dataIntegrationArray.push(inboundData)
|
|
|
|
|
inboundData[2] = 1
|
|
|
|
|
}
|
|
|
|
|
if (stackedLineChartOption.series[2]) {
|
|
|
|
|
const outboundData = stackedLineChartOption.series[2].data.find(t => t[0] === time)
|
|
|
|
|
dataIntegrationArray.push(outboundData)
|
|
|
|
|
outboundData[2] = 2
|
|
|
|
|
}
|
|
|
|
|
if (stackedLineChartOption.series[3]) {
|
|
|
|
|
const internalData = stackedLineChartOption.series[3].data.find(t => t[0] === time)
|
|
|
|
|
dataIntegrationArray.push(internalData)
|
|
|
|
|
internalData[2] = 3
|
|
|
|
|
}
|
|
|
|
|
if (stackedLineChartOption.series[4]) {
|
|
|
|
|
const throughData = stackedLineChartOption.series[4].data.find(t => t[0] === time)
|
|
|
|
|
dataIntegrationArray.push(throughData)
|
|
|
|
|
throughData[2] = 4
|
|
|
|
|
}
|
|
|
|
|
if (stackedLineChartOption.series[5]) {
|
|
|
|
|
const otherData = stackedLineChartOption.series[5].data.find(t => t[0] === time)
|
|
|
|
|
dataIntegrationArray.push(otherData)
|
|
|
|
|
otherData[2] = 5
|
|
|
|
|
}
|
|
|
|
|
dataIntegrationArray.sort((a, b) => { return a[1] - b[1] })
|
|
|
|
|
const sortIndex = dataIntegrationArray.findIndex(a => a[2] === index)
|
|
|
|
|
return this.sizes[sortIndex]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
2022-08-02 20:17:47 +08:00
|
|
|
if (this.chart) {
|
|
|
|
|
this.echartsData = _.cloneDeep(this.chart)
|
|
|
|
|
}
|
2022-07-14 17:07:07 +08:00
|
|
|
this.timer = setTimeout(() => {
|
|
|
|
|
this.init()
|
2022-07-26 17:18:54 +08:00
|
|
|
}, 200)
|
2022-07-14 17:15:34 +08:00
|
|
|
window.addEventListener('resize', this.resize)
|
2022-07-14 17:07:07 +08:00
|
|
|
},
|
|
|
|
|
beforeUnmount () {
|
|
|
|
|
clearTimeout(this.timer)
|
2022-07-08 09:34:09 +08:00
|
|
|
}
|
2022-07-06 21:08:12 +08:00
|
|
|
}
|
|
|
|
|
</script>
|