<commit_before>angular.module('DashboardGraphs')
  .directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'adjustGraphSize', 'jobStatusGraphData',
        function ($rootScope, $compile , $location, $window, Wait, adjustGraphSize, jobStatusGraphData) {
            return {
              restrict: 'E',
              templateUrl: '/static/partials/job_status_graph.html',
              link: link
            };

          function link(scope, element, attr) {
            var html;
            var url;
            var job_status_chart;
            var cleanup = angular.noop;

            scope.period="month";
            scope.jobType="all";

            var data;
            scope.$watch(attr.data, function(value) {
              if (value) {
                createGraph(value, scope.period, scope.jobType);
              }
            });

            function createGraph(data, period, jobtype){

              scope.period = period;
              scope.jobType = jobtype;

                var timeFormat, graphData = [
                  {
                  "color": "#00aa00",
                  "key": "Successful",
                  "values": data.jobs.successful
                },
                {
                  "key" : "Failed" ,
                  "color" : "#aa0000",
                  "values": data.jobs.failed
                }
                ];

                if(period==="day") {
                  timeFormat="%H:%M";
                }
                else {
                  timeFormat = '%m/%d';
                }
                graphData.map(function(series) {
                  series.values = series.values.map(function(d) {
                    return {
                      x: d[0],
                      y: d[1]
                    };
                  });
                  return series;
                });

                job_status_chart = nv.models.lineChart()
                .margin({top: 5, right: 75, bottom: 40, left: 85})  //Adjust chart margins to give the x-axis some breathing room.
                .x(function(d,i) { return i; })
                .useInteractiveGuideline(true)  //We want nice looking tooltips and a guideline!
                .showLegend(true)       //Show the legend, allowing users to turn on/off line series.
                .showYAxis(true)        //Show the y-axis
                .showXAxis(true);       //Show the x-axis


                var width = $('.graph-container').width(); // nv.utils.windowSize().width/3,
                var height = $('.graph-container').height()*0.7; //nv.utils.windowSize().height/5,

                job_status_chart.xAxis
                .axisLabel("Time")//.showMaxMin(true)
                .tickFormat(function(d) {
                  var dx = graphData[0].values[d] && graphData[0].values[d].x || 0;
                  return dx ? d3.time.format(timeFormat)(new Date(Number(dx+'000'))) : '';
                });
<commit_msg>Generate chart model from the start<commit_after>angular.module('DashboardGraphs')
  .directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'adjustGraphSize', 'jobStatusGraphData',
        function ($rootScope, $compile , $location, $window, Wait, adjustGraphSize, jobStatusGraphData) {
            return {
              restrict: 'E',
              templateUrl: '/static/partials/job_status_graph.html',
              link: link
            };

          function link(scope, element, attr) {
            var html;
            var url;
            var job_status_chart = nv.models.lineChart();
            var cleanup = angular.noop;

            scope.period="month";
            scope.jobType="all";

            var data;
            scope.$watch(attr.data, function(value) {
              if (value) {
                createGraph(value, scope.period, scope.jobType);
              }
            });

            function createGraph(data, period, jobtype){

              scope.period = period;
              scope.jobType = jobtype;

                var timeFormat, graphData = [
                  {
                  "color": "#00aa00",
                  "key": "Successful",
                  "values": data.jobs.successful
                },
                {
                  "key" : "Failed" ,
                  "color" : "#aa0000",
                  "values": data.jobs.failed
                }
                ];

                if(period==="day") {
                  timeFormat="%H:%M";
                }
                else {
                  timeFormat = '%m/%d';
                }
                graphData.map(function(series) {
                  series.values = series.values.map(function(d) {
                    return {
                      x: d[0],
                      y: d[1]
                    };
                  });
                  return series;
                });

                job_status_chart
                  .margin({top: 5, right: 75, bottom: 40, left: 85})  //Adjust chart margins to give the x-axis some breathing room.
                  .x(function(d,i) { return i; })
                  .useInteractiveGuideline(true)  //We want nice looking tooltips and a guideline!
                  .showLegend(true)       //Show the legend, allowing users to turn on/off line series.
                  .showYAxis(true)        //Show the y-axis
                  .showXAxis(true);       //Show the x-axis


                var width = $('.graph-container').width(); // nv.utils.windowSize().width/3,
                var height = $('.graph-container').height()*0.7; //nv.utils.windowSize().height/5,

                job_status_chart.xAxis
                .axisLabel("Time")//.showMaxMin(true)
                .tickFormat(function(d) {
                  var dx = graphData[0].values[d] && graphData[0].values[d].x || 0;
                  return dx ? d3.time.format(timeFormat)(new Date(Number(dx+'000'))) : '';
                });

{'fraction_non_alphanumeric': 0.12684069611780455, 'fraction_numerical': 0.009370816599732263, 'mean_word_length': 1.2588813303099018, 'pattern_counts': {'":': 8, '<': 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': '6073204', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1498, 'n_words': 319}