Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.widgetData = false;
- $scope.graphData = false;
- $scope.graphSelectorIndex = 0;
- $scope.graphSelector = [
- { 'byPeriod' : 'Periode'},
- { 'byHour' : 'Uur' },
- { 'byDay' : 'Dag'}
- ];
- $scope.graphSelectorByText = function (text) {
- switch (text) {
- case ('byPeriod'):
- $scope.selector = 'byPeriod'
- $scope.graphData = $scope.allGraphData.byPeriod;
- $scope.graphType = 'Line';
- break;
- case ('byDay'):
- $scope.selector = 'byDay'
- $scope.graphData = $scope.allGraphData.byDay;
- $scope.graphType = 'Line';
- break;
- case ('byHour'):
- $scope.selector = 'byHour'
- $scope.graphData = $scope.allGraphData.byHour;
- $scope.graphType = 'Bar';
- break;
- }
- }
- $scope.graphSelectorByInt = function (int) {
- switch (int) {
- case (0):
- $scope.selector = 'byPeriod';
- $scope.graphData = $scope.allGraphData.byPeriod;
- $scope.graphType = 'Line';
- break;
- case (1):
- $scope.selector = 'byDay';
- $scope.graphData = $scope.allGraphData.byDay;
- $scope.graphType = 'Line';
- break;
- case (2):
- $scope.selector = 'byHour';
- $scope.graphData = $scope.allGraphData.byHour;
- $scope.graphType = 'Bar'
- break;
- }
- }
- $scope.graphSelectorPrev = function () {
- $scope.graphSelectorIndex--;
- if ($scope.graphSelectorIndex < 0) {
- $scope.graphSelectorIndex = $scope.graphSelector.length-1;
- }
- $scope.graphSelectorByInt($scope.graphSelectorIndex);
- console.log($scope.graphSelectorIndex);
- }
- $scope.graphSelectorNext = function () {
- $scope.graphSelectorIndex++;
- if ($scope.graphSelectorIndex >= $scope.graphSelector.length) {
- $scope.graphSelectorIndex = 0;
- }
- $scope.graphSelectorByInt($scope.graphSelectorIndex);
- console.log($scope.graphSelectorIndex);
- }
- <div class="controlls">
- <span class="btn_arrow previous inactive" ng-click="graphSelectorPrev()">Vorige</span>
- <p>{+ selector +}</p>
- <span class="btn_arrow next" ng-click="graphSelectorNext()">Volgende</span>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement