   attach: ->
     @rootView.append @
     @focus()
-    @append()
+    @draw()
 
   detach: =>
     super()

    while date <= future
      @eventlog[time(date)] = 0

    @rootView.on 'keyup', @track
    @rootView.on 'mousedown', @track

  append: ->
    w = @.width()
    h = @.height()
    [pt, pl, pb, pr] = [0,0,0,0]

    d3.select(@.get(0)).append('svg')
      .attr('width', w)
      .attr('height', h)
    .append('g')
      .attr('transform', "translate(#{pl},#{pt})")

  draw: ->
    w = @.width()

    x.rangeRoundBands [0, w - pl - pr], 0.1
    y.domain([0, max]).range [h, 0]

    vis = d3.select(@.get(0)).append('svg')
      .attr('width', w)
      .attr('height', h)
    .append('g')
      .attr('transform', "translate(#{pl},#{pt})")

    bars = vis.selectAll('rect.bar')
      .data(data)
    .enter().append('rect')
      .attr('x', (d, i) => x i)
      .attr('y', (d) -> y d.value)
      .attr('height', (d) -> h - y(d.value))
      .attr('width', x.rangeBand())

    update = =>
      newdata = d3.entries @eventlog
      max  = d3.max newdata, (d) -> d.value

      x.rangeRoundBands [0, w - pl - pr], 0.1
      y.domain([0, max]).range [h, 0]

      bars.data(newdata).transition()
        .attr('height', (d, i) ->  h - y(d.value))
        .attr('y', (d, i) -> y(d.value))

    setInterval update, 5000

  track: =>
    date = new Date
