lxnd 8 years ago
parent
commit
e288a71f9e

+ 1 - 0
yanshi/www/index.html

xqd
@@ -31,6 +31,7 @@
 
     <!-- your app's js -->
     <script src="js/app.js"></script>
+    <script src="js/config.js"></script>
     <script src="js/controllers.js"></script>
     <script src="js/services.js"></script>
   </head>

+ 5 - 0
yanshi/www/js/config.js

xqd
@@ -0,0 +1,5 @@
+var starter = angular.module('starter.services', [])
+
+	starter.constant("config",{
+		server:"http://172.31.40.29/"
+	});

+ 110 - 38
yanshi/www/js/controllers.js

xqd xqd xqd xqd xqd xqd xqd
@@ -37,11 +37,12 @@ starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$i
 }])
 
 starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading',function($scope,$http,$timeout,$ionicLoading){
-	$scope.excals = [
-		{'list':'测试一'},
-		{'list':'测试二'},
-		{'list':'测试三'}
-	];
+	$http({
+    		method:'get',
+    		url:'http://172.31.40.29/list',
+    	}).success(function(newItem){
+    		$scope.excals = newItem
+    	})
 	$scope.doRefresh = function(){
 		$ionicLoading.show({
             tcontent: 'Loading',
@@ -52,10 +53,12 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading',funct
         });
         $timeout(function(){
         	$ionicLoading.hide();
-        	$http.get('../lib/ionic/test.json')  
-            .success(function(newItems) {
-                $scope.excals = newItems;
-            })
+        	$http({
+        		method:'get',
+        		url:'http://172.31.40.29/list',
+        	}).success(function(newItem){
+        		$scope.excals = newItem
+        	})
             .finally(function() {
                 $scope.$broadcast('scroll.refreshComplete');
             });
@@ -63,6 +66,20 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading',funct
 		
 	}
 }])
+
+//starter.factory('getData',['$http','$q',function($http,$q){
+//	return function(){
+//		var defer = $q.defer();
+//		$http.get('../lib/ionic/test2.json')
+//		.success(function(data,status,headers,congfig){
+//			defer.resolve(data)
+//		}).error(function(data,status,headers,congfig){
+//			defer.reject(data);
+//		});
+//		return defer.promise
+//	}
+//}])
+
 //展示首页控制器
 starter.controller('lineCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
 	$scope.go = function(target){
@@ -70,14 +87,26 @@ starter.controller('lineCtrl',["$scope",'$ionicHistory','$state',function($scope
 		$state.go(target)
 	}
 }])
+
+
 //TN曲线控制器
-starter.controller('tnCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
+starter.controller('tnCtrl',["$scope",'$ionicHistory','$state','$http',function($scope,$ionicHistory,$state,$http){
 	$scope.go = function(target){
 		$ionicHistory.clearHistory();
 		$state.go(target)
 	}
 	$scope.legend = ["扭矩", "电压",'输入功率','电流','效率'];  
-    $scope.item = ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm','2400rpm']; 
+	
+//	$http.get('../lib/ionic/test2.json')
+//	.success(function(newItems){
+//		$scope.item = newItems.items;
+//		console.log($scope.item)
+//	})
+	
+	
+	
+    $scope.item = ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm']; 
+    console.log($scope.item)
     $scope.num = [0,1,2,3,4];
     $scope.data = [  
         [0.2,0.8,1.6,2.7,1.3,3.0,2.5,1.1,3.1,0.5,1.4,2.8,1.1], //扭矩  
@@ -99,11 +128,11 @@ starter.directive('line', function() {
             data: "="  
         },  
         restrict: 'E',  
-        template: '<div style="height:400px;"></div>',  
+        template: '<div style="height:700px;"></div>',  
         replace: true,  
         link: function($scope, element, attrs, controller) { 
         	var colors = ['#a62ca6', '#8e0515', '#45baf3','#ff2420','#1a9a1a'];
-            var option = {  
+            var option = { 
             	color:colors,
                 // 提示框,鼠标悬浮交互时的信息提示  
                 tooltip: {  
@@ -111,11 +140,15 @@ starter.directive('line', function() {
                     trigger: 'axis'  
                 },  
                 grid:{
-                	left:'30%'
+
+                	left:'28%'
                 },
-                // 图例  
+                   	//图例  
                 legend: {  
-                    data: $scope.legend  
+                    data: $scope.legend ,
+                    textStyle:{
+                    	fontSize:20
+                    }
                 }, 
 //              toolbox: {
 //			        feature: {
@@ -131,76 +164,115 @@ starter.directive('line', function() {
 			            axisTick: {
 			                alignWithLabel: true
 			            },
+			            axisLabel:{
+		            		textStyle:{
+		            		fontSize:18
+		            	}
+		            },
 			            data: $scope.item
 			        }
 			    ], 
+			    
                 // 纵轴坐标轴  
                 yAxis: [
 		        {
 		            type: 'value',
-		            name: '扭矩',
+//		            name: '扭\n\n(N*m)',
 		            min: 0,
-		            max: 3,
+		            max: 4,
 		            position: 'left',
-		            offset:90,
+		            offset:205,
 		            axisLine: {
 		                lineStyle: {
-		                    color: colors[0]
+		                    color: colors[0],
+		                    width:2
 		                }
 		            },
+		            axisLabel:{
+		            	margin:20,
+		            	textStyle:{
+		            		fontSize:17
+		            	}
+		            }
 		        },
 		        {
 		            type: 'value',
-		            name: '电压',
-		            min: 0,
-		            max: 220,
+//		            name: '电\n\n(V)',
+		            min: 193,
+		            max: 202,
 		            position: 'left',
-		            offset: 60,
+		            offset: 150,
 		            axisLine: {
 		                lineStyle: {
-		                    color: colors[1]
+		                    color: colors[1],
+		                    width:2
 		                }
 		            },
+		             axisLabel:{
+		             	margin:15,
+		            	textStyle:{
+		            		fontSize:17
+		            	}
+		            },
 		        },
 		        {
 		            type: 'value',
-		            name: '输入功率',
+//		            name: '输\n\n\n\n(W)',
 		            min: 0,
-		            max: 1500,
+		            max: 1300,
 		            position: 'left',
-		            offset:23,
+		            offset:90,
 		            axisLine: {
 		                lineStyle: {
-		                    color: colors[2]
+		                    color: colors[2],
+		                    width:2
 		                }
 		            },
+		             axisLabel:{
+		            	textStyle:{
+		            		fontSize:17
+		            	}
+		            },
 		        },
 		        {
 		            type: 'value',
-		            name: '电流',
-		            min: 0,
+//		            name: '电\n\n(A)',
+		            min: 1,
 		            max: 6,
 		            position: 'left',
-		            offset:5,
+		            offset:45,
 		            axisLine: {
 		                lineStyle: {
-		                    color: colors[3]
+		                    color: colors[3],
+		                    width:2
 		                }
 		            },
-		       
+		       		  axisLabel:{
+		       		  	margin:20,
+		            	textStyle:{
+		            		fontSize:17
+		            	}
+		            },
 		        },
 		        {
 		            type: 'value',
-		            name: '效率',
-		            min: 0,
+//		            name: '效\n\n(%)',
+		            min: 10,
 		            max: 80,
 		            position: 'left',
-		            offset:-20,
+		            offset:0,
 		            axisLine: {
 		                lineStyle: {
-		                    color: colors[4]
+		                    color: colors[4],
+		                    width:2
 		                }
 		            },
+		              axisLabel:{
+		              	margin:15,
+		            	textStyle:{
+		            		fontSize:17
+		            	}
+		            },
 		        }
 		    ], 
                 // 数据内容数组  

+ 10 - 0
yanshi/www/js/services.js

xqd
@@ -1,3 +1,13 @@
 angular.module('starter.services', [])
 
+//starter.factory("lineService",["$q","$http",function($q,$http){
+//	return{
+//		get_excal:function(excals){
+//			return $http({
+//				url:'http://172.31.40.29/list',
+//				method:"get"
+//			})
+//		}
+//	}
+//}])
 

+ 1 - 9
yanshi/www/lib/ionic/test.json

xqd
@@ -1,14 +1,6 @@
 
 	[
-		{
-			"list":"测试六"
-		},
-		{
-			"list":"测试七"
-		},
-		{
-			"list":"aaa"
-		}
+		"测试2","测试三"
 	]
 
 	

+ 3 - 0
yanshi/www/lib/ionic/test2.json

xqd
@@ -0,0 +1,3 @@
+{
+	"items":["200rpm","400rpm","600rpm","800rpm","1000rpm","1200rpm","1400rpm","1600rpm","1800rpm","2000rpm"]
+}

+ 1 - 1
yanshi/www/templates/home.html

xqd
@@ -6,7 +6,7 @@
     	<ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
          <ion-list>
          	<ion-item style="border-bottom: 1px solid gray;" ng-repeat = "excal in excals" href="#/line">
-         		{{excal.list}}
+         		{{excal}}
          	</ion-item>
          </ion-list>
     </ion-scroll>

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

xqd
@@ -1,8 +1,9 @@
 <ion-view>
-	<ion-header-bar align-title="left" class="bar-stable">
-	    <a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+	<ion-header-bar class="bar-stable">
+		<a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+		<h1 class="title" style="text-align: center;">主页</h1>
 	</ion-header-bar>
-	<ion-content>
+	<ion-content class="has-header">
 	主页
 	  
 	</ion-content>

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

xqd
@@ -1,8 +1,9 @@
 <ion-view>
-	<ion-header-bar align-title="left" class="bar-stable">
-	    <a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+	<ion-header-bar class="bar-stable">
+		<a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+		<h1 class="title" style="text-align: center;">效率云图</h1>
 	</ion-header-bar>
-	<ion-content>
+	<ion-content overflow-scroll="true" style="overflow: hidden;" class="has-header" >
 	<div  style="line-height: 44px;width: 100%;background-color: #11C1F3;text-align: center;font-size: 20px;color: white;">
 		效率云图
 	</div>

+ 8 - 4
yanshi/www/templates/show/tn.html

xqd
@@ -1,12 +1,16 @@
 <ion-view>
-	<ion-header-bar align-title="left" class="bar-stable">
-	    <a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+	<ion-header-bar class="bar-stable">
+		<a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+		<h1 class="title" style="text-align: center;">TN曲线</h1>
 	</ion-header-bar>
-	<ion-content>
+	<ion-content overflow-scroll="true" style="overflow: hidden;" class="has-header" >
 	<div  style="line-height: 44px;width: 100%;background-color: #11C1F3;text-align: center;font-size: 20px;color: white;">
 		TN曲线
 	</div>
-	<line id="main" legend="legend" item="item" data="data" num="num"></line> 
+	<div>
+		<line id="main" legend="legend" item="item" data="data" num="num"></line> 
+	</div>
+	
 	</ion-content>
 	<div class="tabs">
 	  <a class="tab-item" href="#/line">

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

xqd
@@ -1,8 +1,9 @@
 <ion-view>
-	<ion-header-bar align-title="left" class="bar-stable">
-	    <a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+	<ion-header-bar class="bar-stable">
+		<a class="button icon-left ion-chevron-left button-clear button-dark" ng-click=go('home')>返回</a>
+		<h1 class="title" style="text-align: center;">五轴图</h1>
 	</ion-header-bar>
-	<ion-content>
+	<ion-content overflow-scroll="true" style="overflow: hidden;" class="has-header" >
 	<div  style="line-height: 44px;width: 100%;background-color: #11C1F3;text-align: center;font-size: 20px;color: white;">
 		五轴图
 	</div>

+ 0 - 144
yanshi/www/templates/string.html

xqd
@@ -1,144 +0,0 @@
-app.title = '多 Y 轴示例';
-
-var colors = ['#a62ca6', '#8e0515', '#45baf3','#ff2420','#1a9a1a'];
-
-option = {
-    color: colors,
-
-    tooltip: {
-        trigger: 'axis'
-    },
-    grid: {
-        right: '20%'
-    },
-    toolbox: {
-        feature: {
-            dataView: {show: true, readOnly: false},
-            restore: {show: true},
-            saveAsImage: {show: true}
-        }
-    },
-    xAxis: [
-        {
-            type: 'category',
-            axisTick: {
-                alignWithLabel: true
-            },
-            data: ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm']
-        }
-    ],
-    yAxis: [
-        {
-            type: 'value',
-            name: '扭矩',
-            min: 0,
-            max: 3.2,
-            position: 'left',
-            offset:40,
-            axisLine: {
-                lineStyle: {
-                    color: colors[0]
-                }
-            },
-            axisLabel: {
-                formatter: '{value} N*m'
-            }
-        },
-        {
-            type: 'value',
-            name: '电压',
-            min: 0,
-            max: 220,
-            position: 'left',
-            offset: 0,
-            axisLine: {
-                lineStyle: {
-                    color: colors[1]
-                }
-            },
-            axisLabel: {
-                formatter: '{value} V'
-            }
-        },
-        {
-            type: 'value',
-            name: '输入功率',
-            min: 0,
-            max: 1450,
-            position: 'left',
-            offset:-40,
-            axisLine: {
-                lineStyle: {
-                    color: colors[2]
-                }
-            },
-            axisLabel: {
-                formatter: '{value} W'
-            }
-        },
-        {
-            type: 'value',
-            name: '电流',
-            min: 0,
-            max: 6.5,
-            position: 'left',
-            offset:-80,
-            axisLine: {
-                lineStyle: {
-                    color: colors[3]
-                }
-            },
-            axisLabel: {
-                formatter: '{value} A'
-            }
-        },
-        {
-            type: 'value',
-            name: '效率',
-            min: 0,
-            max: 81,
-            position: 'left',
-            offset:-120,
-            axisLine: {
-                lineStyle: {
-                    color: colors[4]
-                }
-            },
-            axisLabel: {
-                formatter: '{value} %'
-            }
-        }
-    ],
-    series: [
-        {
-            name:'扭矩',
-            type:'line',
-            data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
-        },
-        {
-            name:'电压',
-            type:'line',
-            yAxisIndex: 1,
-            data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
-        },
-        {
-            name:'输入功率',
-            type:'line',
-            yAxisIndex: 2,
-            data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
-        },
-        {
-            name:'电流',
-            type:'line',
-            yAxisIndex: 3,
-            data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
-        },
-        {
-            name:'效率',
-            type:'line',
-            yAxisIndex: 4,
-            data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
-        }
-    ]
-};
-