t-viSNE: Interactive Assessment and Interpretation of t-SNE Projections https://doi.org/10.1109/TVCG.2020.2986996
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
t-viSNE/modules/d3-tip/docs/positioning-tooltips.md

34 lines
1.2 KiB

6 years ago
[API Documentation](index.md) ➤ Positioning tooltips
# Positioning tooltips
### tip.direction(direction)
Sets the position of a tooltip relative to a target element. `direction` can be
`n`, `s`, `e`, `w`, `nw`, `ne`, `sw` or `se`. The direction will also automatically be included as a classname
on the tooltip element which allows for different style hooks based on the direction.
``` 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])
```