<commit_before>/* global Plotly */
'use strict';

angular.module('metadatamanagementApp').directive('diagram',
  function($window, $timeout) {
    return {
      restrict: 'E',
      templateUrl: 'scripts/variablemanagement/directives/diagram.html.tmpl',
      scope: {
        statistics: '=',
        language: '=',
        type: '='
      },
      controller: ['$scope',
        function($scope) {
          var data = [{
            marker: {
              color: 'rgb(49,130,189)',
              opacity: 0.7
            }}];
          if (($scope.type === 'nominal') || ($scope.type === 'ordinal')) {
            data[0].x = [];
            data[0].y = [];
            data[0].type = 'bar';
            if ($scope.statistics.validResponses) {
              $scope.statistics.validResponses.forEach(function(obj) {
                data[0].x.push('-' + obj.label[$scope.language] + '-');
                data[0].y.push(obj.absoluteFrequency);
              });
            }
          }
          if (($scope.type === 'kontinuierlich') ||
          ($scope.type === 'continous')) {
            data[0].x = [];
            data[0].type = 'histogram';
          }
          var drawDiagram = function() {
            Plotly.newPlot('diagram', data);
          };
          angular.element($window).bind('resize', function() {
            $timeout(function() {
              $scope.$apply();
              drawDiagram();
            }, 1000);
          });
          drawDiagram();
        }]
    };
  });<commit_msg>#616 added timout for plotly<commit_after>/* global Plotly */
'use strict';

angular.module('metadatamanagementApp').directive('diagram',
  function($window, $timeout) {
    return {
      restrict: 'E',
      templateUrl: 'scripts/variablemanagement/directives/diagram.html.tmpl',
      scope: {
        statistics: '=',
        language: '=',
        type: '='
      },
      controller: ['$scope',
        function($scope) {
          var data = [{
            marker: {
              color: 'rgb(49,130,189)',
              opacity: 0.7
            }}];
          if (($scope.type === 'nominal') || ($scope.type === 'ordinal')) {
            data[0].x = [];
            data[0].y = [];
            data[0].type = 'bar';
            if ($scope.statistics.validResponses) {
              $scope.statistics.validResponses.forEach(function(obj) {
                data[0].x.push('-' + obj.label[$scope.language] + '-');
                data[0].y.push(obj.absoluteFrequency);
              });
            }
          }
          if (($scope.type === 'kontinuierlich') ||
          ($scope.type === 'continous')) {
            data[0].x = [];
            data[0].type = 'histogram';
          }
          var drawDiagram = function() {
            $timeout(function() {
              Plotly.newPlot('diagram', data);
            }, 1000);
          };
          angular.element($window).bind('resize', function() {
            drawDiagram();
          });
          drawDiagram();
        }]
    };
  });
{'fraction_non_alphanumeric': 0.178476821192053, 'fraction_numerical': 0.014900662251655629, 'mean_word_length': 1.5450716090985679, 'pattern_counts': {'":': 0, '<': 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': '420878', 'n_tokens_mistral': 899, 'n_tokens_neox': 868, 'n_words': 127}