| | |
| | | components: {}, |
| | | data() { |
| | | //这里存放数据 |
| | | return {}; |
| | | return { myChart }; |
| | | }, |
| | | mounted() { |
| | | this.lineChart(); |
| | | this.$bus.$on('resizeEchart', (res) => { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | //方法集合 |
| | | methods: { |
| | | lineChart() { |
| | | let option = { |
| | | title: { |
| | | text: "数据总量趋势", |
| | | text: '数据总量趋势', |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis", |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: "cross", |
| | | type: 'cross', |
| | | label: { |
| | | backgroundColor: "#FFFFFF", |
| | | backgroundColor: '#FFFFFF', |
| | | }, |
| | | }, |
| | | }, |
| | | legend: { |
| | | data: ["增量", "总量"], |
| | | data: ['增量', '总量'], |
| | | }, |
| | | toolbox: { |
| | | feature: { |
| | |
| | | }, |
| | | }, |
| | | grid: { |
| | | left: "3%", |
| | | right: "4%", |
| | | bottom: "3%", |
| | | left: '3%', |
| | | right: '4%', |
| | | bottom: '3%', |
| | | containLabel: true, |
| | | }, |
| | | xAxis: [ |
| | | { |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#ccc", |
| | | color: '#ccc', |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | show: true, |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | type: "category", |
| | | type: 'category', |
| | | boundaryGap: false, |
| | | data: [2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022], |
| | | }, |
| | |
| | | { |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#ccc", |
| | | color: '#ccc', |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | show: true, |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | type: "value", |
| | | type: 'value', |
| | | boundaryGap: false, |
| | | }, |
| | | ], |
| | | series: [ |
| | | { |
| | | name: "增量", |
| | | type: "line", |
| | | stack: "Total", |
| | | name: '增量', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | areaStyle: { |
| | | color: "#83bff6", |
| | | color: '#83bff6', |
| | | opacity: 0.5, |
| | | }, |
| | | emphasis: { |
| | | focus: "series", |
| | | focus: 'series', |
| | | }, |
| | | data: [5120, 3072, 2048, 7168, 3072, 4096, 2048, 3072, 500], |
| | | }, |
| | | |
| | | { |
| | | name: "总量", |
| | | type: "line", |
| | | stack: "Total", |
| | | name: '总量', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | label: { |
| | | show: true, |
| | | position: "top", |
| | | position: 'top', |
| | | }, |
| | | areaStyle: { |
| | | color: "#188df0", |
| | | color: '#188df0', |
| | | opacity: 0.5, |
| | | }, |
| | | emphasis: { |
| | | focus: "series", |
| | | focus: 'series', |
| | | }, |
| | | data: [ |
| | | 27750, 28262, 28569, 28774, 29491, 29798, 30208, 30412, 30720, |
| | |
| | | }, |
| | | ], |
| | | }; |
| | | let myChart = this.$echarts.init(document.getElementById("echart4")); |
| | | myChart.setOption(option); |
| | | window.addEventListener("resize", function () { |
| | | myChart.resize(); |
| | | this.myChart = this.$echarts.init(document.getElementById('echart4')); |
| | | this.myChart.setOption(option); |
| | | window.addEventListener('resize', function () { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | }, |