Browse Source

碳配额图表修改

Bella 2 years ago
parent
commit
ea52dad410
1 changed files with 16 additions and 14 deletions
  1. 16 14
      src/components/doubleCarbon/overview/charts/carbonQuotaChart.vue

+ 16 - 14
src/components/doubleCarbon/overview/charts/carbonQuotaChart.vue

@@ -39,13 +39,13 @@ export default {
           splitNum: 3,
           axisLabel : {
             rotate:"45"
-          }
+          },
         },
         yAxis: {
           type: 'category',
-          data: [],
+          data: ['分公司1','分公司2','分公司3','分公司4','分公司5','总部'],
           axisTick: {
-            show: false
+            show: true
           },
           axisLine: {
             show: false
@@ -84,7 +84,8 @@ export default {
         series: [
           {
             name: '碳配额存量',
-            data: [],
+            data: [300,200,400,500,200,100],
+            stack:"总量",
             type: 'bar',
             barWidth: '30%',
             backgroundStyle: {
@@ -93,8 +94,9 @@ export default {
           },
           {
             name: '碳配额消耗',
-            data: [],
+            data: [400,200,300,400,500,340],
             type: 'bar',
+            stack:"总量",
             barWidth: '30%',
             backgroundStyle: {
               color: 'rgba(180, 180, 180, 0.2)'
@@ -125,18 +127,18 @@ export default {
     getData() {
       return apiCarbonOverview.getCarbonQuotaComposition(this.queryData).then(res=>{
         let data = this.$util.dataUtil.covertDataToEcharts(res, ['stock','consume'])
-        this.option.yAxis.data = data.label;
-        let arr = [];
-        for (const key in data) {
-          if (key == 'label'){
-            continue;
-          }
-          arr.push(data[key])
-        }
+        // this.option.yAxis.data = data.label;
+        // let arr = [];
+        // for (const key in data) {
+        //   if (key == 'label'){
+        //     continue;
+        //   }
+        //   arr.push(data[key])
+        // }
         // for (let i = 0; i < this.option.series.length; i++) {
         //   this.option.series[i].data = arr[i]
         // }
-        
+
         this.chart.setOption(this.option)
       })
     }