After installing Diagram, you can initialize in on a page and provide the desired configuration.
The minimum configuration required to start working with Diagram is the following:
webix.ui({
view:"diagram",
data: [
{ id:"1", value:"Managing Director"},
{ id:"1.1", value:"Base Manager"},
{ id:"1.1.1", value:"Store Manager" },
// other blocks
],
links: [
{ source:"1", target:"1.1"},
{ source:"1.1", target:"1.1.1"},
// other links
],
// ...
});
Related sample: Diagram: Basic
The data property stores a flat array of block items that are to be rendered on the chart. Meanwhile the links array stores the connectors (links) between these block items.
Diagram can work with the JSON and XML formats, but keep in mind that, if the incoming data are in XML, you need to specify the datatype property passing "xml" as its value:
webix.ui({
view:"diagram",
datatype: "xml", data: "remote/data.xml",
links: "remote/links.xml",
// ...
});
Below you can find main configuration properties of Diagram:
See the full list of available properties in the API reference.
Block items are defined in the data array or loaded from the remote source specified in the url property. Each block is an object with the following fields:
You can configure each block individually (e.g. inside the data array) or provide common settings for all blocks at once via the item property of Diagram:
webix.ui({
view:"diagram",
links: [/* link objects */],
item: {
width: 70,
height: 30,
// define commom config for all blocks
type: "action",
css: "myCss",
}
});
Note, that by default a block is a simple rectangle with no styling or SVG shape:
Read on how to utilize built-in shapes, style them or create custom ones in the dedicated article.
Back to top