backup_master_20231211
飘泊客 9 months ago
parent 4c65b75f8b
commit a90f0bd897

@ -1,149 +1,149 @@
<template> <template>
<div :class="className" :style="{height:height,width:width}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme require('echarts/theme/macarons') // echarts theme
import { debounce } from '@/utils' import { debounce } from '@/utils'
export default { export default {
props: { props: {
className: { className: {
type: String, type: String,
default: 'chart' default: 'chart'
}, },
width: { width: {
type: String, type: String,
default: '100%' default: '100%'
}, },
height: { height: {
type: String, type: String,
default: '300px' default: '300px'
} }
}, },
data() { data() {
return { return {
chart: null chart: null
} }
}, },
mounted() { mounted() {
this.initChart() this.initChart()
this.__resizeHandler = debounce(() => { this.__resizeHandler = debounce(() => {
if (this.chart) { if (this.chart) {
this.chart.resize() this.chart.resize()
} }
}, 100) }, 100)
window.addEventListener('resize', this.__resizeHandler) window.addEventListener('resize', this.__resizeHandler)
}, },
beforeDestroy() { beforeDestroy() {
if (!this.chart) { if (!this.chart) {
return return
} }
window.removeEventListener('resize', this.__resizeHandler) window.removeEventListener('resize', this.__resizeHandler)
this.chart.dispose() this.chart.dispose()
this.chart = null this.chart = null
}, },
methods: { methods: {
initChart() { initChart() {
this.chart = echarts.init(this.$el, 'macarons') this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({ this.chart.setOption({
title: { title: {
text: 'Graph 简单示例' text: 'Graph 简单示例'
}, },
tooltip: {}, tooltip: {},
animationDurationUpdate: 1500, animationDurationUpdate: 1500,
animationEasingUpdate: 'quinticInOut', animationEasingUpdate: 'quinticInOut',
series: [ series: [
{ {
type: 'graph', type: 'graph',
layout: 'none', layout: 'none',
symbolSize: 50, symbolSize: 50,
roam: true, roam: true,
label: { label: {
normal: { normal: {
show: true show: true
} }
}, },
edgeSymbol: ['circle', 'arrow'], edgeSymbol: ['circle', 'arrow'],
edgeSymbolSize: [4, 10], edgeSymbolSize: [4, 10],
edgeLabel: { edgeLabel: {
normal: { normal: {
textStyle: { textStyle: {
fontSize: 20 fontSize: 20
} }
} }
}, },
data: [{ data: [{
name: '节点1', name: '节点1',
x: 100, x: 100,
y: 300 y: 300
}, { }, {
name: '节点2', name: '节点2',
x: 1000, x: 1000,
y: 300 y: 300
}, { }, {
name: '节点3', name: '节点3',
x: 550, x: 550,
y: 100 y: 100
}, { }, {
name: '节点4', name: '节点4',
x: 550, x: 550,
y: 500 y: 500
}], }],
// links: [], // links: [],
links: [{ links: [{
source: 0, source: 0,
target: 1, target: 1,
symbolSize: [5, 20], symbolSize: [5, 20],
label: { label: {
normal: { normal: {
show: true show: true
} }
}, },
lineStyle: { lineStyle: {
normal: { normal: {
width: 5, width: 5,
curveness: 0.2 curveness: 0.2
} }
} }
}, { }, {
source: '节点2', source: '节点2',
target: '节点1', target: '节点1',
label: { label: {
normal: { normal: {
show: true show: true
} }
}, },
lineStyle: { lineStyle: {
normal: { curveness: 0.2 } normal: { curveness: 0.2 }
} }
}, { }, {
source: '节点1', source: '节点1',
target: '节点3' target: '节点3'
}, { }, {
source: '节点2', source: '节点2',
target: '节点3' target: '节点3'
}, { }, {
source: '节点2', source: '节点2',
target: '节点4' target: '节点4'
}, { }, {
source: '节点1', source: '节点1',
target: '节点4' target: '节点4'
}], }],
lineStyle: { lineStyle: {
normal: { normal: {
opacity: 0.9, opacity: 0.9,
width: 2, width: 2,
curveness: 0 curveness: 0
} }
} }
} }
] ]
}) })
} }
} }
} }
</script> </script>

@ -100,7 +100,6 @@ export default {
this.channelCustom.fieldList.push(item.routeName) this.channelCustom.fieldList.push(item.routeName)
} }
}) })
console.log(this.monitoringModeTwoList, 'this.monitoringModeTwoList')
}, },
// //
// remove(index) { // remove(index) {

Loading…
Cancel
Save