<commit_before>//BarChart extends Chart
GeoDash.BarChartHorizontal = ezoop.ExtendedClass(GeoDash.Chart, {
  className: 'BarChartHorizontal',
  defaults: {
    x: 'x'
    , y: 'y'
    , barColors: ['#f00']
    , opacity: 0.7
    , drawX: false
    , drawY: false
    , percent: false
    , money: false
    , title: false
    , roundRadius: 3
    , highlight: []
    , verticalX: false
    , invert: false
    , barHeight: 0
    , padding: 1
    , numberTicks: 10
    , yWidth: 0
    , round: true
    , format: false
  },
  initialize: function (el, options) {

  }
  , setWidth: function () {
    this.width = parseInt(d3.select(this.el).style('width'))
    this.width = this.width - this.margin.left - this.margin.right
  }
  , setHeight: function() {
    this.height = parseInt(d3.select(this.el).style('height'))
    this.height = this.height - this.margin.top - this.margin.bottom
    if (this.options.title) {
      this.height = this.height - 30
    }
  }
  , drawChart: function () {
    var self = this

    this.margin = {
      top: 10
      , right: 10
      , bottom: 10
      , left: 10
    }

    if(this.options.barHeight !== 0) {
      d3.select(this.el).style('height', 'auto')
    }

    this.setWidth()
    this.setHeight()

    this.formatPercent = d3.format(".2%")
    this.formatPercentAxisLabel = d3.format("p")
    this.formatMoney = d3.format("$")
    this.formatLarge = d3.format("s")
    this.formatComma = d3.format(",")

    this.x = d3.scale.linear()
      .range([0, this.width - this.margin.left - this.options.yWidth]).nice()

    this.y = d3.scale.ordinal()
      .rangeRoundBands([0, this.height], 0.05, 0)

    this.svg = d3.select(this.el).append("div")
      .attr("class", "geodash barchart-html horizontal")
      .style("width", this.width + "px")
      .style("margin-top", this.margin.top + "px")
      .style("margin-bottom", this.margin.bottom + "px")
      .style("margin-right", this.margin.right + "px")
      .style("margin-left", this.margin.left + "px")

    if(this.options.drawX) {
      this.xAxisElement = this.svg.append("div")
        .attr("class", "x axis")
    }

    if(this.options.drawY) {
      this.yAxisElement = this.svg.append("div")
        .attr("class", "y axis")
        .style("padding-bottom", this.options.padding + "px")
        .style("padding-top", this.options.padding + 15 + "px")
    }

    this.svg.append("div")
      .attr("class", "bars")
      .style("margin-left", this.options.yWidth + "px")
      .style("padding-bottom", this.options.padding + "px")
      .style("padding-top", this.options.padding + 15 + "px")

    d3.select(self.el).append('div').attr('class', 'hoverbox')

  },
  update: function (data) {
    var self = this
    this.data = data

    var y = this.options.y
    var x = this.options.x

    for(var i = 0; i < data.length; i++){
      var d = data[i]
      if(d[x] != null){
        if(typeof d[x] === 'string') {
          d[x] = +d[x].replace(",", "")
        }
      }
    }

    this.color = d3.scale.ordinal()
      .range(this.options.barColors)

    var extent = d3.extent(data, function(d) { return d[x] })
    if(extent[0] < 0){
      this.x.domain(extent)
    } else {
      this.x.domain([0, extent[1]])
    }
    
    this.y.domain(data.map(function(d) { return d[y] }))

    var bars = this.svg.select(".bars")<commit_msg>clean<commit_after>//BarChart extends Chart
GeoDash.BarChartHorizontal = ezoop.ExtendedClass(GeoDash.Chart, {
  className: 'BarChartHorizontal',
  defaults: {
    x: 'x'
    , y: 'y'
    , barColors: ['#f00']
    , opacity: 0.7
    , drawX: false
    , drawY: false
    , percent: false
    , money: false
    , title: false
    , roundRadius: 3
    , highlight: []
    , verticalX: false
    , invert: false
    , barHeight: 0
    , padding: 1
    , numberTicks: 10
    , yWidth: 0
    , round: true
    , format: false
  },
  initialize: function (el, options) {

  }
  , setWidth: function () {
    this.width = parseInt(d3.select(this.el).style('width'))
    this.width = this.width - this.margin.left - this.margin.right
  }
  , setHeight: function() {
    this.height = parseInt(d3.select(this.el).style('height'))
    this.height = this.height - this.margin.top - this.margin.bottom
    if (this.options.title) {
      this.height = this.height - 30
    }
  }
  , drawChart: function () {
    var self = this

    this.margin = {
      top: 10
      , right: 10
      , bottom: 10
      , left: 10
    }

    if(this.options.barHeight !== 0) {
      d3.select(this.el).style('height', 'auto')
    }

    this.setWidth()
    this.setHeight()

    this.formatPercent = d3.format(".2%")
    this.formatPercentAxisLabel = d3.format("p")
    this.formatMoney = d3.format("$")
    this.formatLarge = d3.format("s")
    this.formatComma = d3.format(",")

    this.x = d3.scale.linear()
      .range([0, this.width - this.margin.left - this.options.yWidth]).nice()

    this.y = d3.scale.ordinal()
      .rangeRoundBands([0, this.height], 0.05, 0)

    this.svg = d3.select(this.el).append("div")
      .attr("class", "geodash barchart-html horizontal")
      .style("width", this.width + "px")
      .style("margin-top", this.margin.top + "px")
      .style("margin-bottom", this.margin.bottom + "px")
      .style("margin-right", this.margin.right + "px")
      .style("margin-left", this.margin.left + "px")

    if(this.options.drawX) {
      this.xAxisElement = this.svg.append("div")
        .attr("class", "x axis")
    }

    if(this.options.drawY) {
      this.yAxisElement = this.svg.append("div")
        .attr("class", "y axis")
        .style("padding-bottom", this.options.padding + "px")
        .style("padding-top", this.options.padding + 15 + "px")
    }

    this.svg.append("div")
      .attr("class", "bars")
      .style("margin-left", this.options.yWidth + "px")
      .style("padding-bottom", this.options.padding + "px")
      .style("padding-top", this.options.padding + 15 + "px")

    d3.select(self.el).append('div').attr('class', 'hoverbox')

  }
  , update: function (data) {
    var self = this
    this.data = data

    var y = this.options.y
    var x = this.options.x

    for(var i = 0; i < data.length; i++){
      var d = data[i]
      if(d[x] != null){
        if(typeof d[x] === 'string') {
          d[x] = +d[x].replace(",", "")
        }
      }
    }

    this.color = d3.scale.ordinal()
      .range(this.options.barColors)

    var extent = d3.extent(data, function(d) { return d[x] })
    if(extent[0] < 0){
      this.x.domain(extent)
    } else {
      this.x.domain([0, extent[1]])
    }
    
    this.y.domain(data.map(function(d) { return d[y] }))

    var bars = this.svg.select(".bars")
{'fraction_non_alphanumeric': 0.18100224382946897, 'fraction_numerical': 0.01525804038893044, 'mean_word_length': 2.387031408308004, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5426737', 'n_tokens_mistral': 2454, 'n_tokens_neox': 2369, 'n_words': 435}