<commit_before>angular.module('DashboardGraphs').
  factory('adjustGraphSize', function() {
      return function adjustGraphSize(chartModel, element) {
        var parentHeight = element.parent().parent().height();
        var toolbarHeight = element.find('.toolbar').height();
        var container = element.find('svg').parent();
        var margins = chartModel.margin();

        var newHeight = parentHeight - toolbarHeight - margins.bottom;

        $(container).height(newHeight);

        var graph = d3.select(element.find('svg')[0]);
        var width = parseInt(graph.style('width')) - margins.left - margins.right;
        var height = parseInt(graph.style('height')) - margins.top - margins.bottom;


        chartModel.xRange([0, width]);
        chartModel.yRange([height, 0]);

        chartModel.xAxis.ticks(Math.max(width / 75, 2));
        chartModel.yAxis.ticks(Math.max(height / 50, 2));

        if (height < 160) {
          graph.select('.y.axis').select('.domain').style('display', 'none');
          graph.select('.y.axis').select('.domain').style('display', 'initial');
        }

        graph.select('.x.axis')
          .attr('transform', 'translate(0, ' + height + ')')
          .call(chartModel.xAxis);

        graph.selectAll('.line')
              .attr('d', chartModel.lines)

        chartModel.update();
      }
});<commit_msg>Correctly select axes on graphs<commit_after>angular.module('DashboardGraphs').
  factory('adjustGraphSize', function() {
      return function adjustGraphSize(chartModel, element) {
        var parentHeight = element.parent().parent().height();
        var toolbarHeight = element.find('.toolbar').height();
        var container = element.find('svg').parent();
        var margins = chartModel.margin();

        var newHeight = parentHeight - toolbarHeight - margins.bottom;

        $(container).height(newHeight);

        var graph = d3.select(element.find('svg')[0]);
        var width = parseInt(graph.style('width')) - margins.left - margins.right;
        var height = parseInt(graph.style('height')) - margins.top - margins.bottom;


        chartModel.xRange([0, width]);
        chartModel.yRange([height, 0]);

        chartModel.xAxis.ticks(Math.max(width / 75, 2));
        chartModel.yAxis.ticks(Math.max(height / 50, 2));

        if (height < 160) {
          graph.select('.y.nv-axis').select('.domain').style('display', 'none');
          graph.select('.y.nv-axis').select('.domain').style('display', 'initial');
        }

        graph.select('.x.nv-axis')
          .attr('transform', 'translate(0, ' + height + ')')
          .call(chartModel.xAxis);

        graph.selectAll('.line')
              .attr('d', chartModel.lines)

        chartModel.update();
      }
});
{'fraction_non_alphanumeric': 0.17348786671495836, 'fraction_numerical': 0.010141253169141615, 'mean_word_length': 2.672872340425532, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4930742', 'n_tokens_mistral': 818, 'n_tokens_neox': 765, 'n_words': 132}