the HTML element representing the network container
network data
This function converts DOM coordinates to coordinates on the canvas. Input and output are in the form of {x:Number,y:Number} (IPosition interface). The DOM values are relative to the network container.
the DOM coordinates
the canvas coordinates
Go into addEdge mode. The explaination from addNodeMode applies here as well.
Go into addNode mode. Having edit mode or manipulation enabled is not required.
To get out of this mode, call disableEditMode(). The callback functions defined in handlerFunctions still apply. To use these methods without having the manipulation GUI, make sure you set enabled to false.
This function converts canvas coordinates to coordinates on the DOM. Input and output are in the form of {x:Number, y:Number} (IPosition interface). The DOM values are relative to the network container.
the canvas coordinates
the DOM coordinates
The joinCondition function is presented with all nodes.
This method looks at the provided node and makes a cluster of it and all it's connected nodes.
The behaviour can be customized by proving the options object. All options of this object are explained below. The joinCondition is only presented with the connected nodes.
the id of the node
This method checks all nodes in the network and those with a equal or higher amount of edges than specified with the hubsize qualify. If a hubsize is not defined, the hubsize will be determined as the average value plus two standard deviations. For all qualifying nodes, clusterByConnection is performed on each of them. The options object is described for clusterByConnection and does the same here.
This method will cluster all nodes with 1 edge with their respective connected node.
Delete selected. Having edit mode or manipulation enabled is not required.
Remove the network from the DOM and remove all Hammer bindings and references.
Programatically disable the edit mode. Similar effect to pressing the close icon (small cross in the corner of the toolbar).
Go into editEdge mode. The explaination from addNodeMode applies here as well.
Edit the selected node. The explaination from addNodeMode applies here as well.
Programatically enable the edit mode.
Similar effect to pressing the edit button.
Nodes can be in clusters. Clusters can also be in clusters. This function returns an array of nodeIds showing where the node is.
Example: cluster 'A' contains cluster 'B', cluster 'B' contains cluster 'C', cluster 'C' contains node 'fred'.
network.clustering.findNode('fred') will return ['A','B','C','fred'].
the node id.
an array of nodeIds showing where the node is
Zooms out so all nodes fit on the canvas.
You can focus on a node with this function. What that means is the view will lock onto that node, if it is moving, the view will also move accordingly. If the view is dragged by the user, the focus is broken. You can supply options to customize the effect.
When a clusteredEdgeId is available, this method will return the original baseEdgeId provided in data.edges ie. After clustering the 'SelectEdge' event is fired but provides only the clustered edge. This method can then be used to return the baseEdgeId.
Returns a bounding box for the node including label.
Similar to findNode in that it returns all the edge ids that were created from the provided edge during clustering.
the base edge id
an array of edgeIds
Returns an array of edgeIds of the edges connected to this node.
the node id
Returns an array of nodeIds of the all the nodes that are directly connected to this node. If you supply an edgeId, vis will first match the id to nodes. If no match is found, it will search in the edgelist and return an array: [fromId, toId].
a node or edge id
Returns a edgeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas.
Returns a nodeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas.
Returns an array of all nodeIds of the nodes that would be released if you open the cluster.
the id of the cluster node
If you use the configurator, you can call this method to get an options object that contains all differences from the default options caused by users interacting with the configurator.
Returns the x y positions in canvas space of the nodes with the supplied nodeIds as an object.
Alternative inputs are a String containing a nodeId or nothing. When a String is supplied, the position of the node corresponding to the ID is returned. When nothing is supplied, the positions of all nodes are returned.
Returns the current scale of the network. 1.0 is comparible to 100%, 0 is zoomed out infinitely.
the current scale of the network
If you like the layout of your network and would like it to start in the same way next time, ask for the seed using this method and put it in the layout.randomSeed option.
the current seed of the network.
Returns an array of selected edge ids like so: [edgeId1, edgeId2, ..].
Returns an array of selected node ids like so: [nodeId1, nodeId2, ..].
Returns an object with selected nodes and edges ids.
Returns the current central focus point of the view in the form: { x: {Number}, y: {Number} }
the view position;
Returns true if the node whose ID has been supplied is a cluster.
the node id.
You can use this to programatically move a node. The supplied x and y positions have to be in canvas space!
the node that will be moved
new canvas space x position
new canvas space y position
You can animate or move the camera using the moveTo method.
Remove an event listener. The function you supply has to be the exact same as the one you used in the on function. If no function is supplied, all listeners will be removed.
the name of the event, f.e. 'click'
Set an event listener. Depending on the type of event you get different parameters for the callback function.
the name of the event, f.e. 'click'
the callback function that will be raised
Set an event listener only once. After it has taken place, the event listener will be removed. Depending on the type of event you get different parameters for the callback function.
the name of the event, f.e. 'click'
the callback function that will be raised once
Opens the cluster, releases the contained nodes and edges, removing the cluster node and cluster edges. The options object is optional and currently supports one option, releaseFunction, which is a function that can be used to manually position the nodes after the cluster is opened.
the node id
Redraw the network.
Programatically release the focussed node.
Selects the edges corresponding to the id's in the input array. This method unselects all other objects before selecting its own objects. Does not fire events.
Selects the nodes corresponding to the id's in the input array. If highlightEdges is true or undefined, the neighbouring edges will also be selected. This method unselects all other objects before selecting its own objects. Does not fire events.
Override all the data in the network. If stabilization is enabled in the physics module, the network will stabilize again. This method is also performed when first initializing the network.
network data
Set the options. All available options can be found in the modules above. Each module requires it's own container with the module name to contain its options.
network options
Sets the selection. You can also pass only nodes or edges in selection object.
Set the size of the canvas. This is automatically done on a window resize.
width in a common format, f.e. '100px'
height in a common format, f.e. '100px'
You can manually call stabilize at any time. All the stabilization options above are used. You can optionally supply the number of iterations it should do.
Start the physics simulation. This is normally done whenever needed and is only really useful if you stop the simulation yourself and wish to continue it afterwards.
This stops the physics simulation and triggers a stabilized event. Tt can be restarted by dragging a node, altering the dataset or calling startSimulation().
When using the vis.DataSet to load your nodes into the network,
this method will put the X and Y positions of all nodes into that dataset. If you're loading your nodes from a database and have this dynamically coupled with the DataSet, you can use this to stablize your network once, then save the positions in that database through the DataSet so the next time you load the nodes, stabilization will be near instantaneous.
If the nodes are still moving and you're using dynamic smooth edges (which is on by default), you can use the option stabilization.onlyDynamicEdges in the physics module to improve initialization time.
This method does not support clustering. At the moment it is not possible to cache positions when using clusters since they cannot be correctly initialized from just the positions.
Unselect all objects. Does not fire events.
Clustered Nodes when created are not contained in the original data.nodes passed on network creation. This method updates the cluster node.
Visible edges between clustered nodes are not the same edge as the ones provided in data.edges passed on network creation. With each layer of clustering, copies of the edges between clusters are created and the previous edges are hidden, until the cluster is opened. This method takes an edgeId (ie. a base edgeId from data.edges) and applys the options to it and any edges that were created from it while clustering.
Creates an instance of Network.