[Pkg-javascript-commits] [d3-tip.js] 13/277: implement padding

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:11 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 767f5a49115d0afe033df1e221d1eb267702ce19
Author: Justin Palmer <justin at labratrevenge.com>
Date:   Sun Jan 8 15:18:41 2012 -0800

    implement padding
---
 examples/bars.html | 2 +-
 examples/line.html | 2 +-
 src/d3.tip.js      | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/bars.html b/examples/bars.html
index 71840d8..bd58375 100644
--- a/examples/bars.html
+++ b/examples/bars.html
@@ -36,7 +36,7 @@
         y  = d3.scale.linear().domain([0, d3.max(data)]).range([h, 0]),
         tip = d3.svg.tip()
           .orient('top')
-          .padding(10)
+          .padding(5)
           .text(function(d) { return d; })
           .attr('class', 'd3-tip')
 
diff --git a/examples/line.html b/examples/line.html
index ff44be6..704fa56 100644
--- a/examples/line.html
+++ b/examples/line.html
@@ -46,7 +46,7 @@
       linex, liney,
       tip = d3.svg.tip()
         .orient('top')
-        .padding(10)
+        .padding(5)
         .offset([20, 20])
         .text(function(d) { return d; })
         .attr('class', 'd3-tip');
diff --git a/src/d3.tip.js b/src/d3.tip.js
index d31d33e..d403336 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -30,6 +30,9 @@ d3.svg.tip = function() {
     var val     = container.append('text').text(tipText).attr('text-anchor', 'middle').attr('alignment-baseline', 'middle'),
         valRect = val.node().getBBox();
     
+    valRect.width = valRect.width + (padding * 2)
+    valRect.height = valRect.height + (padding * 2)
+    
     backing.attr('width', valRect.width).attr('height', valRect.height)
     val.attr('dx', valRect.width / 2).attr('dy', valRect.height / 2)
 

-- 
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