         else
           'none'
 
-    bars = vis.selectAll('rect.bar')
+    @bars = vis.selectAll('rect.bar')
       .data(data)
     .enter().append('rect')
       .attr('x', (d, i) => @x i)

      .attr('width', @x.rangeBand())
      .attr('class', 'bar')

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

      @y.domain [0, max]

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

      bars.classed('max', (d, i) -> d.value == max)

    @updateInterval = setInterval update, 5000

  toggle: (@stats) ->
    if @hasParent()

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

    vis.append('g')
      .attr('class', 'x axis')
