2022-07-26 22:07:53 +08:00
|
|
|
<template>
|
2022-07-29 15:15:36 +08:00
|
|
|
<div class="npm-line">
|
2022-09-08 17:09:38 +08:00
|
|
|
<chart-no-data v-if="isNoData"></chart-no-data>
|
2022-12-19 15:57:04 +08:00
|
|
|
<template v-if="chartData.i18n === 'overall.throughput'">
|
2022-08-12 19:12:44 +08:00
|
|
|
<div class="npm-line-header">
|
2022-11-23 17:20:37 +08:00
|
|
|
<div class="npm-line-header-title">
|
2023-03-20 18:52:42 +08:00
|
|
|
{{ $t(chartData.i18n) || chartData.name }}
|
2022-11-23 17:20:37 +08:00
|
|
|
<chart-error v-if="showError" tooltip :content="errorMsg"></chart-error>
|
|
|
|
|
</div>
|
2022-09-17 14:27:13 +08:00
|
|
|
<div class="npm-line-header-rights" v-if="chartData.params && chartData.params.showLegend && !isNoData">
|
2023-03-20 18:52:42 +08:00
|
|
|
<div class="npm-line-header-right" :class="{'active': item.show}" v-for="(item, index) in chartOptionLineData"
|
|
|
|
|
:key="index" @click="highlightEvent(item)">
|
2022-08-12 19:12:44 +08:00
|
|
|
<div class="npm-line-header-icon" :class="'icon' + index"></div>
|
2023-03-20 18:52:42 +08:00
|
|
|
<div class="npm-line-header-value">{{ item.legend }}</div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-07-29 15:15:36 +08:00
|
|
|
</div>
|
2022-09-08 17:09:38 +08:00
|
|
|
<div v-show="!isNoData" class="chart-drawing" :id="`chart${chartData.name}`"></div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</template>
|
2022-12-19 15:57:04 +08:00
|
|
|
<template v-else-if="chartData.i18n === 'networkAppPerformance.tripTime'">
|
2022-11-23 17:20:37 +08:00
|
|
|
<div class="npm-line-title">
|
2023-03-20 18:52:42 +08:00
|
|
|
{{ $t(chartData.i18n) || chartData.name }}(ms)
|
2022-11-23 17:20:37 +08:00
|
|
|
<chart-error v-if="showError" tooltip :content="errorMsg"></chart-error>
|
|
|
|
|
</div>
|
2022-09-08 17:09:38 +08:00
|
|
|
<div v-show="!isNoData" class="chart-drawing" :id="`chart${chartData.name}`"></div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</template>
|
2022-12-19 15:57:04 +08:00
|
|
|
<template v-else-if="chartData.i18n === 'networkAppPerformance.httpResponse'">
|
2022-11-23 17:20:37 +08:00
|
|
|
<div class="npm-line-title">
|
2023-03-20 18:52:42 +08:00
|
|
|
{{ $t(chartData.i18n) || chartData.name }}(ms)
|
2022-11-23 17:20:37 +08:00
|
|
|
<chart-error v-if="showError" tooltip :content="errorMsg"></chart-error>
|
|
|
|
|
</div>
|
2022-09-08 17:09:38 +08:00
|
|
|
<div v-show="!isNoData" class="chart-drawing" :id="`chart${chartData.name}`"></div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</template>
|
2022-12-19 15:57:04 +08:00
|
|
|
<template v-else-if="chartData.i18n === 'networkAppPerformance.sslResponseLatency'">
|
2022-11-23 17:20:37 +08:00
|
|
|
<div class="npm-line-title">
|
2023-03-20 18:52:42 +08:00
|
|
|
{{ $t(chartData.i18n) || chartData.name }}(ms)
|
2022-11-23 17:20:37 +08:00
|
|
|
<chart-error v-if="showError" tooltip :content="errorMsg"></chart-error>
|
|
|
|
|
</div>
|
2022-09-08 17:09:38 +08:00
|
|
|
<div v-show="!isNoData" class="chart-drawing" :id="`chart${chartData.name}`"></div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</template>
|
2022-12-19 15:57:04 +08:00
|
|
|
<template v-else-if="chartData.i18n === 'networkAppPerformance.packetLoss'">
|
2022-11-23 17:20:37 +08:00
|
|
|
<div class="npm-line-title">
|
2023-03-20 18:52:42 +08:00
|
|
|
{{ $t(chartData.i18n) || chartData.name }}(%)
|
2022-11-23 17:20:37 +08:00
|
|
|
<chart-error v-if="showError" tooltip :content="errorMsg"></chart-error>
|
|
|
|
|
</div>
|
2022-09-08 17:09:38 +08:00
|
|
|
<div v-show="!isNoData" class="chart-drawing" :id="`chart${chartData.name}`"></div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</template>
|
2022-12-19 15:57:04 +08:00
|
|
|
<template v-else-if="chartData.i18n === 'networkAppPerformance.packetRetrans'">
|
2022-11-23 17:20:37 +08:00
|
|
|
<div class="npm-line-title">
|
2023-03-20 18:52:42 +08:00
|
|
|
{{ $t(chartData.i18n) || chartData.name }}(%)
|
2022-11-23 17:20:37 +08:00
|
|
|
<chart-error v-if="showError" tooltip :content="errorMsg"></chart-error>
|
|
|
|
|
</div>
|
2022-09-08 17:09:38 +08:00
|
|
|
<div v-show="!isNoData" class="chart-drawing" :id="`chart${chartData.name}`"></div>
|
2022-08-12 19:12:44 +08:00
|
|
|
</template>
|
2022-07-29 15:15:36 +08:00
|
|
|
</div>
|
2022-07-26 22:07:53 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-07-29 15:15:36 +08:00
|
|
|
import * as echarts from 'echarts'
|
2022-09-20 09:33:49 +08:00
|
|
|
import { npmLineChartOption } from '@/views/charts2/charts/options/echartOption.js'
|
|
|
|
|
import { shallowRef } from 'vue'
|
2022-07-29 15:15:36 +08:00
|
|
|
import _ from 'lodash'
|
2022-09-20 09:33:49 +08:00
|
|
|
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
|
|
|
|
import { getSecond } from '@/utils/date-util'
|
|
|
|
|
import { api } from '@/utils/api'
|
2023-03-16 19:07:37 +08:00
|
|
|
import axios from 'axios'
|
2022-08-15 15:53:42 +08:00
|
|
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
2022-08-21 22:11:53 +08:00
|
|
|
import chartMixin from '@/views/charts2/chart-mixin'
|
2022-10-23 10:17:26 +08:00
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2022-11-23 17:20:37 +08:00
|
|
|
import ChartError from '@/components/common/Error'
|
2023-03-20 18:52:42 +08:00
|
|
|
import { dataForNpmLine } from '@/utils/static-data'
|
2022-07-29 15:15:36 +08:00
|
|
|
|
2022-07-26 22:07:53 +08:00
|
|
|
export default {
|
2022-07-29 15:15:36 +08:00
|
|
|
name: 'NpmLine',
|
2022-08-15 15:53:42 +08:00
|
|
|
components: {
|
2022-11-23 17:20:37 +08:00
|
|
|
ChartError,
|
2022-08-15 15:53:42 +08:00
|
|
|
ChartNoData
|
|
|
|
|
},
|
2022-08-21 22:11:53 +08:00
|
|
|
mixins: [chartMixin],
|
2022-07-29 15:15:36 +08:00
|
|
|
setup () {
|
|
|
|
|
return {
|
2022-08-21 22:11:53 +08:00
|
|
|
myChart: shallowRef(null)
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
chartData: {},
|
2023-03-20 18:52:42 +08:00
|
|
|
chartOptionLineData: dataForNpmLine.chartOptionLineData,
|
|
|
|
|
npmLineColor: dataForNpmLine.npmLineColor,
|
2022-07-29 15:15:36 +08:00
|
|
|
timer: null,
|
2022-08-12 19:12:44 +08:00
|
|
|
myChartArray: [],
|
2022-08-22 15:49:38 +08:00
|
|
|
side: this.$store.state.panel.npmLocationSide,
|
2022-11-23 17:20:37 +08:00
|
|
|
country: this.$store.state.panel.npmLocationCountry,
|
2022-08-22 15:49:38 +08:00
|
|
|
// province: '',
|
2022-11-23 17:20:37 +08:00
|
|
|
showError: false,
|
2023-07-24 14:30:17 +08:00
|
|
|
errorMsg: '',
|
|
|
|
|
sizes: [3, 4, 6, 8, 9, 10]
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-08-22 15:49:38 +08:00
|
|
|
watch: {
|
|
|
|
|
'$store.state.panel.npmLocationSide': {
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
this.side = n
|
|
|
|
|
this.init()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'$store.state.panel.npmLocationCountry': {
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
this.country = n
|
2022-11-16 10:33:52 +08:00
|
|
|
this.init(n)
|
2022-08-22 15:49:38 +08:00
|
|
|
}
|
2022-08-24 17:09:42 +08:00
|
|
|
},
|
|
|
|
|
timeFilter: {
|
2022-11-23 17:20:37 +08:00
|
|
|
handler () {
|
2023-09-19 18:06:55 +08:00
|
|
|
this.init(this.country)
|
2022-08-24 17:09:42 +08:00
|
|
|
}
|
2022-08-22 15:49:38 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-07-29 15:15:36 +08:00
|
|
|
methods: {
|
2022-11-16 10:33:52 +08:00
|
|
|
init (n) {
|
2022-08-12 19:12:44 +08:00
|
|
|
const params = {
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
2022-11-16 10:33:52 +08:00
|
|
|
side: this.side
|
|
|
|
|
}
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2023-08-25 10:18:20 +08:00
|
|
|
params.countryRegion = n || ''
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-08-21 22:11:53 +08:00
|
|
|
this.toggleLoading(true)
|
2022-09-08 17:09:38 +08:00
|
|
|
let url
|
|
|
|
|
if (this.chart.params) {
|
2023-03-20 18:52:42 +08:00
|
|
|
url = this.switchUrl(this.chart.params.index)
|
|
|
|
|
|
2022-09-08 17:09:38 +08:00
|
|
|
if (url) {
|
2023-08-24 17:15:41 +08:00
|
|
|
axios.get(url, { params: params }).then(response => {
|
|
|
|
|
const res = response.data
|
|
|
|
|
if (response.status === 200) {
|
2022-11-23 17:20:37 +08:00
|
|
|
this.showError = false
|
2022-09-08 17:09:38 +08:00
|
|
|
this.isNoData = res.data.result.length === 0
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-11-18 15:18:12 +08:00
|
|
|
if (!this.isNoData) {
|
|
|
|
|
if (this.chart.params.index === 0) {
|
|
|
|
|
res.data.result.forEach((t, i) => {
|
2023-03-20 18:52:42 +08:00
|
|
|
this.chartOptionLineData[i].values = t.values
|
2022-11-18 15:18:12 +08:00
|
|
|
})
|
|
|
|
|
const result = this.chartOptionLineData.filter(t => this.chartData.params.color.indexOf(t.color) > -1)
|
|
|
|
|
this.echartsInit(result, this.chartData, this.chartData.params.unitType)
|
|
|
|
|
} else {
|
|
|
|
|
this.echartsInit(res.data.result, this.chartData, this.chartData.params.unitType)
|
|
|
|
|
}
|
2022-08-22 15:49:38 +08:00
|
|
|
}
|
2022-11-23 17:20:37 +08:00
|
|
|
} else {
|
|
|
|
|
this.isNoData = false
|
|
|
|
|
this.showError = true
|
2023-03-22 10:20:22 +08:00
|
|
|
this.errorMsg = this.errorMsgHandler(res)
|
2022-08-29 11:21:41 +08:00
|
|
|
}
|
2023-03-16 19:07:37 +08:00
|
|
|
}).catch(e => {
|
|
|
|
|
console.error(e)
|
2022-11-23 17:20:37 +08:00
|
|
|
this.isNoData = false
|
|
|
|
|
this.showError = true
|
2023-03-16 19:07:37 +08:00
|
|
|
this.errorMsg = this.errorMsgHandler(e)
|
2022-09-08 17:09:38 +08:00
|
|
|
}).finally(() => {
|
|
|
|
|
this.toggleLoading(false)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.isNoData = true
|
|
|
|
|
this.toggleLoading(false)
|
2022-08-12 19:12:44 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-08-22 15:49:38 +08:00
|
|
|
echartsInit (data, chartData, type) {
|
|
|
|
|
const dom = document.getElementById(`chart${chartData.name}`)
|
2022-08-15 15:53:42 +08:00
|
|
|
if (dom) {
|
2022-08-24 17:09:42 +08:00
|
|
|
if (!this.myChart) {
|
|
|
|
|
this.myChart = echarts.init(dom)
|
|
|
|
|
}
|
2022-08-15 15:53:42 +08:00
|
|
|
this.chartOption = npmLineChartOption
|
|
|
|
|
this.chartOption.color = this.chartData.params.color
|
2023-09-26 15:55:10 +08:00
|
|
|
// this.chartOption.color = this.chartOption.color.reverse()
|
|
|
|
|
// data = data.reverse()
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-08-15 15:53:42 +08:00
|
|
|
this.chartOption.series = data.map((t, i) => {
|
|
|
|
|
return {
|
2022-11-16 10:33:52 +08:00
|
|
|
type: 'line',
|
|
|
|
|
symbol: 'circle',
|
|
|
|
|
smooth: true,
|
|
|
|
|
showSymbol: false,
|
|
|
|
|
emphasis: {
|
2023-07-24 14:30:17 +08:00
|
|
|
itemStyle: {
|
|
|
|
|
borderColor: t.color,
|
|
|
|
|
borderWidth: 2,
|
|
|
|
|
shadowColor: t.color,
|
|
|
|
|
shadowBlur: t.positioning ? this.sizes[t.positioning] + 2 : 0
|
|
|
|
|
}
|
2022-11-16 10:33:52 +08:00
|
|
|
},
|
2023-08-02 18:37:10 +08:00
|
|
|
name: t.invertTab ? t.legend : this.$t(chartData.i18n) || chartData.name,
|
2023-08-02 18:04:23 +08:00
|
|
|
stack: this.chartData.params.isStack ? (t.legend === this.$t('network.total') ? '' : 'network.total') : '',
|
2022-08-15 15:53:42 +08:00
|
|
|
lineStyle: {
|
|
|
|
|
width: 1
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.1
|
|
|
|
|
},
|
|
|
|
|
data: t.values.map((v) => [Number(v[0]) * 1000, Number(v[1]), type])
|
|
|
|
|
}
|
2022-07-29 15:15:36 +08:00
|
|
|
})
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-10-23 10:17:26 +08:00
|
|
|
this.chartOption.yAxis[0].axisLabel.formatter = (value) => {
|
|
|
|
|
if (type === 'percent') {
|
|
|
|
|
return unitConvert(value, type)[0]
|
|
|
|
|
} else {
|
|
|
|
|
return unitConvert(value, 'number').join('')
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-08-15 15:53:42 +08:00
|
|
|
this.chartOption.tooltip.formatter = (params) => {
|
|
|
|
|
params.forEach(t => {
|
2022-10-20 20:13:09 +08:00
|
|
|
this.chartOptionLineData.forEach(e => {
|
2022-12-20 10:22:54 +08:00
|
|
|
if (e.legend === t.seriesName) {
|
2022-10-20 20:13:09 +08:00
|
|
|
t.borderColor = e.color
|
|
|
|
|
}
|
|
|
|
|
if (this.$t(chartData.i18n) === t.seriesName) {
|
|
|
|
|
t.borderColor = t.color
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-08-15 15:53:42 +08:00
|
|
|
})
|
2023-09-26 15:55:10 +08:00
|
|
|
return stackedLineTooltipFormatter(params.reverse())
|
2022-08-15 15:53:42 +08:00
|
|
|
}
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-08-15 15:53:42 +08:00
|
|
|
this.myChartArray.push(this.myChart)
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
2022-09-06 11:15:48 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
})
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
|
|
|
|
},
|
2023-03-20 18:52:42 +08:00
|
|
|
dispatchSelectAction (type, name) {
|
2022-07-29 15:15:36 +08:00
|
|
|
this.myChart.dispatchAction({
|
2023-03-20 18:52:42 +08:00
|
|
|
type: type,
|
2022-07-29 15:15:36 +08:00
|
|
|
name: name
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-08-09 16:57:16 +08:00
|
|
|
highlightEvent (item) {
|
2022-12-12 10:34:21 +08:00
|
|
|
const chartOptionLineData = _.cloneDeep(this.chartOptionLineData)
|
|
|
|
|
chartOptionLineData.forEach(t => {
|
2022-08-09 16:57:16 +08:00
|
|
|
if (t.legend === item.legend) {
|
|
|
|
|
t.invertTab = !t.invertTab
|
|
|
|
|
} else {
|
|
|
|
|
t.show = t.invertTab
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-12-12 10:34:21 +08:00
|
|
|
const legend = chartOptionLineData.filter(t => t.invertTab)
|
2023-03-20 18:52:42 +08:00
|
|
|
const legendList = chartOptionLineData.filter(t => !t.invertTab)
|
|
|
|
|
|
2022-12-12 10:34:21 +08:00
|
|
|
chartOptionLineData.forEach(t => {
|
2022-08-09 16:57:16 +08:00
|
|
|
if ((t.legend === item.legend) && t.invertTab) {
|
2022-12-12 10:34:21 +08:00
|
|
|
if (legend.length === 2) {
|
|
|
|
|
t.show = true
|
|
|
|
|
} else {
|
|
|
|
|
legend.forEach(r => {
|
|
|
|
|
r.show = false
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-08-09 16:57:16 +08:00
|
|
|
} else if ((t.legend !== item.legend) && !t.invertTab) {
|
2023-03-20 18:52:42 +08:00
|
|
|
legendList.forEach(r => {
|
2022-08-09 16:57:16 +08:00
|
|
|
if (r.legend === item.legend) {
|
|
|
|
|
r.show = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-08-09 16:57:16 +08:00
|
|
|
if (legend.length === 0) {
|
2022-12-12 10:34:21 +08:00
|
|
|
chartOptionLineData.forEach((t, i) => {
|
2022-08-09 16:57:16 +08:00
|
|
|
t.invertTab = true
|
2022-07-29 15:15:36 +08:00
|
|
|
})
|
2022-08-09 16:57:16 +08:00
|
|
|
}
|
2023-03-20 18:52:42 +08:00
|
|
|
|
2022-12-12 10:34:21 +08:00
|
|
|
this.chartOptionLineData = chartOptionLineData
|
2023-03-20 18:52:42 +08:00
|
|
|
this.legendSelectChange(legendList, legend)
|
2022-08-09 16:57:16 +08:00
|
|
|
},
|
2023-03-20 18:52:42 +08:00
|
|
|
legendSelectChange (legendList, legend) {
|
|
|
|
|
if (legendList.length > 0) {
|
2022-08-09 16:57:16 +08:00
|
|
|
this.chartOptionLineData.forEach(t => {
|
2023-03-20 18:52:42 +08:00
|
|
|
legendList.forEach(r => {
|
2022-08-09 16:57:16 +08:00
|
|
|
if (t.legend !== r.legend) {
|
2023-03-20 18:52:42 +08:00
|
|
|
this.dispatchSelectAction('legendUnSelect', t.legend)
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
2022-08-09 16:57:16 +08:00
|
|
|
if (!t.show) {
|
2023-03-20 18:52:42 +08:00
|
|
|
this.dispatchSelectAction('legendSelect', t.legend)
|
2022-08-09 16:57:16 +08:00
|
|
|
}
|
2022-07-29 15:15:36 +08:00
|
|
|
})
|
2022-08-09 16:57:16 +08:00
|
|
|
})
|
|
|
|
|
} else if (legend.length > 0) {
|
|
|
|
|
this.chartOptionLineData.forEach(t => {
|
|
|
|
|
legend.forEach(r => {
|
|
|
|
|
if (t.legend !== r.legend) {
|
2023-03-20 18:52:42 +08:00
|
|
|
this.dispatchSelectAction('legendSelect', t.legend)
|
2022-08-09 16:57:16 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
resize () {
|
|
|
|
|
this.myChartArray.forEach(t => {
|
|
|
|
|
t.resize()
|
|
|
|
|
})
|
2023-03-20 18:52:42 +08:00
|
|
|
},
|
|
|
|
|
switchUrl (index) {
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
return api.npm.location.thoughput
|
|
|
|
|
case 1:
|
|
|
|
|
return api.npm.location.tcpConnectionEstablishLatency
|
|
|
|
|
case 2:
|
|
|
|
|
return api.npm.location.httpResponseLatency
|
|
|
|
|
case 3:
|
|
|
|
|
return api.npm.location.sslHandshakeLatency
|
|
|
|
|
case 4:
|
|
|
|
|
return api.npm.location.packetsLoss
|
|
|
|
|
case 5:
|
|
|
|
|
return api.npm.location.packetsRetrains
|
|
|
|
|
}
|
2023-10-09 16:30:11 +08:00
|
|
|
},
|
|
|
|
|
initI18n () {
|
|
|
|
|
dataForNpmLine.chartOptionLineData.forEach(item => {
|
|
|
|
|
item.legend = this.$t(item.legend)
|
|
|
|
|
})
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
2023-10-09 16:30:11 +08:00
|
|
|
this.initI18n()
|
2022-07-29 15:15:36 +08:00
|
|
|
if (this.chart) {
|
|
|
|
|
this.chartData = _.cloneDeep(this.chart)
|
|
|
|
|
}
|
|
|
|
|
this.timer = setTimeout(() => {
|
|
|
|
|
this.init()
|
|
|
|
|
}, 100)
|
|
|
|
|
window.addEventListener('resize', this.resize)
|
|
|
|
|
},
|
|
|
|
|
beforeUnmount () {
|
|
|
|
|
clearTimeout(this.timer)
|
2022-08-17 10:46:10 +08:00
|
|
|
window.removeEventListener('resize', this.resize)
|
2023-01-11 18:11:43 +08:00
|
|
|
if (this.myChart) {
|
|
|
|
|
echarts.dispose(this.myChart)
|
|
|
|
|
}
|
2022-12-16 10:12:37 +08:00
|
|
|
this.chartOption = null
|
2022-07-29 15:15:36 +08:00
|
|
|
}
|
2022-07-26 22:07:53 +08:00
|
|
|
}
|
|
|
|
|
</script>
|