Browse Source

优化柱状图和饼图标签字体大小,适配不同屏幕尺寸

yusheng 9 months ago
parent
commit
c13433751e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/views/home/data.js

+ 3 - 3
src/views/home/data.js

@@ -124,7 +124,7 @@ export const barOption = (data, itemStyle = {}) => {
           position: 'top', // 在柱状图的顶部显示标签
           formatter: '{c}%', // 数据内容,默认为'{c}',即系列数据中的值
           textStyle: {
-            fontSize: 20 // 标签字体大小
+            fontSize: window.innerHeight * 0.012
           }
         }
       }
@@ -215,8 +215,8 @@ export const preOptions = (
           formatter: (item) => {
             return item.name + ':' + item.value;
           },
-          fontSize: 16
-          // fontSize: window.innerHeight * 0.014
+          // fontSize: 16
+          fontSize: window.innerHeight * 0.014,
           // color:"#fff"
         },
         labelLine: {