parse

loads data from a local data source

void parse(any data);

Parameters

dataanythe data to load

Example

var data = [
    {
        id: "1",
        text: "Chairman & CEO",
        title: "Henry Bennett",
        img: "../common/img/avatar-1.png"
    },
    {
        id: "2",
        text: "Manager",
        title: "Mildred Kim",
        img: "../common/img/avatar-2.png"
    },
    {
        id: "3",
        text: "Technical Director",
        title: "Jerry Wagner",
        img: "../common/img/avatar-3.png"
    },
    { id: "1-2", from: "1", to: "2", type: "line" },
    { id: "1-3", from: "1", to: "3", type: "line" }
];
 
var diagram = new dhx.Diagram("diagram_container", { type: "org" });
diagram.data.parse(data);

Related samples

Details

You can load data in any supported data format.

For now, Diagram supports two JSON formats:

  • shapes and links
  • shapes only (for Org Chart, in this case links are specified via the parent attribute in the shapes objects and autogenerated)

Read more about the ways of setting connection between links for Org Chart and Diagram.

See also
Back to top