<commit_before>'use strict';

/* Controllers */

angular.module('quixrWebview.controllers', []).
  controller('WrapperCtrl1', function($scope, $location, $routeParams) {
        $scope.isActive = function (viewLocation) {
            return $location.path().indexOf(viewLocation) != -1;
        };
        $scope.searchDisabled = function() {
            return !(typeof($routeParams.vhost) === 'undefined');
        }
    })
  .controller('TrafficCtrl1', function($scope, $http) {
        $http.get('data/quixr.json').success(function(data) {
            $scope.vhosts = data;
        });
  })
  .controller('MonthviewCtrl1', function($scope, $routeParams, $http, $filter) {
        $scope.vhost = $routeParams.vhost;
        $scope.month = $routeParams.month;
        $scope.year = $routeParams.year;
        $scope.display = $routeParams.display;

        $http.get('data/quixr.json').success(function(data) {
            $scope.data = data[$routeParams.vhost][$routeParams.display][$routeParams.year][$routeParams.month];

            var chartObject = {
                type: 'LineChart'
            };

            chartObject.options = {
                legend: {
                    position: 'none'
                }
            }

            chartObject.data = {"cols": [
                {id: "m", label: "Month", type: "string"},
                {id: "b", label: "Traffic", type: "number"}
            ], "rows": {}
            };

            $scope.chartObject = function(unit) {
                chartObject.data.rows = getFormattedData($scope.data, unit);
                return chartObject;
            };
        });

        function getFormattedData(tmpData, unit) {
            var data = [];
            angular.forEach(tmpData, function (value, key) {
                data.push({c:[
                    {v: key},
                    {v: $filter('formatBytes')(value, unit).toFixed(2)}
                ]});
            });
            return data;
        }

  })
  .controller('DiskspaceCtrl1', function($scope, $http) {
        $http.get('data/quixr.json').success(function(data) {
            $scope.vhosts = data;
        });
  });<commit_msg>[TASK] Add units to y-axis - closes #20<commit_after>'use strict';

/* Controllers */

angular.module('quixrWebview.controllers', []).
  controller('WrapperCtrl1', function($scope, $location, $routeParams) {
        $scope.isActive = function (viewLocation) {
            return $location.path().indexOf(viewLocation) != -1;
        };
        $scope.searchDisabled = function() {
            return !(typeof($routeParams.vhost) === 'undefined');
        }
    })
  .controller('TrafficCtrl1', function($scope, $http) {
        $http.get('data/quixr.json').success(function(data) {
            $scope.vhosts = data;
        });
  })
  .controller('MonthviewCtrl1', function($scope, $routeParams, $http, $filter) {
        $scope.vhost = $routeParams.vhost;
        $scope.month = $routeParams.month;
        $scope.year = $routeParams.year;
        $scope.display = $routeParams.display;

        $http.get('data/quixr.json').success(function(data) {
            $scope.data = data[$routeParams.vhost][$routeParams.display][$routeParams.year][$routeParams.month];

            var chartObject = {
                type: 'LineChart'
            };

            chartObject.options = {
                legend: {
                    position: 'none'
                }
            }

            chartObject.data = {"cols": [
                {id: "m", label: "Month", type: "string"},
                {id: "b", label: "Traffic", type: "number"}
            ], "rows": {}
            };

            $scope.chartObject = function(unit) {
                chartObject.options = {vAxis: {title: unit.toUpperCase()}};
                chartObject.data.rows = getFormattedData($scope.data, unit);
                return chartObject;
            };
        });

        function getFormattedData(tmpData, unit) {
            var data = [];
            angular.forEach(tmpData, function (value, key) {
                data.push({c:[
                    {v: key},
                    {v: $filter('formatBytes')(value, unit).toFixed(2)}
                ]});
            });
            return data;
        }

  })
  .controller('DiskspaceCtrl1', function($scope, $http) {
        $http.get('data/quixr.json').success(function(data) {
            $scope.vhosts = data;
        });
  });
{'fraction_non_alphanumeric': 0.15795403334835512, 'fraction_numerical': 0.0031545741324921135, 'mean_word_length': 1.8077166350411131, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3909152', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1248, 'n_words': 198}