Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. $scope.widgetData = false;
  2. $scope.graphData = false;
  3. $scope.graphSelectorIndex = 0;
  4.  
  5. $scope.graphSelector = [
  6. { 'byPeriod' : 'Periode'},
  7. { 'byHour' : 'Uur' },
  8. { 'byDay' : 'Dag'}
  9. ];
  10.  
  11. $scope.graphSelectorByText = function (text) {
  12. switch (text) {
  13. case ('byPeriod'):
  14. $scope.selector = 'byPeriod'
  15. $scope.graphData = $scope.allGraphData.byPeriod;
  16. $scope.graphType = 'Line';
  17. break;
  18. case ('byDay'):
  19. $scope.selector = 'byDay'
  20. $scope.graphData = $scope.allGraphData.byDay;
  21. $scope.graphType = 'Line';
  22. break;
  23. case ('byHour'):
  24. $scope.selector = 'byHour'
  25. $scope.graphData = $scope.allGraphData.byHour;
  26. $scope.graphType = 'Bar';
  27. break;
  28. }
  29. }
  30.  
  31. $scope.graphSelectorByInt = function (int) {
  32. switch (int) {
  33. case (0):
  34. $scope.selector = 'byPeriod';
  35. $scope.graphData = $scope.allGraphData.byPeriod;
  36. $scope.graphType = 'Line';
  37. break;
  38. case (1):
  39. $scope.selector = 'byDay';
  40. $scope.graphData = $scope.allGraphData.byDay;
  41. $scope.graphType = 'Line';
  42. break;
  43. case (2):
  44. $scope.selector = 'byHour';
  45. $scope.graphData = $scope.allGraphData.byHour;
  46. $scope.graphType = 'Bar'
  47. break;
  48. }
  49. }
  50.  
  51. $scope.graphSelectorPrev = function () {
  52. $scope.graphSelectorIndex--;
  53. if ($scope.graphSelectorIndex < 0) {
  54. $scope.graphSelectorIndex = $scope.graphSelector.length-1;
  55. }
  56. $scope.graphSelectorByInt($scope.graphSelectorIndex);
  57. console.log($scope.graphSelectorIndex);
  58.  
  59. }
  60.  
  61. $scope.graphSelectorNext = function () {
  62. $scope.graphSelectorIndex++;
  63. if ($scope.graphSelectorIndex >= $scope.graphSelector.length) {
  64. $scope.graphSelectorIndex = 0;
  65. }
  66. $scope.graphSelectorByInt($scope.graphSelectorIndex);
  67. console.log($scope.graphSelectorIndex);
  68. }
  69.  
  70. <div class="controlls">
  71. <span class="btn_arrow previous inactive" ng-click="graphSelectorPrev()">Vorige</span>
  72. <p>{+ selector +}</p>
  73. <span class="btn_arrow next" ng-click="graphSelectorNext()">Volgende</span>
  74. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement