Browse Source

风机曲线charts

songhaodong 2 năm trước cách đây
mục cha
commit
ee7b588787

+ 302 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/parameterConfiguration/WindTurbinePowerCurve/charts/index.vue

@@ -0,0 +1,302 @@
+<template>
+  <div style="width: 100%;height: 100%">
+    <div id="rpcharts"></div>
+  </div>
+</template>
+
+<script>
+  import resize from '../../../../components/Charts/mixins/resize'
+  import echarts from 'echarts'
+  import cc from '../../../curvecolors'
+  import variables from '@/styles/variables.scss'
+  export default {
+    mixins: [resize],
+    watch: {
+      drawData: {
+        handler(newValue, oldValue) {
+          this.draw(newValue,newValue.Fan1, newValue.Fan2,newValue.Fan3,newValue.Fan4,newValue.Fan5, newValue.xData)
+        },
+        deep: true
+      },
+      resizeKey: function (newQuestion, oldQuestion) {
+        if (this.chart != null) {
+          this.chart.resize();
+        }
+      }
+    },
+    props: {
+      drawData: {
+        type: Object,
+      },
+      resizeKey: {
+        type: Number
+      }
+    },
+    data() {
+      return {
+        lineColor:'',
+        chart: null,
+      }
+    },
+    mounted() {
+      if(sessionStorage.getItem('styleSwitch') === 'blue'){
+        this.lineColor = 'white'
+      }else{
+        this.lineColor = '#3b3b3b'
+      }
+    },
+    beforeDestroy() {
+      if (!this.chart) {
+        return
+      }
+      this.chart.dispose()
+      this.chart = null
+    },
+    methods: {
+      draw(newValue,Fan1, Fan2,Fan3,Fan4,Fan5,xData) {
+        this.chart = echarts.init(document.getElementById('rpcharts'))
+          var option = {
+          backgroundColor: 'transparent',
+          title: {
+            top: 20,
+            text: '风速功率曲线',
+            textStyle: {
+              fontWeight: 'normal',
+              fontSize: 16,
+              color: this.lineColor
+            },
+            left: '1%'
+          },
+          tooltip: {
+            trigger: 'axis',
+            axisPointer: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          },
+          legend: {
+            top: 20,
+            icon: 'rect',
+            itemWidth: 14,
+            itemHeight: 5,
+            itemGap: 13,
+            data: ['功率曲线'],
+            right: '4%',
+            textStyle: {
+              fontSize: 12,
+              color: this.lineColor
+            }
+          },
+          dataZoom: [{
+            show: true,
+            realtime: true,
+            start: 0,
+            end: 100,
+            left: "15%",
+            right: "15%",
+            textStyle: {
+              color:this.lineColor
+            }
+          }, {
+            type: 'inside'
+          }],
+          grid: {
+            top: 100,
+            left: '2%',
+            right: '2%',
+            bottom: '10%',
+            containLabel: true
+          },
+          xAxis: [{
+            name: 'm/s',
+            type: 'category',
+            boundaryGap: false,
+            axisLine: {
+              lineStyle: {
+                color: this.lineColor
+              }
+            },
+            data: xData
+          }],
+          yAxis: [{
+            type: 'value',
+            name: '(MW)',
+            axisTick: {
+              show: false
+            },
+            axisLine: {
+              lineStyle: {
+                color: this.lineColor
+              }
+            },
+            axisLabel: {
+              margin: 10,
+              textStyle: {
+                fontSize: 14
+              }
+            },
+            splitLine: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          }],
+          series: [{
+            name: '机组1',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: {
+              normal: {
+
+                color: cc.sj,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: Fan1
+          }]
+        }
+
+          option.legend.data = ['机组1','机组2','机组3','机组4','机组5']
+          option.series.push({
+            name: '机组2',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: {
+              normal: {
+
+                color: cc.kygl,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: Fan2
+          },{
+            name: '机组3',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: {
+              normal: {
+
+                color: cc.llgl,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: Fan3
+          },{
+            name: '机组4',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+
+                color: cc.line6,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: Fan4
+          },{
+            name: '机组5',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+
+                color: cc.ybjf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: Fan5
+          },)
+
+
+
+        // if(newValue.hasChartLine == 'true'){
+        //   var carr = ["#8A2BE2","#FF8C00","#0000E3","#85144b","#A8FF24"]
+        //
+        //   var arr = newValue.powerChartLine
+        //   for (let i = 0; i < arr.length; i++) {
+        //     option.legend.data.push(arr[i].title)
+        //     option.series.push({
+        //       name: arr[i].title,
+        //       type: 'line',
+        //       smooth: true,
+        //       symbol: 'circle',
+        //       symbolSize: 5,
+        //       showSymbol: false,
+        //       lineStyle: {
+        //         normal: {
+        //           width: 2
+        //         }
+        //       },
+        //
+        //       itemStyle: {
+        //         normal: {
+        //
+        //           color: carr[i],
+        //           borderColor: 'rgba(219,50,51,0.2)',
+        //           borderWidth: 12
+        //         }
+        //       },
+        //       data: newValue[arr[i].field]
+        //     })
+        //   }
+        //
+        // }
+        this.chart.setOption(option,true)
+      },
+    }
+  }
+</script>
+<style scoped>
+  #rpcharts {
+    width: 100%;
+    height: calc(80vh - 50px);
+  }
+</style>