     super
     @pAverage  = 0
     @kwhWindow = 0
-    @price     = 0.14
+    @price     = 0.24
     @botKwhdText = ''
     $('#loading').hide()
     @fetchData()
 
   plotGraph: (data) ->
-    @data = data
-    tKwh  = 0
-    nDays = data.length
-    tKwh += parseFloat(z[1]) for z in data
+    @calculateAverage(data); #assign @kwhWindow
     @renderWeekView(data)  if @state == 'week'
     @renderMonthView(data) if @state == 'month'
     @renderYearView(data)  if @state == 'year'
-    @botKwhdText = kWhText(tKwh, nDays, @price)
+    @botKwhdText = kWhText(@kwhWindow, @numberOfDayes(), @price)
+    $("#bot_out").html(@botKwhdText)
 
   kWhText= (tKwh, nDays, price) ->
     text  = 'Total: ' + (tKwh).toFixed(0)


  shift: (direction) ->
    timeWindow = @till - @from
    shiftsize  = timeWindow * 0.2
    if direction == 'right'
       @from += shiftsize
       @till += shiftsize

     valueLabels: { show: false }
     grid: { show: true }
     xaxis: { mode: 'time' }

  numberOfDayes: ->
    diff = (@till - @from) / 1000
    days = diff / (3600 * 24)
    days

  setTime: (element) ->
    time  = $(element).attr('time')
