 class RickshawStripChart
-  tickLength: 1000
+  tickLength: 10
   values: null
   year: 2015
   numCranes: 400

    offsets = years.map (x) -> Math.round(20*(Math.random()-0.65))
    start = @numCranes
    newVals = offsets.reduce ((l, r) -> l.concat([l[l.length-1]+r])), [start]
    #console.log(JSON.stringify(newVals))
    newData = newVals.map (v, i) => { 'Year': @year+i, 'Number of cranes': v }
    #console.log(JSON.stringify(newData))
    @values.push(newData)
  
  tick: =>
    # @extendData()
    # console.log(JSON.stringify(@values))
    @drawChart()
    @runNumber = @runNumber + 1
    # setTimeout(@tick, @tickLength)

window.RickshawStripChart = RickshawStripChart
    @tick()
  
  buildChart: ->
    @chart = new Rickshaw.Graph({
      element: document.getElementById('chart')
      width: 960
      height: 500
      renderer: 'line'
      series: @values
      min: 'auto'
    })
  
  drawChart: ->
