Переглянути джерело

优化图表等4项内容

周壕 9 місяців тому
батько
коміт
67cf25ccbe

+ 4 - 0
src/main/java/com/bowintek/practice/mapper/cquery/FactWellCQuery.java

@@ -1,6 +1,8 @@
 package com.bowintek.practice.mapper.cquery;
 
 import com.bowintek.practice.vo.FactWell.FactWellGroupList;
+import com.bowintek.practice.vo.FactWell.FactWellTime;
+
 import java.util.List;
 
 public interface FactWellCQuery {
@@ -8,4 +10,6 @@ public interface FactWellCQuery {
     List<FactWellGroupList> getMonthGroupList(String wellId, String startDay, String endDay);
     List<FactWellGroupList> getYearGroupList(String wellId, String startDay, String endDay);
     List<FactWellGroupList> getMonthShowInList(String wellId, String startDay, String endDay);
+    List<FactWellTime> getDayTime(String wellId);
+    List<FactWellTime> getMonthTime(String wellId);
 }

+ 126 - 76
src/main/java/com/bowintek/practice/services/impl/FactWellServiceImpl.java

@@ -8,6 +8,9 @@ import com.bowintek.practice.util.multipdb.DBTypeEnum;
 import com.bowintek.practice.util.multipdb.SwitchDataSource;
 import com.bowintek.practice.vo.EsQueryLogVo;
 import com.bowintek.practice.vo.FactWell.FactWellGroupList;
+import com.bowintek.practice.vo.FactWell.FactWellResult;
+import com.bowintek.practice.vo.FactWell.FactWellTime;
+import com.bowintek.practice.vo.FactWell.FactWellTimeResult;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.apache.commons.lang3.SystemUtils;
@@ -26,18 +29,24 @@ public class FactWellServiceImpl implements FactWellService {
 
     @Override
     @SwitchDataSource(DBTypeEnum.POSTGRE)
-    public List<FactWellGroupList> getFactWellList(String wellId, String timeType){
+    public FactWellResult getFactWellList(String wellId, String timeType){
+        if(wellId==null) return FactWellResult.gen(new ArrayList<>(), null);
         //当前只有月份计算方式
-        return getMonthShowInList(wellId);
+        return getMonthShowInList(wellId, null, null);
     }
 
-    public List<FactWellGroupList> getMonthShowInList(String wellId){
+    public FactWellTimeResult getMonthTimeLimit(String wellId){
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(getToDay());
 
+        //根据SQL查询最后一天有数据的日期
+        List<FactWellTime> dayList = factWellCQuery.getDayTime(wellId);
+        if(dayList.size()>0) calendar.setTime(dayList.get(0).getDayTime());
+
+        //取当月最后一天
+        calendar.add(Calendar.MONTH, 1);
         calendar.set(Calendar.DAY_OF_MONTH, 1);
         calendar.add(Calendar.DAY_OF_MONTH, -1);
-        //上月最后
         Date endTime = calendar.getTime();
 
         //11月前的1号
@@ -45,16 +54,19 @@ public class FactWellServiceImpl implements FactWellService {
         calendar.set(Calendar.DAY_OF_MONTH, 1);
         Date startTime = calendar.getTime();
 
-        return getMonthShowInList(wellId, startTime, endTime);
+        return FactWellTimeResult.gen("day", startTime, endTime);
     }
-    public List<FactWellGroupList> getMonthShowInList(String wellId, Date startTime, Date endTime){
+    public FactWellResult getMonthShowInList(String wellId, Date startTime, Date endTime){
+        FactWellTimeResult timeResult = getMonthTimeLimit(wellId);
         //重新计算当前12月
-        if(startTime==null || endTime==null) return getMonthGroupList(wellId);
+        if(startTime==null || endTime==null) {
+            startTime = timeResult.getStartTime();
+            endTime = timeResult.getEndTime();
+        }
 
         System.out.println("getMonthGroupList startTime:"+dateToDayString(startTime)
                 +" endTime:"+dateToDayString(endTime)
                 +" wellId:"+wellId);
-        if(StringUtils.IsNullEmpty(wellId)) return new ArrayList<>();
 
         List<FactWellGroupList> rtnList = factWellCQuery
                 .getMonthShowInList(wellId, dateToDayString(startTime), dateToDayString(endTime));
@@ -70,37 +82,31 @@ public class FactWellServiceImpl implements FactWellService {
             time = calendarTime.getTime();
         }
 
-        rtnList = supplementList(wellId, monthList, rtnList);
-        return rtnList;
+        return FactWellResult.gen(supplementList(wellId, monthList, rtnList),
+                Arrays.stream((new FactWellTimeResult[]{timeResult})).toList());
     }
 
     @Override
     @SwitchDataSource(DBTypeEnum.POSTGRE)
-    public List<FactWellGroupList> getFactWellListByTime(String wellId, String timeType, Date startTime, Date endTime){
+    public FactWellResult getFactWellListByTime(String wellId, String timeType, Date startTime, Date endTime){
         if(timeType.equals("day")) return getDayGroupList(wellId, startTime, endTime);
         if(timeType.equals("month")) return getMonthGroupList(wellId, startTime, endTime);
         else return getYearGroupList(wellId, startTime, endTime);
     }
 
-    public List<FactWellGroupList> getDayGroupList(String wellId){
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(getToDay()); // 设置当前天日期
-        //上月最后一天
-        Date endTime = calendar.getTime();
+    public FactWellResult getDayGroupList(String wellId, Date startTime, Date endTime){
+        List<FactWellTimeResult> timeList = getTimeLimitList(wellId);
+        FactWellTimeResult timeResult = getTimeResult(timeList, "day");
 
-        calendar.add(Calendar.DAY_OF_MONTH, -29);
-        Date startTime = calendar.getTime();
-        return getDayGroupList(wellId, startTime, endTime);
-    }
-
-    public List<FactWellGroupList> getDayGroupList(String wellId, Date startTime, Date endTime){
         //重新计算当前30天日期
-        if(startTime==null || endTime==null) return getDayGroupList(wellId);
+        if(startTime==null || endTime==null) {
+            startTime = timeResult.getStartTime();
+            endTime = timeResult.getEndTime();
+        }
 
         System.out.println("getMonthGroupList startTime:"+dateToDayString(startTime)
                 +" endTime:"+dateToDayString(endTime)
                 +" wellId:"+wellId);
-        if(StringUtils.IsNullEmpty(wellId)) return new ArrayList<>();
 
         List<FactWellGroupList> rtnList = factWellCQuery
                 .getDayGroupList(wellId, dateToDayString(startTime), dateToDayString(endTime));
@@ -115,44 +121,23 @@ public class FactWellServiceImpl implements FactWellService {
             calendarTime.add(Calendar.DAY_OF_MONTH, 1);
             time = calendarTime.getTime();
         }
-        rtnList = supplementList(wellId, dayList, rtnList);
-        return rtnList;
-    }
 
-    public Date getToDay(){
-        Calendar calendar = Calendar.getInstance();
-        calendar.set(Calendar.HOUR_OF_DAY, 0);
-        calendar.set(Calendar.MINUTE, 0);
-        calendar.set(Calendar.SECOND, 0);
-        calendar.set(Calendar.MILLISECOND, 0);
-        return calendar.getTime();
+        return FactWellResult.gen(supplementList(wellId, dayList, rtnList), timeList);
     }
 
-    public List<FactWellGroupList> getMonthGroupList(String wellId){
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(getToDay());
-
-        calendar.add(Calendar.MONTH, 1);
-        calendar.set(Calendar.DAY_OF_MONTH, 1);
-        calendar.add(Calendar.DAY_OF_MONTH, -1);
-        //当前月最后一天
-        Date endTime = calendar.getTime();
-
-        //11月前的1号
-        calendar.add(Calendar.MONTH, -11);
-        calendar.set(Calendar.DAY_OF_MONTH, 1);
-        Date startTime = calendar.getTime();
+    public FactWellResult getMonthGroupList(String wellId, Date startTime, Date endTime){
+        List<FactWellTimeResult> timeList = getTimeLimitList(wellId);
+        FactWellTimeResult timeResult = getTimeResult(timeList, "month");
 
-        return getMonthGroupList(wellId, startTime, endTime);
-    }
-    public List<FactWellGroupList> getMonthGroupList(String wellId, Date startTime, Date endTime){
         //重新计算当前12月
-        if(startTime==null || endTime==null) return getMonthGroupList(wellId);
+        if(startTime==null || endTime==null) {
+            startTime = timeResult.getStartTime();
+            endTime = timeResult.getEndTime();
+        }
 
         System.out.println("getMonthGroupList startTime:"+dateToDayString(startTime)
                 +" endTime:"+dateToDayString(endTime)
                 +" wellId:"+wellId);
-        if(StringUtils.IsNullEmpty(wellId)) return new ArrayList<>();
 
         List<FactWellGroupList> rtnList = factWellCQuery
                 .getMonthGroupList(wellId, dateToDayString(startTime), dateToDayString(endTime));
@@ -168,36 +153,22 @@ public class FactWellServiceImpl implements FactWellService {
             time = calendarTime.getTime();
         }
 
-        rtnList = supplementList(wellId, monthList, rtnList);
-        return rtnList;
+        return FactWellResult.gen(supplementList(wellId, monthList, rtnList), timeList);
     }
 
-    public List<FactWellGroupList> getYearGroupList(String wellId){
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(getToDay());
-        calendar.set(Calendar.MONTH, 12);
-        calendar.set(Calendar.DAY_OF_MONTH, 1);
-        calendar.add(Calendar.MONTH, 1);
-        calendar.add(Calendar.DAY_OF_MONTH, -1);
-        //当年最后一天
-        Date endTime = calendar.getTime();
-        //5年前1月1日
-        calendar.add(Calendar.YEAR, -4);
-        calendar.set(Calendar.MONTH, 1);
-        calendar.set(Calendar.DAY_OF_MONTH, 1);
-        Date startTime = calendar.getTime();
-
-        return getYearGroupList(wellId, startTime, endTime);
-    }
+    public FactWellResult getYearGroupList(String wellId, Date startTime, Date endTime){
+        List<FactWellTimeResult> timeList = getTimeLimitList(wellId);
+        FactWellTimeResult timeResult = getTimeResult(timeList, "year");
 
-    public List<FactWellGroupList> getYearGroupList(String wellId, Date startTime, Date endTime){
         //重新计算5年时间
-        if(startTime==null || endTime==null) return getYearGroupList(wellId);
+        if(startTime==null || endTime==null) {
+            startTime = timeResult.getStartTime();
+            endTime = timeResult.getEndTime();
+        }
 
         System.out.println("getMonthGroupList startTime:"+dateToDayString(startTime)
                 +" endTime:"+dateToDayString(endTime)
                 +" wellId:"+wellId);
-        if(StringUtils.IsNullEmpty(wellId)) return new ArrayList<>();
 
         List<FactWellGroupList> rtnList = factWellCQuery
                 .getYearGroupList(wellId, dateToDayString(startTime), dateToDayString(endTime));
@@ -213,10 +184,89 @@ public class FactWellServiceImpl implements FactWellService {
             time = calendarTime.getTime();
         }
 
-        rtnList = supplementList(wellId, monthList, rtnList);
+        return FactWellResult.gen(supplementList(wellId, monthList, rtnList), timeList);
+    }
+
+    public List<FactWellTimeResult> getTimeLimitList(String wellId){
+        //根据SQL查询最后一天有数据的日期
+        List<FactWellTime> dayList = factWellCQuery.getDayTime(wellId);
+        List<FactWellTime> monthList = factWellCQuery.getMonthTime(wellId);
+        Date day = getToDay(), month = getToDay();
+        if(dayList.size()>0) day = dayList.get(0).getDayTime();
+        if(monthList.size()>0) month = monthList.get(0).getDayTime();
+
+        List<FactWellTimeResult> rtnList = new ArrayList<>();
+        rtnList.add(getDayTimeLimit(day));
+        rtnList.add(getMonthTimeLimit(month));
+        rtnList.add(getYearTimeLimit(month));
+
         return rtnList;
     }
 
+    public FactWellTimeResult getTimeResult(List<FactWellTimeResult> timeList, String timeType){
+        return timeList.stream().filter(r->r.getTimeType().equals(timeType))
+                .collect(Collectors.toList()).get(0);
+    }
+
+    public FactWellTimeResult getDayTimeLimit(Date toDay){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(toDay);
+
+        //有数据当天的日期
+        Date endTime = calendar.getTime();
+        //向前推30天后的日期
+        calendar.add(Calendar.DAY_OF_MONTH, -29);
+        Date startTime = calendar.getTime();
+        return FactWellTimeResult.gen("day", startTime, endTime);
+    }
+
+    public FactWellTimeResult getMonthTimeLimit(Date toDay){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(toDay);
+
+        //当前月最后一天
+        calendar.add(Calendar.MONTH, 1);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        Date endTime = calendar.getTime();
+
+        //11月前的1号
+        calendar.add(Calendar.MONTH, -11);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        Date startTime = calendar.getTime();
+
+        return FactWellTimeResult.gen("month", startTime, endTime);
+    }
+
+    public FactWellTimeResult getYearTimeLimit(Date toDay){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(toDay);
+
+        //当年12月最后一天
+        calendar.set(Calendar.MONTH, 11);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.add(Calendar.MONTH, 1);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        Date endTime = calendar.getTime();
+
+        //5年前1月1日
+        calendar.add(Calendar.YEAR, -4);
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        Date startTime = calendar.getTime();
+
+        return FactWellTimeResult.gen("year", startTime, endTime);
+    }
+
+    public Date getToDay(){
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+
     public List<FactWellGroupList> supplementList(String wellId, List<String> timeList, List<FactWellGroupList> source){
         //if(source.stream().filter(r->r.getTime_str().equals()))
         for(int i=0;i<timeList.size();i++){

+ 3 - 2
src/main/java/com/bowintek/practice/services/service/FactWellService.java

@@ -1,11 +1,12 @@
 package com.bowintek.practice.services.service;
 
 import com.bowintek.practice.vo.FactWell.FactWellGroupList;
+import com.bowintek.practice.vo.FactWell.FactWellResult;
 
 import java.util.Date;
 import java.util.List;
 
 public interface FactWellService {
-    List<FactWellGroupList> getFactWellList(String wellId, String timeType);
-    List<FactWellGroupList> getFactWellListByTime(String wellId, String timeType, Date startTime, Date endTime);
+    FactWellResult getFactWellList(String wellId, String timeType);
+    FactWellResult getFactWellListByTime(String wellId, String timeType, Date startTime, Date endTime);
 }

+ 18 - 0
src/main/java/com/bowintek/practice/vo/FactWell/FactWellResult.java

@@ -0,0 +1,18 @@
+package com.bowintek.practice.vo.FactWell;
+
+import lombok.Data;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class FactWellResult {
+    private List<FactWellGroupList> rows;
+    private List<FactWellTimeResult> timeList;
+
+    public static FactWellResult gen(List<FactWellGroupList> rows, List<FactWellTimeResult> timeList){
+        FactWellResult obj = new FactWellResult();
+        obj.setRows(rows);
+        obj.setTimeList(timeList);
+        return obj;
+    }
+}

+ 10 - 0
src/main/java/com/bowintek/practice/vo/FactWell/FactWellTime.java

@@ -0,0 +1,10 @@
+package com.bowintek.practice.vo.FactWell;
+
+import lombok.Data;
+import java.util.Date;
+
+@Data
+public class FactWellTime {
+    private String well_id;
+    private Date dayTime;
+}

+ 21 - 0
src/main/java/com/bowintek/practice/vo/FactWell/FactWellTimeResult.java

@@ -0,0 +1,21 @@
+package com.bowintek.practice.vo.FactWell;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class FactWellTimeResult {
+    private String timeType;
+    private Date startTime;
+    private Date endTime;
+
+    public static FactWellTimeResult gen(String timeType, Date startTime, Date endTime){
+        FactWellTimeResult obj = new FactWellTimeResult();
+        obj.setTimeType(timeType);
+        obj.setEndTime(endTime);
+        obj.setStartTime(startTime);
+        return obj;
+    }
+}

+ 18 - 0
src/main/resources/mapping/cquery/FactWellCQuery.xml

@@ -28,6 +28,24 @@
         GROUP BY t.well_id, t.prod_time_str
     </select>
 
+    <select id="getDayTime" resultType="com.bowintek.practice.vo.FactWell.FactWellTime">
+        SELECT wm.well_id, wm.prod_date dayTime
+        FROM by_dwr.fact_dwr_pc_pro_well_vol_d wm
+        WHERE wm.prod_date is not null
+          and wm.well_id=#{wellId}
+        ORDER BY wm.prod_date desc
+        LIMIT 1
+    </select>
+
+    <select id="getMonthTime" resultType="com.bowintek.practice.vo.FactWell.FactWellTime">
+        SELECT wm.well_id, to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD') dayTime
+        FROM by_dwr.fact_dwr_pc_pro_well_vol_m wm
+        WHERE wm.prod_date is not null
+          and wm.well_id=#{wellId}
+        ORDER BY to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD') desc
+            LIMIT 1
+    </select>
+
     <select id="getMonthShowInList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
         SELECT t.well_id,
             t.prod_time_str time_str,

+ 14 - 8
vue/src/components/basic/chart/chart-cell.vue

@@ -54,11 +54,14 @@
         return props.lineColor? props.lineColor : '#0058D0';
       });
 
+      const units = {oil:'10kt', gas:'10^8m³',vol:'10kt'};
+
       return{
         timeType,
         dataType,
         wellId,
-        lineColor
+        lineColor,
+        units
       }
     },
     mounted(){
@@ -88,7 +91,7 @@
         if(this.datas==null){
           const result = await get('/factwell/getFactWellList',
             { wellId: this.wellId, timeType: this.timeType });
-          this.datas = result;
+          this.datas = result.rows;
         }
         return this.datas;
       },
@@ -102,9 +105,9 @@
       getyAxis:function (){
         return {type: 'value', min:'dataMin', max:'dataMax', show:false };
       },
-      getSeries:async function (showSymbol){
+      getSeries:async function (symbolSize){
         let dataArys = await this.getDatas();
-        let series = [{type: this.serieType, data:[] as any, showSymbol:showSymbol,
+        let series = [{type: this.serieType, data:[] as any, showSymbol:true, symbolSize:symbolSize, symbol: 'circle',
           itemStyle : {color:this.lineColor}, lineStyle : {width:1}}];
         //数据组装,这里根据业务组装y轴数据
         (dataArys! as any).forEach(row=>{ series[0].data.push(row[this.dataType]) });
@@ -113,10 +116,10 @@
       },
       readerCell: async function () {
         const option = {
-          grid: { top: 0, left: 0, right: 0, bottom: 0, containLabel: false },
+          grid: { top: 2, left: 0, right: 0, bottom: 2, containLabel: false },
           xAxis: await this.getxAxis(false),
           yAxis: this.getyAxis(),
-          series: await this.getSeries(false)
+          series: await this.getSeries(2)
         };
         console.log("readerCell-"+this.serieType,option);
 
@@ -130,13 +133,16 @@
       readerChart: async function () {
         let xAxis = await this.getxAxis(true);
         xAxis['nameRotate'] = 0;
+        let unitStr = "";
+        if(this.units[this.dataType]) unitStr = "("+this.units[this.dataType]+")"
+
         const option = {
           title: { text: '累产量趋势图' },
           tooltip: { trigger: 'item', triggerOn:"mousemove",showContent:true },
           grid: { top:'15%', left: '3%', right: '3%', bottom: '6%', containLabel: true },
           xAxis: xAxis,
-          yAxis: { type: 'value'},
-          series: await this.getSeries(true)
+          yAxis: { type: 'value', axisLabel: { formatter : '{value}'+unitStr}},
+          series: await this.getSeries(5)
         };
         console.log("readerChart-"+this.serieType,option);
 

+ 55 - 22
vue/src/components/basic/chart/chart-prod-dynamics.vue

@@ -26,6 +26,7 @@
             <a-select
               v-model:value="formState.timeType"
               :options="getOptions()"
+              @change="onTimeTypeChange"
             ></a-select>
           </a-form-item>
         </a-col>
@@ -63,6 +64,7 @@
   import * as echarts from "echarts";
   import type {FormInstance} from 'ant-design-vue';
   import {get} from '@/api/common';
+  import dayjs from 'dayjs';
 
   export  default defineComponent ({
     props:{
@@ -78,7 +80,8 @@
         id : Date.now(),
         hovered : false,
         height : 130,
-        datas : []
+        datas : [],
+        timeList : [] as any
       }
     },
     setup(props, context){
@@ -92,7 +95,7 @@
       const formState = reactive({
         days:[null, null],
         timeType: "day",  startTime: '', endTime: '',
-        dataTypes : ['oil', 'water', 'gas'],
+        dataTypes : ['oil', 'water', 'gas', 'fluid', 'watercut', 'vol'],
         wellId : wellId
       });
 
@@ -121,16 +124,36 @@
         if(this.formState.days[1]!=null)
           this.formState.endTime = (this.formState.days[1] as any).format(formatString);
 
-        this.datas = await get('/factwell/getFactWellListByTime', {
+        let result = await get('/factwell/getFactWellListByTime', {
           wellId : this.wellId,
           timeType : this.formState.timeType,
           startTime : this.formState.startTime,
           endTime : this.formState.endTime
         });
-        console.log("onFinish",this.datas);
+        this.datas = result.rows;
+        //从服务器返回默认时间范围
+        if(this.timeList.length==0 && result.timeList) this.timeList = result.timeList;
+        this.initTimeLimit();
+
+        console.log("onFinish",result);
         this.getTotals();
         this.readerChart();
       },
+      initTimeLimit:function (){
+        if(this.formState.days[0]==null && this.formState.days[1]==null){
+          let timeResult = this.timeList.filter(row=>{
+            return row.timeType == this.formState.timeType;
+          });
+          if(timeResult.length>0){
+            this.formState.days[0] = dayjs(timeResult[0].startTime) as any;
+            this.formState.days[1] = dayjs(timeResult[0].endTime) as any;
+          }
+        }
+      },
+      onTimeTypeChange:function (){
+        if(this.timeList.length>=3) this.formState.days=[null, null];
+        this.initTimeLimit();
+      },
       getChartStyle:function (){
         return { width: "100%", height: (this.height) * this.getTypes().length + 160 + "px" };
       },
@@ -140,12 +163,12 @@
           {label:'年', value:'year'}];
       },
       getTypeOptions:function (){
-        return [{label:'产油量', value:'oil', unit:'万吨'},
-          {label:'产水量', value:'water', unit:'万吨'},
-          {label:'产液量', value:'fluid', unit:'万吨'},
-          {label:'产气量', value:'gas', unit:'立方米'},
-          {label:'含水率', value:'watercut', unit:'万吨'},
-          {label:'注水量', value:'vol', unit:'立方米'}
+        return [{label:'产油量', value:'oil', unit:'(万吨)'},
+          {label:'产水量', value:'water', unit:'(万吨)'},
+          {label:'产液量', value:'fluid', unit:'(万吨)'},
+          {label:'产气量', value:'gas', unit:'(立方米)'},
+          {label:'含水率', value:'watercut', unit:''},
+          {label:'累注水量', value:'vol', unit:'(万吨)'}
         ];
       },
       getTypes:function (){
@@ -182,8 +205,8 @@
       getGrids:function (){
         let grids = [] as any;
         let showList = this.getTypes();
-        for(let i=0;i< showList.length;i++){
-          let top = 20 + i * (this.height) + i * 10;
+        for(let i=1;i< showList.length;i++){
+          let top = 20 + this.getGridIndex(i) * (this.height) + i * 10;
           grids.push({ left:'10%', top: top + 'px', width:'86%', height: (this.height-30) + 'px'});
         }
         console.log("getGrids",grids);
@@ -192,8 +215,8 @@
       getxAxis:function (){
         let xAxis = [] as any;
         let showList = this.getTypes();
-        for(let i=0;i< showList.length;i++){
-          let row = { gridIndex : i, type : 'category',
+        for(let i=1;i< showList.length;i++){
+          let row = { gridIndex : this.getGridIndex(i), type : 'category',
             data : this.getxDatas(),
             show : (i+1)==showList.length,
             axisLabel:{rotate:50}};
@@ -205,12 +228,13 @@
       getyAxis:function (){
         let yAxis = [] as any;
         let showList = this.getTypes();
-        for(let i=0;i< showList.length;i++){
-          let row = { gridIndex : i,
-            name:showList[i].label,
-            nameGap: 50,
+        for(let i=1;i< showList.length;i++){
+          let row = { gridIndex : this.getGridIndex(i),
+            name:this.getyAxisTitle(i, showList[i].label),
+            nameGap: 100,
             nameLocation:'center',
-            type : 'value'};
+            type : 'value',
+            axisLabel: { formatter : '{value}'+this.getTypeUnit(showList[i].label)}};
           yAxis.push(row);
         }
         console.log("getyAxis",yAxis);
@@ -221,12 +245,20 @@
         let showList = this.getTypes();
         let yDatas = this.getyDatas();
         for(let i=0;i< showList.length;i++){
-          let row = { xAxisIndex : i, yAxisIndex: i, type : this.serieType, data: yDatas[i] };
+          let row = { xAxisIndex : this.getGridIndex(i), yAxisIndex: this.getGridIndex(i),
+            type : this.serieType, data: yDatas[i] ,
+            name : i<=1?showList[i].label: null};
           series.push(row);
         }
         console.log("getSeries",series);
         return series;
       },
+      getyAxisTitle:function (i, label){
+        return i<=1?"累产油量/水量":label;
+      },
+      getGridIndex:function (i){
+        return i<=1?0:i-1;
+      },
       getTotals:function (){
         let totals = [] as any;
         let showList = this.getTypes();
@@ -236,7 +268,7 @@
           yDatas[i].forEach(it=>{ total+=it*1; });
           totals.push({
             name:showList[i].label,
-            total : total,
+            total : total.toFixed(2),
             unit : this.getTypeUnit(showList[i].label)
           });
         }
@@ -249,7 +281,8 @@
           grid: this.getGrids(),
           xAxis: this.getxAxis(),
           yAxis: this.getyAxis(),
-          series: this.getSeries()
+          series: this.getSeries(),
+          legend : { top:40, right:80}
         };
         console.log("readerChart-"+this.serieType,option);