<commit_before>(function() {
  'use strict';

  angular
  .module('myApp')
  .directive('chartsDisplay', chartsDisplay);

  function chartsDisplay() {
    var directive = {
      restrict: 'EA',
      templateUrl: 'views/directiveTemplates/chart.html',
      scope: {},
      link: linkFunc,
      controller: chartDirectiveController,
      controllerAs: 'vm',
      bindToController: true
    };

    return directive;

    function linkFunc(scope, element, attribute, controller) {
      var elementResult = element[0].getElementsByClassName('container');
      controller.init(elementResult, attribute.mectricid, attribute.original, attribute.drilldownto, attribute.drilldownidindex, attribute.drilldownvalueindex);
    }
  }

  chartDirectiveController.$inject = ['$scope','highChartDataService', '$q'];

  function chartDirectiveController($scope, highChartDataService, $q) {
    var vm = this;
    vm.dataMTD = [];
    vm.dataQTD = [];
    vm.dataYTD = [];

    vm.init =  function(elementResult, mectricId, originalGraph, drillDownGraph, drillDownIdIndex, drillDownValueIndex) {
      vm.elementResult = elementResult;
      vm.mectricId = mectricId;
      vm.originalGraph = originalGraph;
      vm.drillDownGraph = drillDownGraph;
      vm.drillDownIdIndex = drillDownIdIndex;
      vm.drillDownValueIndex = drillDownValueIndex;
      var urlMTD = 'js/json/'+vm.mectricId+'/timePeriod_MTD'+'.json';
      var urlQTD = 'js/json/'+vm.mectricId+'/timePeriod_QTD'+'.json';
      var urlYTD = 'js/json/'+vm.mectricId+'/timePeriod_YTD'+'.json';

      fetchData(urlMTD, urlQTD, urlYTD);
    }

    var fetchData = function(urlMTD, urlQTD, urlYTD){
      var data1 = highChartDataService.getData(urlMTD),
      data2 = highChartDataService.getData(urlQTD),
      data3 = highChartDataService.getData(urlYTD);
      $q.all([data1, data2,data3]).then(function(arrayOfResults) {
        vm.dataMTD = arrayOfResults[0];
        vm.dataQTD = arrayOfResults[1];
        vm.dataYTD = arrayOfResults[2];
        displayGraph(vm.elementResult, vm.dataMTD, vm.dataQTD, vm.dataYTD, vm.originalGraph, vm.drillDownGraph, vm.drillDownIdIndex, vm.drillDownValueIndex);
      });
    }

    var displayGraph =  function(elementResult, dataMTD, dataQTD, dataYTD, originalGraph, drillDownGraph, drillDownIdIndex, drillDownValueIndex) {
      $(elementResult).highcharts({
        chart: {
          type: drillDownGraph,
          zoomType: 'x',
          panning: true,
          panKey: 'shift'
          // options3d: {
          //   enabled: true,
          //   alpha: 45,
          //   beta: 20
          // }
        },

        exporting: {
          enabled: true
        },

        credits: {
          text: 'ADP',
          href: 'http://www.adp.com'
        },

        title: {
          text: dataMTD.metricName
        },

        xAxis: {
          title: {
            enabled: true,
            style: {
              fontWeight: 'normal'
            }
          },
          type: 'category'
        },

        tooltip: {
          shared: true,
          useHTML: true,
          headerFormat: '<small>{series.name}</small><table>',
          pointFormat: '<tr><td style="color: {point.color}">{point.name}: </td> <td style="text-align: right"><b>{point.y}</b></td></tr>',
          footerFormat: '</table>',
          valueDecimals: 2
        },

        yAxis: {
          title: {
            enabled: true,
            text: dataMTD.yaxisTitle,
            style: {
              fontWeight: 'normal'
            }
          }
        },

        plotOptions: {
          series: {
            animation: {
              duration: 2000,
              easing: 'easeOutBounce',
              shadow: true
            },
            cursor: 'pointer'
            // point: {
            //   events: {
            //     click: function () {
            //       drillUp();
            //     }
            //   }
            // }
          },
          pie: {
            showInLegend: true,
            allowPointSelect: true,
            slicedOffset: 20,
            cursor: 'pointer',
            sliced: true,
            innerSize: 100,
            depth: 45
          }<commit_msg>improving security and removing commented code<commit_after>(function() {
  'use strict';

  angular
  .module('myApp')
  .directive('chartsDisplay', chartsDisplay);

  function chartsDisplay() {
    var directive = {
      restrict: 'EA',
      templateUrl: 'views/directiveTemplates/chart.html',
      scope: {},
      link: linkFunc,
      controller: chartDirectiveController,
      controllerAs: 'vm',
      bindToController: true
    };

    return directive;

    function linkFunc(scope, element, attribute, controller) {
      var elementResult = element[0].getElementsByClassName('container');
      controller.init(elementResult, attribute.mectricid, attribute.original, attribute.drilldownto, attribute.drilldownidindex, attribute.drilldownvalueindex);
    }
  }

  chartDirectiveController.$inject = ['$scope','highChartDataService', '$q'];

  function chartDirectiveController($scope, highChartDataService, $q) {
    var vm = this;

    vm.init =  function(elementResult, mectricId, originalGraph, drillDownGraph, drillDownIdIndex, drillDownValueIndex) {
      vm.elementResult = elementResult;
      vm.mectricId = mectricId;
      vm.originalGraph = originalGraph;
      vm.drillDownGraph = drillDownGraph;
      vm.drillDownIdIndex = drillDownIdIndex;
      vm.drillDownValueIndex = drillDownValueIndex;
      var urlMTD = 'js/json/'+vm.mectricId+'/timePeriod_MTD'+'.json';
      var urlQTD = 'js/json/'+vm.mectricId+'/timePeriod_QTD'+'.json';
      var urlYTD = 'js/json/'+vm.mectricId+'/timePeriod_YTD'+'.json';

      fetchData(urlMTD, urlQTD, urlYTD);
    }

    var fetchData = function(urlMTD, urlQTD, urlYTD){
      var data1 = highChartDataService.getData(urlMTD),
      data2 = highChartDataService.getData(urlQTD),
      data3 = highChartDataService.getData(urlYTD);
      $q.all([data1, data2,data3]).then(function(arrayOfResults) {
        var dataMTD = arrayOfResults[0];
        var dataQTD = arrayOfResults[1];
        var dataYTD = arrayOfResults[2];
        displayGraph(vm.elementResult, dataMTD, dataQTD, dataYTD, vm.originalGraph, vm.drillDownGraph, vm.drillDownIdIndex, vm.drillDownValueIndex);
      });
    }

    var displayGraph =  function(elementResult, dataMTD, dataQTD, dataYTD, originalGraph, drillDownGraph, drillDownIdIndex, drillDownValueIndex) {
      $(elementResult).highcharts({
        chart: {
          type: drillDownGraph,
          zoomType: 'x',
          panning: true,
          panKey: 'shift'
          // options3d: {
          //   enabled: true,
          //   alpha: 45,
          //   beta: 20
          // }
        },

        exporting: {
          enabled: true
        },

        credits: {
          text: 'ADP',
          href: 'http://www.adp.com'
        },

        title: {
          text: dataMTD.metricName
        },

        xAxis: {
          title: {
            enabled: true,
            style: {
              fontWeight: 'normal'
            }
          },
          type: 'category'
        },

        tooltip: {
          shared: true,
          useHTML: true,
          headerFormat: '<small>{series.name}</small><table>',
          pointFormat: '<tr><td style="color: {point.color}">{point.name}: </td> <td style="text-align: right"><b>{point.y}</b></td></tr>',
          footerFormat: '</table>',
          valueDecimals: 2
        },

        yAxis: {
          title: {
            enabled: true,
            text: dataMTD.yaxisTitle,
            style: {
              fontWeight: 'normal'
            }
          }
        },

        plotOptions: {
          series: {
            animation: {
              duration: 2000,
              easing: 'easeOutBounce',
              shadow: true
            },
            cursor: 'pointer'
          },
          pie: {
            showInLegend: true,
            allowPointSelect: true,
            slicedOffset: 20,
            cursor: 'pointer',
            sliced: true,
            innerSize: 100,
            depth: 45
          }
{'fraction_non_alphanumeric': 0.1237781036168133, 'fraction_numerical': 0.006598240469208211, 'mean_word_length': 1.9591467823571944, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6596813', 'n_tokens_mistral': 2508, 'n_tokens_neox': 2423, 'n_words': 436}