<commit_before>'use strict';

angular.module('digApp.directives').directive('sparkline', function () {
    return {
        restrict: 'EA',
        scope: {             
            data: '=',
            graphType: '@'
        },
        link: function ($scope, elem) {
            
            /* 
            $scope.getHeight = function() {
                return elem.height();
            };
            $scope.$watch($scope.getHeight, function(newVal) {
                if(newVal > 0) {
                    elem.sparkline($scope.data, {type: 'line', width: 50, height: 50});   
                }  
            });
            */

            $scope.getArray = function(structure) {
                if(structure) {
                    return structure.map(function(o) { return o.count; });
                } else {
                    return [];
                }
            };

            elem.sparkline($scope.getArray($scope.data), {type: $scope.graphType, width: 50, height: 50});

            $scope.$watchCollection('data', function (newVal, oldVal) {
                if(newVal !== oldVal) {
                    elem.sparkline($scope.getArray($scope.data), {type: $scope.graphType, width: 50, height: 50});                  
                }
            });
        }
    };<commit_msg>Removing old code, adding todo comments.<commit_after>'use strict';

angular.module('digApp.directives').directive('sparkline', function () {
    return {
        restrict: 'EA',
        scope: {             
            data: '=',
            graphType: '@'
        },
        link: function ($scope, elem) {
            
            //TODO: sparkline labels?

            $scope.getArray = function(structure) {
                if(structure) {
                    return structure.map(function(o) { return o.count; });
                } else {
                    return [];
                }
            };

            elem.sparkline($scope.getArray($scope.data), {type: $scope.graphType, width: 50, height: 50});

            $scope.$watchCollection('data', function (newVal, oldVal) {
                if(newVal !== oldVal) {
                    elem.sparkline($scope.getArray($scope.data), {type: $scope.graphType, width: 50, height: 50});                  
                }
            });
        }
    };
{'fraction_non_alphanumeric': 0.14088159031979255, 'fraction_numerical': 0.009075194468452896, 'mean_word_length': 1.2989076464746772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '973677', 'n_tokens_mistral': 645, 'n_tokens_neox': 589, 'n_words': 109}