From 9c803f20cc05395bac2d3386accfe230210c07dc Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 19 十二月 2022 20:58:31 +0800
Subject: [PATCH] 1

---
 src/components/echart15.vue |   59 +++++++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/src/components/echart15.vue b/src/components/echart15.vue
index 9baece1..9355f83 100644
--- a/src/components/echart15.vue
+++ b/src/components/echart15.vue
@@ -10,90 +10,93 @@
   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: {
             // Use axis to trigger tooltip
-            type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
+            type: 'shadow', // 'shadow' as default; can also be 'line' or 'shadow'
           },
         },
         legend: {
           textStyle: {
-            color: "#fff",
+            color: '#fff',
           },
         },
         grid: {
-          left: "3%",
-          right: "4%",
-          bottom: "3%",
+          left: '3%',
+          right: '4%',
+          bottom: '3%',
           containLabel: true,
         },
         xAxis: {
-          type: "value",
+          type: 'value',
           axisLabel: {
-            color: "#fff",
+            color: '#fff',
           },
         },
         yAxis: {
           axisLabel: {
-            color: "#fff",
+            color: '#fff',
           },
-          type: "category",
-          data: ["鍕樺療鏁版嵁", "宀╁湡鏁版嵁", "娴嬮噺鏁版嵁", "鍚堣鏁版嵁", "绠$悊鏁版嵁"],
+          type: 'category',
+          data: ['鍕樺療鏁版嵁', '宀╁湡鏁版嵁', '娴嬮噺鏁版嵁', '鍚堣鏁版嵁', '绠$悊鏁版嵁'],
         },
         series: [
           {
-            name: "瀛樺劜閲�",
-            type: "bar",
-            stack: "total",
+            name: '瀛樺劜閲�',
+            type: 'bar',
+            stack: 'total',
             label: {
               show: true,
               textStyle: {
-                color: "#fff",
+                color: '#fff',
               },
             },
             emphasis: {
-              focus: "series",
+              focus: 'series',
             },
             data: [122880, 40960, 153600, 5120, 28672],
           },
 
           {
-            name: "鎬婚噺",
-            type: "bar",
-            stack: "total",
+            name: '鎬婚噺',
+            type: 'bar',
+            stack: 'total',
             label: {
               show: true,
               textStyle: {
-                color: "#fff",
+                color: '#fff',
               },
             },
             emphasis: {
-              focus: "series",
+              focus: 'series',
             },
             data: [351232, 351232, 351232, 351232, 351232],
           },
         ],
       };
-      let myChart = this.$echarts.init(document.getElementById("echart5"));
-      myChart.setOption(option);
-      window.addEventListener("resize", function () {
-        myChart.resize();
+      this.myChart = this.$echarts.init(document.getElementById('echart5'));
+      this.myChart.setOption(option);
+      window.addEventListener('resize', function () {
+        this.myChart.resize();
       });
     },
   },

--
Gitblit v1.9.3