Node Expander

Search
Feedback

The Node Expander Module enables the user to expand a node with new nodes from the database with incoming and outgoing relationships.

There are two options to trigger the loading of new nodes to a graph view. When a node is doubleclicked, the module will load all neighboring nodes and will add them directly to the view. For the second option, the module will display html buttons for each nodetype, that’s within the newly loaded nodes from the database, around a hovered node. Every button has the same backgroundcolor as the nodes with the same nodetypes have in the graph view. When one of the buttons is clicked, all nodes with the buttons’ nodetype will be added to the graph view.

Settings

Fields Type Description
container string This is the container where the information buttons are shown when a node is hovered. The information buttons are small elements that give a short description about the expand buttons that appear when a node is hovered.
margins.left float With this setting the expand buttons can have a additional margin to the left side of the screen
margins.top float With this setting the expand buttons can have a additional margin to the top of the screen
infoButtonRenderer function(colorkey, label) This has to be a function that creates a html representation of the information buttons. It will be called for each expand button and the parameters will be set accordingly.
infoButtonRenderer function(colorkey, label) This has to be a function that creates a html representation of the information buttons. It will be called for each expand button and the parameters will be set accordingly.
defaultInfoButtonColor string (hexcolor code) When no custom information button renderer is provided the buttons will have the color wich is provided for them in the global color object. With this setting you can override the color with one color for each button.
newNodeSize int Specifies the size for new nodes added with the expander module
newEdgeSize int Specifies the size for new edges added with the expander module
newNodeLabelProperty string Specifies the property of new nodes that should be displayed as label
newEdgeLabelProperty string Specifies the property of new edges that should be displayed as label
edgeType string Specifies in what shape the new edges should be displayed.
onAddNodes function(nodeToExpand, nodes, edges) Will be called before new nodes are added to the Graph-Browser. nodeToExpand is the node wich can be expanded. nodes is the collection of new nodes wich are about to be added. edges is the collection of new edges. The Expansion will be aborted when this function returns false.
onNodesAdded function() This is a simple callback function that is called when the new nodes were added to the Graph-Browser.
onNodesRemoved function() Will be called when a node was collapsed.

Example

var graphSettings = {
    graphContainer: 'graph-container',
    moduleSettings: {'nodeExpander': {'container': 'graph-info', 'margins': {'top': 20, 'left': -5}, onNodesAdded: myFunctionAfterNodesWereAdded} }  
};

var graphBrowser = new GraphBrowser(graphSettings);

Graph-Browser

About this article
Last change 2017-07-17
Topics ExperimentalStructr 2.0