     # set range if known
     opts.valueRange = [ 0, 100 ]
 
-  # custom drag interaction - allow toggling pan mode
   opts.interactionModel = _.clone(Dygraph.Interaction.defaultModel)
+
+  # override mousedown to allow toggling pan mode
   opts.interactionModel.mousedown = (event, g, context) ->
-    # // Right-click should not initiate a zoom.
+    # Right-click should not initiate a zoom.
     if event.button && event.button == 2
       return
 

          downsample: "1m-avg"
        })
        Backbone.multi_fetch [ new_met ], (err, results) ->
          g.updateOptions({ file: new_met.tuples() })

  }

    else
      Dygraph.startZoom(event, g, context)

  # override mouseup to load more data as we pan in either direction
  opts.interactionModel.mouseup = (event, g, context) ->
    if context.isZooming
      Dygraph.endZoom(event, g, context)

    else if context.isPanning
      Dygraph.endPan(event, g, context)

      # check if we need more data
      [minX, maxX] = g.xAxisRange()
      [dMinX, dMaxX] = g.xAxisExtremes()
      start_diff = dMinX - minX
      end_diff = maxX - dMaxX

      startX = null
      if start_diff > 100000
        startX = minX
        endX = dMinX

      else if end_diff > 100000
        startX = dMaxX
        endX = maxX

      return if startX == null

      query = metric.get("query")
      new_met = new Bixby.model.Metric({
        id: metric.id
        host_id: metric.get("metadata").host_id
        start: parseInt(startX / 1000)
        end: parseInt(endX / 1000)
        downsample: query.downsample || "5m-avg"
      })
      Backbone.multi_fetch [ new_met ], (err, results) ->
        # don't replace data... add on to existing data
        all_data = g.file_.concat(new_met.tuples()).sort (a,b) ->
          return a[0] - b[0]
        g.updateOptions({ file: all_data })


  # draw
