[Pkg-javascript-commits] [d3-tip.js] 110/277: first pass at position docs

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:21 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 bcdff5b7a1c5f1d7b5ae9e2408d3d50fae3e235b
Author: Justin Palmer <justin at github.com>
Date:   Sun Apr 21 15:10:05 2013 -0700

    first pass at position docs
---
 docs/positioning-tooltip.md | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/docs/positioning-tooltip.md b/docs/positioning-tooltip.md
index 19facb0..d766b5c 100644
--- a/docs/positioning-tooltip.md
+++ b/docs/positioning-tooltip.md
@@ -1,3 +1,32 @@
 [API Documentation](index.md) ➤ Positioning tooltips
 
-# Positioning tooltips
\ No newline at end of file
+# Positioning tooltips
+
+### tip.direction(direction)
+Sets the position of a tooltip relative to a target element.  `direction` can be
+`n`, `s`, `e` or `w`.
+
+``` javascript
+tip.direction('n') // Position the tooltip to the top of a target element
+tip.direction('s') // Position the tooltip to the bottom of a target element
+tip.direction('e') // Position the tooltip to the right of a target element
+tip.direction('w') // Position the tooltip to the left of a target element
+```
+##### Changing the direction programatically
+``` javascript
+tip.direction(function(d) {
+  if(d == 'california') return 'w'
+  if(d == 'new york') return 'e'
+})
+```
+
+### tip.offset([values])
+Offset a tooltip relative to its calculated position.  Offset is computed from
+`[top, left]`.
+
+If you want to draw extenders on tooltips, use this method to offset the tooltip
+enough in the desired direction so the extender doesn't overlap the target element.
+
+``` javascript
+tip.offset([10, -10])
+```

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