 
       else
         # handle non-multiglyphs
-        data_x = renderer_view.glyph._x?[i]
-        data_y = renderer_view.glyph._y?[i]
+        data_x = glyph._x?[i]
+        data_y = glyph._y?[i]
         if @model.point_policy == 'snap_to_data' # and renderer.glyph.sx? and renderer.glyph.sy?
           # Pass in our screen position so we can determine
           # which patch we're over if there are discontinuous
           # patches.
-          pt = renderer_view.glyph.get_anchor_point(@model.anchor, i, [sx, sy])
+          pt = glyph.get_anchor_point(@model.anchor, i, [sx, sy])
           if not pt?
-            pt = renderer_view.glyph.get_anchor_point("center", i, [sx, sy])
+            pt = glyph.get_anchor_point("center", i, [sx, sy])
 
           rx = canvas.sx_to_vx(pt.x)
           ry = canvas.sy_to_vy(pt.y)

            cell.appendChild(el)
            continue
          if hex
            color = _color_to_hex(color)
          el = span({}, color)
          cell.appendChild(el)
          if swatch

import {replace_placeholders} from "core/util/templating"
import {div, span} from "core/dom"
import * as p from "core/properties"
import {color2hex} from "core/util/color"
import {values, isEmpty} from "core/util/object"
import {isString, isFunction} from "core/util/types"
import {build_views, remove_views} from "core/build_views"

export _nearest_line_hit = (canvas, i, geometry, sx, sy, dx, dy) ->
  d1x = dx[i]
  d1y = dy[i]

  d2x = dx[i+1]
  d2y = dy[i+1]

  if geometry.type == "span"
    switch geometry.direction
      when "h"
        dist1 = Math.abs(d1x-sx)
        dist2 = Math.abs(d2x-sx)
      when "v"
        dist1 = Math.abs(d1y-sy)
        dist2 = Math.abs(d2y-sy)
  else
    dist1 = hittest.dist_2_pts(d1x, d1y, sx, sy)
    dist2 = hittest.dist_2_pts(d2x, d2y, sx, sy)

  if dist1 < dist2
    rx = canvas.sx_to_vx(d1x)
    ry = canvas.sy_to_vy(d1y)
    return [[rx, ry], i]
  else
    rx = canvas.sx_to_vx(d2x)
    ry = canvas.sy_to_vy(d2y)
    return [[rx, ry], i+1]

export _line_hit = (canvas, xs, ys, ind) ->
  return [[canvas.sx_to_vx(xs[ind]), canvas.sy_to_vy(ys[ind])], ind]

export class HoverToolView extends InspectToolView

