 
   stack:      d3.layout.stack().offset("zero")
   parse_date: d3.time.format("%Y-%m-%dT%XZ").parse
-
-  # Good place to put this? Jeff
   $x_position: $("#x-position")
   $y_position: $("#y-position")
   draw_tooltip: (e) => 

    @layer = (commits) =>
      deletions = ({x: commit.pos, y: @get_aggregated_additions(commit), y0: 0} for commit in commits)
      additions = ({x: commit.pos, y: @get_aggregated_deletions(commit), y0: @get_aggregated_additions} for commit in commits)

      @stack [deletions, additions]

    @area = d3.svg.area().x((d) => @x d.x).y0((d) => @y d.y0).y1((d) => @y d.y + d.y0)

    @get_timestamp_range = (min_screen_x, max_screen_x) =>
      return false if not @filtered_commits?
      a = Math.floor @rx(min_screen_x)
      b = Math.ceil  @rx(max_screen_x)
      [@filtered_commits[a].timestamp, @filtered_commits[b].timestamp]
    @sort_timestamp_asc = (a,b) => a.timestamp - b.timestamp

    @svg = d3.select(@$el.selector)

        class: "timeline_chart_svg"
        width: @width
        height: @height

    @render = (commits, filter_text="") =>
      if not @filter_text? or (not @filter_text is filter_text) or not @filtered_commits
        for commit, i in commits
          @set_aggregate_values(commit, filter_text)
          commit.pos = i if commit?
        @filtered_commits = commits
        t = d3.max(@filtered_commits, @summed_additions_deletions)
        @x.domain [0 , @filtered_commits.length]
        @y.domain [0, t]
        @rx.range [0 , @filtered_commits.length]
        @ry.range [0 , t]
      a = @svg.selectAll(".area").data(@layer @filtered_commits)
      a.enter()
        .append("path")
        .attr
          d: @area
          class: (d, i) -> if i is 0 then "additions area" else "deletions area"
      a.transition()
        .delay((d,i) -> i * 1000)
        .attr
          d: @area
          class: (d, i) -> if i is 0 then "additions area" else "deletions area"
      a.exit().remove()

window.timeline_chart = new Timeline($("#timeline"))

do ->
  ls         = $('.left.slider')
  rs         = $('.right.slider')
  $highlight = $("#highlight")
