<commit_before>function HorizontalBarChart (element) {

  BaseChart.call(this, element);

};


Util.extendChart(HorizontalBarChart, BaseChart);


HorizontalBarChart.prototype.beforeRender = function () {

  var self = this;

  this.labels = this.data.map(function(d) {return d.key;});
  this.layers = d3.layout.stack()(d3.range(this.categories.length).map(function(d) {
    var a = [];
    for (var i = 0; i < self.data.length; ++i) {
      a[i] = {x: i, y: self.data[i][self.categories[d]], layer:d+1};
    }
    return a;
  }));

  this.yGroupMax = d3.max(this.layers, function(layer) { return d3.max(layer, function(d) { return d.y; }); });
  this.yStackMax = d3.max(this.layers, function(layer) { return d3.max(layer, function(d) { return d.y0 + d.y; }); });

  this.width  = this.size.width - this.margins.left - this.margins.right;
  this.height = this.size.height - this.margins.top - this.margins.bottom;

  this.x = d3.scale.linear().domain([0, this.yStackMax]).range([0, this.width]);
  this.y = d3.scale.ordinal().domain(d3.range(this.data.length)).rangeRoundBands([2, this.height], .3);

  this.color = d3.scale.ordinal().domain(this.categories).range(this._range)

  this.chart = d3.select(this.element).append("svg")
      .attr("width", this.width + this.margins.left + this.margins.right)
      .attr("height", this.height + this.margins.top + this.margins.bottom)

  this.chart.append("g")
      .attr("transform", "translate(" + this.margins.left + "," + this.margins.top + ")");<commit_msg>Fix margins in horizontal bar<commit_after>function HorizontalBarChart (element) {

  BaseChart.call(this, element);

};


Util.extendChart(HorizontalBarChart, BaseChart);


HorizontalBarChart.prototype.beforeRender = function () {

  var self = this;

  this.labels = this.data.map(function(d) {return d.key;});
  this.layers = d3.layout.stack()(d3.range(this.categories.length).map(function(d) {
    var a = [];
    for (var i = 0; i < self.data.length; ++i) {
      a[i] = {x: i, y: self.data[i][self.categories[d]], layer:d+1};
    }
    return a;
  }));

  this.yGroupMax = d3.max(this.layers, function(layer) { return d3.max(layer, function(d) { return d.y; }); });
  this.yStackMax = d3.max(this.layers, function(layer) { return d3.max(layer, function(d) { return d.y0 + d.y; }); });

  this.width  = this.size.width - this.margins.left - this.margins.right;
  this.height = this.size.height - this.margins.top - this.margins.bottom;

  this.x = d3.scale.linear().domain([0, this.yStackMax]).range([0, this.width]);
  this.y = d3.scale.ordinal().domain(d3.range(this.data.length)).rangeRoundBands([2, this.height], .3);

  this.color = d3.scale.ordinal().domain(this.categories).range(this._range)

  this.chart = d3.select(this.element).append("svg")
      .attr("width", this.width + this.margins.left )
      .attr("height", this.height + this.margins.top + this.margins.bottom)

  this.chart.append("g")
      .attr("transform", "translate(" + this.margins.left + "," + this.margins.top + ")");
{'fraction_non_alphanumeric': 0.19343065693430658, 'fraction_numerical': 0.011944260119442602, 'mean_word_length': 3.847266881028939, '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': '1335085', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1094, 'n_words': 173}