| ================================================Controller Logic========================================== | |
| var uid = $rootScope.user.id; | |
| $http.get('/smartfarm/showconfiguredmasters/'+uid).then(function(response){ | |
| $scope.configuredmasters = response.data; | |
| var cmid = response.data[0].id; | |
| $http.get('/smartfarm/getdata/'+uid+'/'+cmid).then(function(response){ | |
| var farmdatas = angular.toJson(response.data.farmdatas); | |
| localStorage.setItem('farmdatas', farmdatas); | |
| $scope.d0_1 = []; | |
| for(var j=0; j<response.data.farmdatas.length; j++) | |
| { | |
| $scope.d0_1.push([ j+1 , angular.fromJson(localStorage.farmdatas.temperature) ]); | |
| } | |
| }); | |
| }); | |
| ================================================localStorage.farmdatas================================================================== | |
| "[ | |
| {"id":1,"user_id":2,"master_config_id":1,"ax":23,"ay":21,"az":26,"mx":55,"my":77,"mz":88,"gx":67,"gy":56,"gz":66,"ph":"Alkaline","light":73566,"moisture":"Dry","humidity":88,"temperature":44,"latitude":15.34363,"longitude":17.12222,"nutrition":null,"created_at":"2016-05-01 09:59:33","updated_at":"2016-05-01 09:59:33"}, | |
| {"id":2,"user_id":2,"master_config_id":1,"ax":23,"ay":21,"az":26,"mx":55,"my":77,"mz":88,"gx":67,"gy":56,"gz":66,"ph":"Alkaline","light":73566,"moisture":"Dry","humidity":88,"temperature":48,"latitude":15.34363,"longitude":17.12222,"nutrition":null,"created_at":"2016-05-03 14:10:03","updated_at":"2016-05-03 14:10:03"}, | |
| {"id":3,"user_id":2,"master_config_id":1,"ax":23,"ay":21,"az":26,"mx":55,"my":77,"mz":88,"gx":67,"gy":56,"gz":66,"ph":"Alkaline","light":73566,"moisture":"Dry","humidity":88,"temperature":48,"latitude":15.34363,"longitude":17.12222,"nutrition":null,"created_at":"2016-05-03 16:21:37","updated_at":"2016-05-03 16:21:37"}, | |
| {"id":4,"user_id":2,"master_config_id":1,"ax":23,"ay":21,"az":26,"mx":55,"my":77,"mz":88,"gx":67,"gy":56,"gz":66,"ph":"Alkaline","light":73566,"moisture":"Dry","humidity":88,"temperature":33,"latitude":15.34363,"longitude":17.12222,"nutrition":null,"created_at":"2016-05-03 16:22:49","updated_at":"2016-05-03 16:22:49"}, | |
| {"id":5,"user_id":2,"master_config_id":1,"ax":23,"ay":21,"az":26,"mx":55,"my":77,"mz":88,"gx":67,"gy":56,"gz":66,"ph":"Alkaline","light":73566,"moisture":"Dry","humidity":88,"temperature":38,"latitude":15.34363,"longitude":17.12222,"nutrition":null,"created_at":"2016-05-03 16:25:10","updated_at":"2016-05-03 16:25:10"}, | |
| {"id":6,"user_id":2,"master_config_id":1,"ax":23,"ay":21,"az":26,"mx":55,"my":77,"mz":88,"gx":67,"gy":56,"gz":66,"ph":"Alkaline","light":73566,"moisture":"Dry","humidity":88,"temperature":67,"latitude":15.34363,"longitude":17.12222,"nutrition":null,"created_at":"2016-05-03 17:19:44","updated_at":"2016-05-03 17:19:44"} | |
| ]" | |
| ===================================Template code for graph============================================================================ | |
| <div ui-jq="plot" ui-options="[ | |
| { data:{{d0_1}} , label: 'in C', points: { show: true }, lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 0.1 }, { opacity: 0.1}] } } } | |
| ], | |
| { | |
| colors: [ '#23b7e5','#fad733' ], | |
| series: { shadowSize: 2 }, | |
| xaxis:{ font: { color: '#ccc' } }, | |
| yaxis:{ font: { color: '#ccc' } }, | |
| grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' }, | |
| tooltip: true, | |
| tooltipOpts: { content: '%s of %x.1 is %y.4', defaultTheme: false, shifts: { x: 0, y: 20 } } | |
| }" style="height:240px"> | |
| </div> | |
| ===================================Template output for graph=========================================================================== | |
| <div ui-jq="plot" ui-options="[ | |
| { data:[[1,null],[2,null],[3,null],[4,null],[5,null],[6,null]] , label: 'in C', points: { show: true }, lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 0.1 }, { opacity: 0.1}] } } } | |
| ], | |
| { | |
| colors: [ '#23b7e5','#fad733' ], | |
| series: { shadowSize: 2 }, | |
| xaxis:{ font: { color: '#ccc' } }, | |
| yaxis:{ font: { color: '#ccc' } }, | |
| grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' }, | |
| tooltip: true, | |
| tooltipOpts: { content: '%s of %x.1 is %y.4', defaultTheme: false, shifts: { x: 0, y: 20 } } | |
| }" style="height:240px"> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment