// d3.tip
// Copyright (c) 2013 Justin Palmer
//
// Tooltips for d3.js SVG visualizations

// Public - contructs a new tooltip
//
// Returns a tip
d3.tip = function() {
      offset    = d3_tip_offset,
      html      = d3_tip_html,
      node      = initNode(),
      svg       = null,
      point     = null,
      target    = null

  function tip(vis) {
    svg = getSVGNode(vis)
    point = svg.createSVGPoint()
    document.body.appendChild(node)
  }

  // Public - show the tooltip on the screen
  //
  // Returns a tip
  tip.show = function() {
    var args = Array.prototype.slice.call(arguments)
    if(args[args.length - 1] instanceof SVGElement) target = args.pop()

    var content = html.apply(this, args),
        poffset = offset.apply(this, args),

    nodel.html(content)
      .style({ opacity: 1, 'pointer-events': 'all' })

    })

    return tip
  }

  // Public - hide the tooltip
  //
  // Returns a tip
  tip.hide = function() {
    nodel = d3.select(node)
    nodel.style({ opacity: 0, 'pointer-events': 'none' })
    return tip
  }

  // Public: Proxy attr calls to the d3 tip container.  Sets or gets attribute value.
  //
  // n - name of the attribute
  // v - value of the attribute
  //
  // Returns tip or attribute value
  tip.attr = function(n, v) {
    if (arguments.length < 2 && typeof n === 'string') {
      return d3.select(node).attr(n)
    } else {
      var args =  Array.prototype.slice.call(arguments)
      d3.selection.prototype.attr.apply(d3.select(node), args)
    }

    return tip
  }

  // Public: Proxy style calls to the d3 tip container.  Sets or gets a style value.
  //
  // n - name of the property
  // v - value of the property
  //
  // Returns tip or style property value
  tip.style = function(n, v) {
    if (arguments.length < 2 && typeof n === 'string') {
      return d3.select(node).style(n)
    } else {
      var args =  Array.prototype.slice.call(arguments)
      d3.selection.prototype.style.apply(d3.select(node), args)
    }

    return tip
  }

  //
  //

    return tip
  }

  // Public: Sets or gets the offset of the tip
  //
  // v - Array of [x, y] offset
  //
  // Returns offset or
  tip.offset = function(v) {
    if (!arguments.length) return offset
    offset = v == null ? v : d3.functor(v)

    return tip
  }

  // Public: sets or gets the html value of the tooltip
  //
  // v - String value of the tip
  //
  // Returns html value or tip
  tip.html = function(v) {
    if (!arguments.length) return html
    html = v == null ? v : d3.functor(v)

    return tip
  }

  function d3_tip_offset() { return [0, 0] }
  function d3_tip_html() { return ' ' }

  function initNode() {
    var node = d3.select(document.createElement('div'))
    node.style({
      position: 'absolute',
      opacity: 0,
      pointerEvents: 'none',
      boxSizing: 'border-box'
    })

    return node.node()
  }

  function getSVGNode(el) {
    el = el.node()
    if(el.tagName.toLowerCase() == 'svg')
      return el

    return el.ownerSVGElement
  }

  return tip
};
@@ -84,16 +84,153 @@
 ations%0A%0A
+// Modified by Christophe Marchadour%0A// Remove direction in favor of coordinate %0A// for smoother and more precise tooltip location/move%0A%0A
 // Publi
@@ -295,24 +295,63 @@
 unction() %7B%0A
+  var coordinate  = d3_tip_coordinate,%0A
       offset
@@ -932,16 +932,50 @@
 , args),
+%0A        nodel   = d3.select(node)
 %0A%0A    no
@@ -1043,24 +1043,141 @@
 : 'all' %7D)%0A%0A
+    nodel.style(%7B%0A      top: (coordinate().y +  poffset%5B0%5D) + 'px',%0A      left: (coordinate().x + poffset%5B1%5D) + 'px'%0A
     %7D)%0A%0A    
@@ -2344,21 +2344,253 @@
  %7D%0A%0A  //
-%0A  //
+ Public: Set or get the coordinate of the tooltip%0A  //%0A  // v - %7Bx:%22%22,y:%22%22%7D%0A  //%0A  // Returns tip or coordinate%0A  tip.coordinate = function(v) %7B%0A    if (!arguments.length) return coordinate;%0A    coordinate = v == null ? v : d3.functor(v)
 %0A%0A    re
@@ -3192,16 +3192,70 @@
 rn ' ' %7D
+%0A  function d3_tip_coordinate() %7B return %7Bx:0,y:0%7D %7D  
 %0A%0A  func

Update d3tip library to match requirements