       max = 100
       min = -100
 
-      values = []
-      sum = 0
-
       if m.get('display') == 'rate'
         data = m.get('rates')
       else
         data = m.get('values')
 
-      _.times data.length, (i) ->
-        val = data[i].value
-        target = m.getCompareAndVal(m.get('target'))
+      dataSeries = @splitData(data)
+      target = m.get('targetVal')
 
-        if m.get('display') != 'rate'
-          variance = Math.abs(m.get('targetVal') - val)
-          variance = Math.round((variance / m.get('targetVal')) * 100)
-        else
-          variance = Math.round((val / m.get('targetVal')) * 100)
+      dataSeries = _.map(dataSeries, (series, i)->
+        _.map(series, (val)->
+          if i == 0
+            variance = Math.abs(target - val[1])
+          else
+            variance =  Math.abs(target - val[1]) * -1
 
-        if m.compareVal(target, val)
-          if target[0][0] == '<'
-            variance = 100 - variance
-        else
-          if target[0][0] == '>'
-            variance = 100 - variance
+          if variance > max
+            max = variance
 
-          variance = variance * -1
+          if variance < min
+            min = variance
 
-        x = m.get('values')[i].date.getTime()
-        values.push([x, variance])
-
-        if variance > max
-          max = variance
-
-        if variance < min
-          min = variance
-
+          return [val[0], variance]
+        )
+      )
 
       aMin = Math.abs(min)
 


      @$el.on 'shown', =>
        @valueChart()
        @varianceChart()

      @$el.modal()

    initialize: ->
      @id = @model.cid

    splitData: (data)->
      pass = []
      fail = []
      warn = []

      m = @model

      _.times data.length, (i) ->
        val = data[i].value
        x = m.get('values')[i].date.getTime()

        if m.get('target')
          target = m.getCompareAndVal(m.get('target'))
        else
          pass.push([x, val])
          return

        if m.get('warning')
          warning = m.getCompareAndVal(m.get('warning'))

        if not m.compareVal(target, val)
          if warning and m.compareVal(warning, val)
            warn.push([x, val])
          else
            fail.push([x, val])
        else
          pass.push([x, val])

      return [pass, fail, warn]

    valueChart: ->
      if @model.get('display') == 'rate'
        data = @model.get('rates')
        display = "Rate (%)"
      else
        data = @model.get('values')
        display = "Volume"

      dataSeries = @splitData(data)

      container = $('#val-chart')[0]
      graphOpts =
        title: display
        colors: ['green', 'red', 'orange']
        bars:
          show: true
          barWidth: 1000 * 43000
