new tip()
Asynchronous d3.tip support for dc.graph.js
Add tooltips to the nodes and edges of a graph using an asynchronous callback to get the html to show.
Optional - requires separately loading the d3.tip script and CSS (which are included in
dc.graph.js in web/js/d3-tip/index.js
and web/css/d3-tip/example-styles.css
)
Returns:
- Type
- Object
Members
-
content
-
Specifies the function to generate content for the tooltip. This function has the signature
function(d, k)
, whered
is the datum of the thing being hovered over, andk
is a continuation. The function should fetch the content, asynchronously if needed, and then pass html forward tok
.Example
// Default mode: assume it's a node, show node title var tip = dc_graph.tip().content(function(n, k) { k(_mode.parent() ? _mode.parent().nodeTitle.eval(n) : ''); });
-
direction
-
Specify the direction for tooltips. Currently supports the cardinal and intercardinal directions supported by d3.tip.direction:
'n'
,'ne'
,'e'
, etc. -
table
-
Generates a handler which can be passed to
tip.content
to produce a table of the attributes and values of the hovered object.Example
// show all the attributes and values in the node and edge objects var tip = dc_graph.tip(); tip.content(dc_graph.tip.table());