Browse Source

任务统计更改

duy 2 years ago
parent
commit
c6bb9da537
1 changed files with 26 additions and 24 deletions
  1. 26 24
      src/components/echarts/WordPopulation.vue

+ 26 - 24
src/components/echarts/WordPopulation.vue

@@ -1,5 +1,5 @@
 <template>
-    <echartsBase :option="setOption"/>
+    <echartsBase :option="setOption" />
 </template>
 
 <script setup>
@@ -9,32 +9,32 @@ import echartsBase from './index.vue'
 const props = defineProps({
     title: {
         type: String,
-        default: '管理费用项目分摊占比情况'
+        default: '管理费用项目分摊占比情况',
     },
     color: {
         type: Array,
-        default: () => (['#5087EC', '#68BBC4'])
+        default: () => (['#5087EC', '#68BBC4']),
     },
     unit: {
         type: String,
-        default: '元'
+        default: '元',
     },
     datas: {
         type: Array,
-        default: () => ([])
+        default: () => ([]),
     },
     name:{
           type: String,
-         default: ''
+         default: '',
     },
     ydata:{
          type: Array,
-         default: () => ([])
+         default: () => ([]),
     },
     xdata:{
         type: Array,
-         default: () => ([])
-    }
+         default: () => ([]),
+    },
 })
 
 //初始变量
@@ -45,7 +45,7 @@ const units = ref(props.unit)
 const datas = ref(props.datas)
 const xdatas = ref(props.xdata)
 const ydatas = ref(props.ydata)
-const names=ref(props.name)
+const names = ref(props.name)
 
 watch(() => [
     props.title,
@@ -54,13 +54,13 @@ watch(() => [
     props.name,
     props.xdata,
     props.ydata,
-], ([title, color, unit,name,xdata,ydata]) => {
+], ([title, color, unit, name, xdata, ydata]) => {
     titles.value = title
     colors.value = color
     units.value = unit
-    names.value=name
-    xdatas.value=xdata
-    ydatas.value=ydata
+    names.value = name
+    xdatas.value = xdata
+    ydatas.value = ydata
     setOptions()
 })
 
@@ -83,15 +83,15 @@ const setOptions = () => {
   tooltip: {
     trigger: 'axis',
     axisPointer: {
-      type: 'shadow'
+      type: 'shadow',
     },
-    formatter:function(params){
-    var relVal = params[0].name;
+    formatter:function (params) {
+    var relVal = params[0].name
     for (var i = 0, l = params.length; i < l; i++) {
-      relVal += '<br/>' + params[i].seriesName + ' : ' + params[i].value+units.value;
+      relVal += '<br/>' + params[i].seriesName + ' : ' + params[i].value + units.value
     }
-    return relVal;
-  }
+    return relVal
+  },
 
   },
   legend: {},
@@ -99,15 +99,17 @@ const setOptions = () => {
     left: '3%',
     right: '4%',
     bottom: '3%',
-    containLabel: true
+    containLabel: true,
   },
   xAxis: {
     type: 'value',
     boundaryGap: [0, 0.01],
+    min:0,
+    max:100,
    
     axisLabel: {
-        formatter: `{value}`+units.value // 在每个x轴坐标都添加了单位
-    }
+        formatter: '{value}' + units.value, // 在每个x轴坐标都添加了单位
+    },
    
   
   },
@@ -127,7 +129,7 @@ const setOptions = () => {
     },
   
     
-  ]
+  ],
 }
 }