<commit_before>(function (app, ng) {
  'use strict';

  app.directive('chart', [function() {
    return {
      restrict: 'E',
      scope: {
        options: "=",
        change: '=',
        data: "="
      },
      replace: true,
      template: '<div style="width:100%;height:500px;"></div>',
      link: function(scope, element) {
        // first generate id for chart
        var guid = function guid() {
          function s4() {
            return Math.floor((1 + Math.random()) * 0x10000)
                .toString(16)
                .substring(1);
          }

          return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
              s4() + '-' + s4() + s4() + s4();
        };
        var id = guid();
        element.attr('id', id);

        // now fill options
        var newChartOptions = {
          "dataProvider": scope.data,
          "type": "serial",
          "theme": "light",
          "marginRight": 40,
          "autoMarginOffset": 20,
          "marginTop": 7,
          "creditsPosition": "top-left",
          "valueAxes": [{
              "axisAlpha": 0.2,
              "dashLength": 1,
              "position": "left"
          }],
          "graphs": [{
              "id": "g1",
              "balloonText": "<div style='margin:3px; font-size:11px;'>[[value]]&#176;C</div>",
              "valueField": "value",
              "lineThickness": 2
          }],
          "chartCursor": {
            "limitToGraph":"g1",
            "categoryBalloonDateFormat": "JJ:NN:SS, DD MMMM",
            "cursorPosition": "mouse"
          },
          "categoryField": "date",
          "categoryAxis": {
              "minPeriod": "ss",
              "parseDates": true,
              "axisColor": "#DADADA",
              "dashLength": 1,
              "minorGridEnabled": true
          }
        };
        if (scope.options.type === "state"){
          newChartOptions.graphs[0].type = "step";
          newChartOptions.graphs[0].balloonText = "<div style='margin:3px; font-size:11px;'>[[value]]</div>";
          newChartOptions.valueAxes[0].integersOnly = true;
        }

        // create chart
        var chart = AmCharts.makeChart(id, newChartOptions);

        // watch on change indicator which will be changed when
        // data is changed
        scope.$watch('change', function (nv, ov) {
          if (nv !== ov) {
            chart.dataProvider = scope.data;
            chart.validateData();
          }
        });
      }
    };<commit_msg>chart scrollbar added<commit_after>(function (app, ng) {
  'use strict';

  app.directive('chart', [function() {
    return {
      restrict: 'E',
      scope: {
        options: "=",
        change: '=',
        data: "="
      },
      replace: true,
      template: '<div style="width:100%;height:500px;"></div>',
      link: function(scope, element) {
        // first generate id for chart
        var guid = function guid() {
          function s4() {
            return Math.floor((1 + Math.random()) * 0x10000)
                .toString(16)
                .substring(1);
          }

          return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
              s4() + '-' + s4() + s4() + s4();
        };
        var id = guid();
        element.attr('id', id);

        // now fill options
        var newChartOptions = {
          "dataProvider": scope.data,
          "type": "serial",
          "theme": "light",
          "marginRight": 40,
          "autoMarginOffset": 20,
          "marginTop": 7,
          "creditsPosition": "top-left",
          "valueAxes": [{
              "axisAlpha": 0.2,
              "dashLength": 1,
              "position": "left"
          }],
          "graphs": [{
              "id": "g1",
              "balloonText": "<div style='margin:3px; font-size:11px;'>[[value]]&#176;C</div>",
              "valueField": "value",
              "lineThickness": 2
          }],
          "chartCursor": {
            "limitToGraph":"g1",
            "categoryBalloonDateFormat": "JJ:NN:SS, DD MMMM",
            "cursorPosition": "mouse"
          },
          "categoryField": "date",
          "categoryAxis": {
              "minPeriod": "ss",
              "parseDates": true,
              "axisColor": "#DADADA",
              "dashLength": 1,
              "minorGridEnabled": true
          },
          "chartScrollbar": {
            "graph":"g1",
            "gridAlpha":0,
            "color":"#888888",
            "scrollbarHeight":30,
            "backgroundAlpha":0,
            "selectedBackgroundAlpha":0.1,
            "selectedBackgroundColor":"#888888",
            "graphFillAlpha":0,
            "autoGridCount":true,
            "selectedGraphFillAlpha":0,
            "graphLineAlpha":0.2,
            "graphLineColor":"#c2c2c2",
            "selectedGraphLineColor":"#888888",
            "selectedGraphLineAlpha":1

          }
        };
        if (scope.options.type === "state"){
          newChartOptions.graphs[0].type = "step";
          newChartOptions.graphs[0].balloonText = "<div style='margin:3px; font-size:11px;'>[[value]]</div>";
          newChartOptions.valueAxes[0].integersOnly = true;
        }

        // create chart
        var chart = AmCharts.makeChart(id, newChartOptions);

        chart.addListener("zoomed", function(event) {
          console.log(event.startDate + "->" + event.endDate);
        });

        // watch on change indicator which will be changed when
        // data is changed
        scope.$watch('change', function (nv, ov) {
          if (nv !== ov) {
            chart.dataProvider = scope.data;
            chart.validateData();
          }
        });
      }
    };
{'fraction_non_alphanumeric': 0.16326530612244897, 'fraction_numerical': 0.023047149894440535, 'mean_word_length': 1.5493273542600896, 'pattern_counts': {'":': 69, '<': 15, '<?xml version=': 0, '>': 16, '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': '6601765', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1640, 'n_words': 321}