 
   pointerYInElement: (e) -> e.offsetY || e.clientY - e.target.offsetTop + window.pageYOffset - @canvas.getBoundingClientRect().top
 
-
 module?.exports = CanvasGraph: CanvasGraph, Marks: Marks, Mark: Mark

      @ctx.fillStyle = "#fff"
      @ctx.fillRect(x, y,2,2)

    # @scale = 1 + (xMax - xMin) / @largestX

    for mark in @marks.all
      scaledMin = ((@toDataXCoord(mark.canvasXMin) - xMin) / (xMax - xMin)) * @canvas.width
      scaledMax = ((@toDataXCoord(mark.canvasXMax) - xMin) / (xMax - xMin)) * @canvas.width

      mark.element.style.width = (scaledMax-scaledMin) + "px"
      mark.element.style.left = (scaledMin) + "px"

      @mark.draw(e)

  plotPoints: (xMin = @smallestX, xMax = @largestX) ->
    @xMin = xMin
    @xMax = xMax
    @clearCanvas()
    for point in @data
      x = ((point.x - xMin) / (xMax - xMin)) * @canvas.width
