Class: Graph

Graph

new Graph(props)

Constructs a new Graph
Parameters:
Name Type Description
props Object Object containing optional properties of the Graph
Properties
Name Type Description
antialias Boolean 'true' if antialiasing should be enabled on the graph. Defaults to 'false'.
fov Number Degree represting the field of view for the camera. Defaults to 45.
sizeAttenuation Boolean 'true' if nodes' size should change with distance. Defaults to 'false'.
nodeImage String Path to an image to use for the graph nodes, defaults to no image.
nodeImageTransparent Boolean 'true' if the node image has transparency, defaults to 'false'.
nodeSize Number Number representing the size (in pixels) of the nodes within the graph, defaults to 10
edgeOpacity Number Number (between 0 and 1) indicating the percentage opacity of the edges, defaults to 1 (100%)
edgeWidth Number Number representing the width (in pixels) of the edges within the graph, defaults to 1
bgColor Number | String Hexadecimal or CSS-style string representation the color of the background, defaults to 'white'
bgOpacity Number Number (between 0 and 1) indicating the percentage opacity of the background, defaults to 1 (100%)
hover function Callback function that will be called when the mouse hovers over a node. Event data will be passed as a parameter to the callback.
click function Callback function that will be called when the mouse clicks a node. Event data will be passed as a parameter to the callback.
Source:

Methods

<private> _resolveEdgeIds(edge) → {undefined}

Replace string IDs representing Nodes in Edges with Node references
Parameters:
Name Type Description
edge Edge Edge that
Source:
Returns:
Type
undefined

addEdge()

Add an Edge to the Graph. Upon adding, if the Edge contains Node string ID's, they will be looked up in the Graph and replaced with Node instances.
Source:

renderIn(elem) → {Graph}

Render the Graph in a DOM element
Parameters:
Name Type Description
elem Element | String Element the Graph should be rendered in. Specify Element ID if string.
Source:
Returns:
The Graph the method was called on
Type
Graph