|
| 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',
|
|
| xqd
@@ -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');
|
|
|
});
|
|
| xqd
@@ -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){
|
|
| xqd
@@ -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], //扭矩
|
|
| xqd
@@ -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: {
|
|
| xqd
@@ -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: {
|
|
| xqd
@@ -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
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
],
|
|
|
// 数据内容数组
|