Skip to main content

map()

Description​

Iterates through all items of the diagram

Usage​

map(callback: function): array;

Parameters​

  • callback - (required) a callback function that will be called for each item of a diagram

Returns​

The method returns a new array of items where each item is the result of the callback function

Example​

const diagram = new dhx.Diagram("diagram_container", {
type: "default"
});
diagram.data.parse(data);

//getting ids of all items of the diagram (shapes, links, groups, swimlanes)
diagram.data.map((item) => {
console.log(item.id);
});