MindFusion.Diagramming for JavaScript Programmer's Guide
Accessing Items

Items in the diagram are exposed via its nodes and links members. nodes contains all DiagramNode -derived objects that have been added to the diagram, and links contains all DiagramLink objects. By iterating these arrays, you can access all diagram elements and apply common attributes to them:

JavaScript  Copy Code

// paint all nodes with light blue color
diagram.nodes.forEach(function (node)
{
    node.setBrush("lightBlue");
});

// set the links' arrowheads to triangles
diagram.links.forEach(function (link)
{
    link.setHeadShape("Triangle");
});

Individual items provide methods that let you access their related items in the diagram. DiagramNode exposes the links coming into or going out of nodes via the getIncomingLinks and getOutgoingLinks methods. The nodes connected by a link can be accessed by calling the getOrigin and getDestination methods of DiagramLink.

The component lets users select multiple diagram items of interest. The getSelection method of Diagram returns a Selection instance representing currently selected items. The Selection class provides nodes and links arrays containing respectively DiagramNode and DiagramLink -derived objects.