You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.5 KiB

  1. 'use strict';
  2. angular.module('app.dateAnalysis', ['ngRoute', 'chart.js'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/dateAnalysis', {
  5. templateUrl: 'views/dateAnalysis/dateAnalysis.html',
  6. controller: 'DateAnalysisCtrl'
  7. });
  8. }])
  9. .controller('DateAnalysisCtrl', function($scope, $http) {
  10. $scope.last7day={
  11. data: [],
  12. labels: []
  13. };
  14. $http.get(urlapi + 'last7day')
  15. .then(function(data, status, headers, config) {
  16. console.log('data success');
  17. console.log(data);
  18. $scope.last7day.data = data.data.data;
  19. $scope.last7day.labels=data.data.labels;
  20. }, function(data, status, headers, config) {
  21. console.log('data error');
  22. });
  23. //date analysis
  24. $scope.last24hour= {
  25. data:[],
  26. labels: []
  27. };
  28. $http.get(urlapi + 'last24hour')
  29. .then(function(data, status, headers, config) {
  30. console.log('data success');
  31. console.log(data);
  32. $scope.last24hour.data = data.data.data;
  33. $scope.last24hour.labels = data.data.labels;
  34. }, function(data, status, headers, config) {
  35. console.log('data error');
  36. });
  37. $scope.last7dayhour= {
  38. data:[],
  39. labels: []
  40. };
  41. $http.get(urlapi + 'last7dayhour')
  42. .then(function(data, status, headers, config) {
  43. console.log('data success');
  44. console.log(data);
  45. $scope.last7dayhour.data = data.data.data;
  46. $scope.last7dayhour.labels = data.data.labels;
  47. $scope.last7dayhour.series = data.data.series;
  48. }, function(data, status, headers, config) {
  49. console.log('data error');
  50. });
  51. $scope.lastmonths={
  52. data: [],
  53. labels: []
  54. };
  55. $scope.monthsCount = 3;
  56. $http.get(urlapi + 'lastmonths/' + $scope.monthsCount)
  57. .then(function(data, status, headers, config) {
  58. console.log('data success');
  59. console.log(data);
  60. $scope.lastmonths.data = data.data.data;
  61. $scope.lastmonths.labels=data.data.labels;
  62. }, function(data, status, headers, config) {
  63. console.log('data error');
  64. });
  65. });