Ver código fonte

折线图方法调试

lizaixun 4 anos atrás
pai
commit
b2bd868458
2 arquivos alterados com 39 adições e 29 exclusões
  1. 38 28
      components/windFarmcard/WindFarmcard.vue
  2. 1 1
      pages/index/Index.vue

+ 38 - 28
components/windFarmcard/WindFarmcard.vue

@@ -83,8 +83,25 @@
 
 <script>
 	import uCharts from '../tools/u-charts/u-charts.js';
+	import utils from '../tools/shoyu-date/utils.filter.js'
 	var _self;
 	var canvaLineB3 = null;
+	Date.prototype.Format = function(fmt) {
+		var o = {
+			'M+': this.getMonth() + 1, //月份
+			'd+': this.getDate(), //日
+			'h+': this.getHours(), //小时
+			'm+': this.getMinutes(), //分
+			's+': this.getSeconds(), //秒
+			'q+': Math.floor((this.getMonth() + 3) / 3), //季度
+			S: this.getMilliseconds() //毫秒
+		};
+		if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
+		for (var k in o)
+			if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[
+				k]).substr(('' + o[k]).length));
+		return fmt;
+	};
 	export default {
 		data: function() {
 			return {
@@ -98,6 +115,7 @@
 				windStationCardCHeight: '',
 				windStationCardPixelRatio: 1,
 				plusDrawerList: [],
+				uchartTime:[],
 			}
 		},
 		onLoad: function() {
@@ -119,26 +137,20 @@
 			},
 			getUchartData:function(lineChartdata){
 				this.lineChartdata = [];
+				this.uchartTime = [];
 				this.lineChartdata = lineChartdata;
-				this.getLinAcharts();
+				console.log(this.lineChartdata)
+				let _this = this;
+				for(let i=0;i<_this.lineChartdata.length;i++){
+					let time = new Date(
+						_this.lineChartdata[i].time * 1000).Format('hh');
+					_this.uchartTime.push(time);					
+				}
+				console.log(_this.uchartTime)
+				_this.getLinAcharts();
 			},
 			getLinAcharts: function() {
-				Date.prototype.Format = function(fmt) {
-					var o = {
-						'M+': this.getMonth() + 1, //月份
-						'd+': this.getDate(), //日
-						'h+': this.getHours(), //小时
-						'm+': this.getMinutes(), //分
-						's+': this.getSeconds(), //秒
-						'q+': Math.floor((this.getMonth() + 3) / 3), //季度
-						S: this.getMilliseconds() //毫秒
-					};
-					if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
-					for (var k in o)
-						if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[
-							k]).substr(('' + o[k]).length));
-					return fmt;
-				};
+				
 				let LineC = {
 					categories: [],
 					series: [{
@@ -194,26 +206,24 @@
 				let _this = this;
 				LineC.categories = [];
 				LineC.series[0].data = [];
+				LineC.series[1].data = [];
+				LineC.series[2].data = [];
+				LineC.series[3].data = [];
 				console.log( _this.lineChartdata)
 				for (var i = 0; i < _this.lineChartdata.length; i++) {
-					
-					let time = new Date(
-						_this.lineChartdata[i].value2.pointTime * 1000
-					).Format('hh');
-					// console.log(time)
-					LineC.categories.push(time);
-					//console.log(_this.index_curve_columnar_windSpeed_powermodule.index_curve_columnar_windSpeed_powermodule['MHS_FDC']['gl'][i].pointValueInDouble);
+					LineC.categories.push(_this.uchartTime[i]);
+					// console.log(LineC.categories)
 					LineC.series[0].data.push(
-						_this.lineChartdata[i].value2.pointValueInDouble
+						_this.lineChartdata[i].value2
 					);
 					LineC.series[1].data.push(
-						_this.lineChartdata[i].value4.pointValueInDouble
+						_this.lineChartdata[i].value4
 					);
 					LineC.series[2].data.push(
-						_this.lineChartdata[i].value3.pointValueInDouble
+						_this.lineChartdata[i].value3
 					);
 					LineC.series[3].data.push(
-						_this.lineChartdata[i].value1.pointValueInDouble
+						_this.lineChartdata[i].value1
 					);
 				}
 				_this.showWindStationCardLineA3('windStationCanvasLineC', LineC);

+ 1 - 1
pages/index/Index.vue

@@ -547,7 +547,7 @@
 			this.timeNow();
 			this.$nextTick(function(){
 				this.viewUserid();
-			})
+			});
 			this.monitoringAuthority();
 			this.judgeWindfield();
 			this.address = this.dataprocessing.getWindPowerStationName();