   ).y0(height).y1((d) ->
     yScale d.users_osu
   )
-# Define svg canvas
-svg = d3.select '.js-landing-graph'
-  .append 'svg'
-  .attr 'width', width + margin.left + margin.right
-  .attr 'height', height + margin.top + margin.bottom
-  .append 'g'
-  .attr 'transform', 'translate(' + margin.left + ',' + margin.top + ')'
-
 
 modelStats = (data) ->
+  # Define svg canvas
+  svg = d3.select '.js-landing-graph'
+    .append 'svg'
+    .attr 'width', width + margin.left + margin.right
+    .attr 'height', height + margin.top + margin.bottom
+    .append 'g'
+    .attr 'transform', 'translate(' + margin.left + ',' + margin.top + ')'
+
   # Parsing data
   data.forEach (d) ->
     d.date = parseDate(d.date)

# Load the data
stats = osu.parseJson('json-stats')
#Prevent redrawing on page back/foward
if stats.length != 0
  modelStats stats
d3.select(window).on 'resize', resize
      d.users_osu
    )
  ]
  # Remove any existing paths
  svg.selectAll 'path'
    .remove

  # Appending groups
  svg.append 'path'
    .datum data
