Mike 8 rokov pred
rodič
commit
827c139673

+ 2 - 1
yanshi/www/index.html

xqd
@@ -10,8 +10,9 @@
 	    <link href="css/style.css" rel="stylesheet">
 	
 		<script src="https://a.alipayobjects.com/g/datavis/g2/2.2.3/g2.js"></script>
+
 	 
-	</head>
+	</head>		
 		<body ng-app="starter">
 		    <ion-nav-view></ion-nav-view>
 		</body>

+ 49 - 0
yanshi/www/js/controllers.js

xqd xqd
@@ -117,7 +117,51 @@ starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$st
 		        });
 			})
 		})
+
+		var Stat = G2.Stat;
+	    var vvvdata = [];
+	    for(var i = 0; i <= 20; i ++) {
+	        for(var j = 0; j <= 20; j ++) {
+	          var x = i*25.6;
+	          var y = j*19.2;
+	          var z = 700-(x+0.5*y)+Math.random()*(400); 
+	          vvvdata.push({
+	            l: x,
+	            g: y,
+	            Altitude: z
+	          });
+	        }
+	    }
+      var chart = new G2.Chart({
+        id: 'c1',
+        forceFit: true,
+        height: 450
+      });
+      //为了将数据与图片上的位置完全吻合,我们需要将横轴和纵轴的范围设定为数据对应范围,并将范围优化处理关闭
+      var defs = {
+        'l': {
+          type: 'linear',
+          min: 0,
+          max: 512,
+          nice: false//优化处理关闭
+        },
+        'g': {
+          type: 'linear',
+          min: 0,
+          max: 384,
+          nice: false
+        },
+        'Altitude': {
+          tickCount:200
+        }
+      };
+
+      chart.source(vvvdata,defs);
+      chart.contour().position(Stat.smooth.loess.triangular('l*g*Altitude',0.01)).color('Altitude','hue').size(3);
+      chart.render();
+		document.getElementById('newchats').style.display='none';
     });
+
     $scope.change = function(selectedName){
     	$scope.name = selectedName;
 		$ionicLoading.show({
@@ -167,6 +211,11 @@ starter.controller('showCtrl',["$scope",'$ionicHistory','$state','$timeout','$st
 		return tabUrl == $scope.currentTab;
 	};
 	$scope.onClickTab = function(tab){
+		if(tab.url=="strom.html"){
+			document.getElementById('newchats').style.display='block';
+		}else{
+			document.getElementById('newchats').style.display='none';
+		}
 		$scope.currentTab = tab.url;
 	};
 	//TN曲线图

+ 4 - 3
yanshi/www/templates/show.html

xqd
@@ -102,9 +102,10 @@
 			<line id="line" legend2="legend2" item2="item2" data3="data3" num="num"></line> 
 		</div>
 	</script>
-	<script id="strom.html" type="text/ng-template">
-		<div id="c1"></div>
-	</script>
+	<div id="newchats">
+	<div id="c1"></div>
+	</div>
+		
 </ion-view>