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/echart36.vue | 53 ++++++++++++++++++++++++++++------------------------- 1 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/components/echart36.vue b/src/components/echart36.vue index 09c3233..23ec66f 100644 --- a/src/components/echart36.vue +++ b/src/components/echart36.vue @@ -10,23 +10,26 @@ 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: "item", + trigger: 'item', }, visualMap: { show: false, @@ -38,49 +41,49 @@ }, series: [ { - name: "鍚勯」鐩汉鍛樺垎閰�", - type: "pie", - radius: "55%", - center: ["50%", "50%"], + name: '鍚勯」鐩汉鍛樺垎閰�', + type: 'pie', + radius: '55%', + center: ['50%', '50%'], data: [ - { value: 80, name: "涓縿涓滅嚎绠¢亾宸ョ▼鍗楁" }, - { value: 70, name: "涓縿涓滅嚎绠¢亾宸ョ▼涓" }, - { value: 15, name: "骞垮窞绔�" }, - { value: 30, name: "鍞愬北LNG" }, - { value: 15, name: "鏂扮枂杩炴湪娌佺珯鍦�" }, - { value: 35, name: "涓紖澶╃劧姘旂閬撻闄╂帓鏌ヨ埅绌烘憚褰辨祴閲�" }, + { value: 80, name: '涓縿涓滅嚎绠¢亾宸ョ▼鍗楁' }, + { value: 70, name: '涓縿涓滅嚎绠¢亾宸ョ▼涓' }, + { value: 15, name: '骞垮窞绔�' }, + { value: 30, name: '鍞愬北LNG' }, + { value: 15, name: '鏂扮枂杩炴湪娌佺珯鍦�' }, + { value: 35, name: '涓紖澶╃劧姘旂閬撻闄╂帓鏌ヨ埅绌烘憚褰辨祴閲�' }, ].sort(function (a, b) { return a.value - b.value; }), - roseType: "radius", + roseType: 'radius', label: { - color: "rgba(255, 255, 255, 0.8)", + color: 'rgba(255, 255, 255, 0.8)', }, labelLine: { lineStyle: { - color: "rgba(255, 255, 255, 0.8)", + color: 'rgba(255, 255, 255, 0.8)', }, smooth: 0.2, length: 10, length2: 20, }, itemStyle: { - color: "#c23531", + color: '#c23531', shadowBlur: 200, - shadowColor: "rgba(0, 0, 0, 0.5)", + shadowColor: 'rgba(0, 0, 0, 0.5)', }, - animationType: "scale", - animationEasing: "elasticOut", + animationType: 'scale', + animationEasing: 'elasticOut', animationDelay: function (idx) { return Math.random() * 200; }, }, ], }; - let myChart = this.$echarts.init(document.getElementById("echart36")); - myChart.setOption(option); - window.addEventListener("resize", function () { - myChart.resize(); + this.myChart = this.$echarts.init(document.getElementById('echart36')); + this.myChart.setOption(option); + window.addEventListener('resize', function () { + this.myChart.resize(); }); }, }, -- Gitblit v1.9.3