[Pkg-javascript-commits] [d3-tip.js] 26/277: account for clipping on left in all cases

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

bhuvan-guest pushed a commit to branch master
in repository d3-tip.js.

commit 58bf375906ea2595a186c6e14610d0d31dc19990
Author: Justin Palmer <justin at labratrevenge.com>
Date:   Mon Jan 9 10:55:01 2012 -0800

    account for clipping on left in all cases
---
 examples/circles.html | 9 ++++++---
 src/d3.tip.js         | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/examples/circles.html b/examples/circles.html
index 91637b4..121f968 100644
--- a/examples/circles.html
+++ b/examples/circles.html
@@ -32,6 +32,7 @@
         h = 500,
         r = 10,
         linex, liney,
+        orientations = ['top', 'bottom', 'left', 'right'],
         data = [1220, 2230, 3002, 4012],
         x = d3.scale.linear().domain([0, data.length - 1]).range([r, w - r]),
         y = d3.scale.linear().domain([0, d3.max(data)]).range([h,  r]),
@@ -52,8 +53,9 @@
       .attr('r', r)
       .attr('cx', function(d, i) { return x(i) })
       .attr('cy', y)
-      .on('mouseover', tip)
-      .on('click', function() { 
+      .on('mouseover', function(d, i) { 
+        tip.orient(orientations[i]).apply(this, arguments)
+
         var bbox = this.getBBox(),
             x = bbox.x + (bbox.width / 2),
             y = bbox.y + bbox.height;
@@ -64,7 +66,8 @@
 
         liney.transition()
           .attr('y1', y)
-          .attr('y2',y)      
+          .attr('y2',y)          
+
       })
 
     linex = vis.append('line')
diff --git a/src/d3.tip.js b/src/d3.tip.js
index fa9a5f4..d8a71c4 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -120,7 +120,7 @@ d3.svg.tip = function() {
     }
 
     // Tip clipped at left boundry
-    if(loc.x < 0 && orient == 'left') {
+    if(loc.x < 0) {
       loc = d3_orient_types['right']()
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/d3-tip.js.git



More information about the Pkg-javascript-commits mailing list