   landingUserStatsElements[0].chart?.resize()
 
 $(window).on 'throttled-resize', landingUserStatsResize
-$(document).on 'turbolinks:load', landingUserStatsInitialize
-
-
-resize = ->
+$(document).on 'turbolinks:load', landingUserStatsInitialize
    @modelStats @stats

  resize: =>
    width = parseInt(d3.select('.js-landing-graph').style('width')) - (@margin.left) - (@margin.right)
    height = parseInt(d3.select('.js-landing-graph').style('height')) - (@margin.top) - (@margin.bottom)
    d3.select '.js-landing-graph svg'
      .attr 'width', width + @margin.left + @margin.right
      .attr 'height', height + @margin.top + @margin.bottom
    # Update the range of the scale with new width/height
    xScale.range [
      0
      width
    ]
    yScale.range [
      height
      0
    ]
    # Force D3 to recalculate and update the line
    svg.selectAll('path').attr 'd', area

    rightX = xScale(@maxElem.date) + peakR * 2
    if (textLength + rightX) > width
      svg.select('.landing-graph__text').attr 'x', xScale(@maxElem.date) - textLength - peakR * 2
    else
      svg.select('.landing-graph__text').attr 'x', rightX
      
    svg.select('.landing-graph__circle').attr 'cx', xScale(@maxElem.date)

landingUserStatsInitialize = =>
  return if !landingUserStatsElements[0]?

      d.date = parseDate(d.date)
      d.users_osu = +d.users_osu

    @xScale = d3.scale.linear().range([
      0
      @width
    ])

    @yScale = d3.time.scale().range([
      @height
      0
    ])
