| | |
| | | components: {}, |
| | | data() { |
| | | //这里存放数据 |
| | | return {}; |
| | | return { myChart }; |
| | | }, |
| | | mounted() { |
| | | this.lineChart(); |
| | | this.$bus.$on('resizeEchart', (res) => { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | //方法集合 |
| | | methods: { |
| | | lineChart() { |
| | | let option = { |
| | | title: { |
| | | text: "1-12月数据更新量", |
| | | text: '1-12月数据更新量', |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis", |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: "cross", |
| | | type: 'cross', |
| | | label: { |
| | | backgroundColor: "#FFFFFF", |
| | | backgroundColor: '#FFFFFF', |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | 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], |
| | | }, |
| | | ], |
| | | }; |
| | | let myChart = this.$echarts.init(document.getElementById("echart24")); |
| | | myChart.setOption(option); |
| | | window.addEventListener("resize", function () { |
| | | myChart.resize(); |
| | | this.myChart = this.$echarts.init(document.getElementById('echart24')); |
| | | this.myChart.setOption(option); |
| | | window.addEventListener('resize', function () { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | }, |