| | |
| | | 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: ["增量", "总量", "Video Ads", "Direct", "Search Engine"], |
| | | data: ['增量', '总量', 'Video Ads', 'Direct', 'Search Engine'], |
| | | }, |
| | | 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: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], |
| | | }, |
| | |
| | | { |
| | | 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: "#8F595A", |
| | | color: '#8F595A', |
| | | opacity: 0.5, |
| | | }, |
| | | emphasis: { |
| | | focus: "series", |
| | | focus: 'series', |
| | | }, |
| | | data: [200, 300, 100, 500, 2000, 500, 200, 400, 100, 100, 80, 300], |
| | | }, |
| | | |
| | | { |
| | | name: "总量", |
| | | type: "line", |
| | | stack: "Total", |
| | | name: '总量', |
| | | type: 'line', |
| | | stack: 'Total', |
| | | label: { |
| | | show: true, |
| | | position: "top", |
| | | position: 'top', |
| | | }, |
| | | areaStyle: { |
| | | color: "#02929E", |
| | | color: '#02929E', |
| | | opacity: 0.5, |
| | | }, |
| | | emphasis: { |
| | | focus: "series", |
| | | focus: 'series', |
| | | }, |
| | | data: [ |
| | | 2048, 2051, 2052, 2057, 2077, 2082, 2084, 2088, 2089, 2090, 2090, |
| | |
| | | }, |
| | | ], |
| | | }; |
| | | let myChart = this.$echarts.init(document.getElementById("echart1")); |
| | | myChart.setOption(option); |
| | | window.addEventListener("resize", function () { |
| | | myChart.resize(); |
| | | this.myChart = this.$echarts.init(document.getElementById('echart1')); |
| | | this.myChart.setOption(option); |
| | | window.addEventListener('resize', function () { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | }, |