<commit_before># A bar chart / histogram which plots capacity and cost. Both the height and
# width of the bar are adjusted according to the x and y values.
D3.cost_capacity_bar =
  View: class extends D3ChartView
    initialize: ->
      # the initalizer is wrapped in a try to prevent IE8 errors. The d3.scale()
      # method raises (on IE8) an exception before we have a chance to notify
      # the user that something went wrong.
      @initialize_defaults()

    margins:
      top: 10
      bottom: 40
      left: 50
      right: 10

    # Provides axis and tooltip translations customised for the chart.
    t: (key) =>
      I18n.t(
        "output_elements.#{@model.get('key')}_chart.#{key}",
        defaults: [{ scope: "output_elements.cost_capacity_chart.#{key}" }]
      )

    draw: =>
      [@width, @height] = @available_size()

      @svg        = @create_svg_container @width, @height, @margins
      @merit_data = MeritOrderData.set(@model.non_target_series())
      @data       = @merit_data.format()

      @x          = d3.scale.linear().domain([0, 100]).range([0, @width])
      @y          = d3.scale.linear().domain([0, 100]).range([0, @height])
      @inverted_y = @y.copy().range([@height, 0])
      @x_axis     = d3.svg.axis().scale(@x).ticks(4).orient("bottom")
                      .tickFormat((x) => @main_formatter()(x))
      @y_axis     = d3.svg.axis().scale(@inverted_y).ticks(4).orient("left")

      # axis
      @svg.append("svg:g")
        .attr("class", "x_axis")
        .attr("transform", "translate(0, #{@height})")
        .call(@x_axis)

      @svg.append("svg:g")
        .attr("class", "y_axis")
        .call(@y_axis)

      @svg.append("svg:text")
        .text("#{@t('operating_costs')} [EUR/MWh]")
        .attr("x", @height / -2)
        .attr("y", -35)
        .attr("text-anchor", "middle")
        .attr("class", "axis_label")
        .attr("transform", "rotate(270)")

      @svg.append("svg:text")
        .text("#{@t('installed_capacity')}")
        .attr("x", @width / 2)
        .attr("y", @height + 30)
        .attr("text-anchor", "middle")
        .attr("class", "axis_label")

      # nodes<commit_msg>Move x-axis label down on cost/capacity chart<commit_after># A bar chart / histogram which plots capacity and cost. Both the height and
# width of the bar are adjusted according to the x and y values.
D3.cost_capacity_bar =
  View: class extends D3ChartView
    initialize: ->
      # the initalizer is wrapped in a try to prevent IE8 errors. The d3.scale()
      # method raises (on IE8) an exception before we have a chance to notify
      # the user that something went wrong.
      @initialize_defaults()

    margins:
      top: 10
      bottom: 40
      left: 50
      right: 10

    # Provides axis and tooltip translations customised for the chart.
    t: (key) =>
      I18n.t(
        "output_elements.#{@model.get('key')}_chart.#{key}",
        defaults: [{ scope: "output_elements.cost_capacity_chart.#{key}" }]
      )

    draw: =>
      [@width, @height] = @available_size()

      @svg        = @create_svg_container @width, @height, @margins
      @merit_data = MeritOrderData.set(@model.non_target_series())
      @data       = @merit_data.format()

      @x          = d3.scale.linear().domain([0, 100]).range([0, @width])
      @y          = d3.scale.linear().domain([0, 100]).range([0, @height])
      @inverted_y = @y.copy().range([@height, 0])
      @x_axis     = d3.svg.axis().scale(@x).ticks(4).orient("bottom")
                      .tickFormat((x) => @main_formatter()(x))
      @y_axis     = d3.svg.axis().scale(@inverted_y).ticks(4).orient("left")

      # axis
      @svg.append("svg:g")
        .attr("class", "x_axis")
        .attr("transform", "translate(0, #{@height})")
        .call(@x_axis)

      @svg.append("svg:g")
        .attr("class", "y_axis")
        .call(@y_axis)

      @svg.append("svg:text")
        .text("#{@t('operating_costs')} [EUR/MWh]")
        .attr("x", @height / -2)
        .attr("y", -35)
        .attr("text-anchor", "middle")
        .attr("class", "axis_label")
        .attr("transform", "rotate(270)")

      @svg.append("svg:text")
        .text("#{@t('installed_capacity')}")
        .attr("x", @width / 2)
        .attr("y", @height + 35)
        .attr("text-anchor", "middle")
        .attr("class", "axis_label")

      # nodes
{'fraction_non_alphanumeric': 0.17437070938215102, 'fraction_numerical': 0.019221967963386728, 'mean_word_length': 2.39100077579519, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3742977', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1444, 'n_words': 325}