Constructor
new Graph(opts)
Note that the opts.network attribute is required.
Parameters
-
opts
Object{}Properties
-
margin
Number<optional>
40Graph margins in pixels.
-
height
Number<optional>
550Height of network graph in pixels.
-
width
Number<optional>
800Width of network graph in pixels.
-
network
Network -
engine
String<optional>
'cola'Force layout engine. Can be
d3orcola. -
flow
String<optional>
Display links in horizontal flow?
-
draggable
Boolean<optional>
Make nodes draggable?
-
margin
Source
Properties
-
labels
Labelsreference to Labels used for UI interactions
-
links
Linksreference to Links used for UI interactions
-
nodes
Nodesreference to Nodes used for UI interactions
-
renders
Integerinternal counter used to help decide whether to re-render a layout
Methods
highlightDependencies(node, optionsopt)
Highlights dependencies, of nodes
Parameters
-
node
NodeNode, whose dependencies are to be highlighted
-
options
Object<optional>
{}Properties
-
arrows
Boolean<optional>
nullShow directional arrows of source-target relationship?
-
arrows
Source
init() → {this}
Initializes Graph layout, binds graph to Network, and performs first render.
Listens to events
- Network#event:update
- Links#event:enter
- Links#event:exit
- Nodes#event:update
- Nodes#event:enter
- Nodes#event:exit
- Nodes#event:click
- Nodes#event:mouseover
- Nodes#event:mouseout
Source
render(dataopt)
Renders Nodes, Links and Labels for a Graph.
If nodes have failures, they will be highlighted with colors and animations in the graph.
Parameters
-
data
Object<optional>
Defaults to graph's Network data.
Source
resetStyles()
Resets styles, highlights, removing colors, arrows, etc.
Source
Events
node:click
Type
Example
graph.on('node:click', (node) => {
console.log('User clicked on node ' + node.name)
})
node:mouseout
Type
Example
graph.on('node:mouseout', (node) => {
console.log('User mouse-outed on node ' + node.name)
})
node:mouseover
Type
Example
graph.on('node:mouseover', (node) => {
console.log('User mouse-overed on node ' + node.name)
})