From c84d328cb6448786aee00f1b0684aaa07186e410 Mon Sep 17 00:00:00 2001
From: whyczyk <525500596@qq.com>
Date: 星期四, 04 三月 2021 10:56:56 +0800
Subject: [PATCH] chart字体自适应

---
 src/components/charts/imgPieChart.vue |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/components/charts/imgPieChart.vue b/src/components/charts/imgPieChart.vue
index 6ac204e..40ec934 100644
--- a/src/components/charts/imgPieChart.vue
+++ b/src/components/charts/imgPieChart.vue
@@ -8,8 +8,10 @@
 
 <script>
   import * as echarts from 'echarts';
-  //寮曞叆鎻愮ず妗�
-  import "echarts/lib/component/tooltip";
+  //寮曞叆chart瀛椾綋鑷�傚簲
+  import {
+    chartFontsize
+  } from '@/assets/js/chartFontsize'
   const pieImg = require('../../assets/images/rectifier-img.png');
   export default {
     name: "imgPieChart",
@@ -32,7 +34,7 @@
         this.$options.chart.setOption(opt);
       },
       setData(sendData) {
-        this.$options.chartData = sendData
+        this.$options.chartData = sendData;
         let imgWidth = this.$refs.chart.clientWidth * 0.14;
         let imgheight = imgWidth / 0.82;
         let centerx = this.$refs.chart.clientWidth / 2;
@@ -79,16 +81,16 @@
                 rich: {
                   yellow: {
                     color: "#f67f21",
-                    fontSize: 16,
+                    fontSize: chartFontsize(16),
                     fontWeight: '600',
-                    padding: [4, 0, 0, 0],
+                    padding: [chartFontsize(4), 0, 0, 0],
                     align: 'center'
                   },
                   white: {
                     color: "#ffffff",
                     align: 'center',
-                    fontSize: 12,
-                    padding: 4
+                    fontSize: chartFontsize(12),
+                    padding: chartFontsize(4)
                   },
                   hr: {
                     borderColor: '#007ed3',
@@ -171,7 +173,7 @@
       },
       resize() {
         this.$options.chart.resize();
-        this.setData(this.$options.chartData)
+        this.setData(this.$options.chartData);
       }
     },
     mounted() {

--
Gitblit v1.9.1