Search
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
for (var node of diagram.nodes)
{
    node.brush = "lightBlue";
}

// set the links' arrowheads to triangles
for (var link of diagram.links)
{
    link.headShape = "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 incomingLinks and outgoingLinks properties. The nodes connected by a link can be accessed by means of the origin and destination properties of DiagramLink.

The component lets users select multiple diagram items of interest. The selection 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.