Skip to main content

margin

Description

Optional. An object with settings of margins for positioning items in the diagram

Usage

margin?: {
itemX?: number,
itemY?: number,
x?: number,
y?: number,
};

Parameters

The margin object can include the following parameters:

  • itemX - (optional) horizontal space between two shapes (only for type: "org" | "mindmap")
  • itemY - (optional) vertical space between two shapes (only for type: "org" | "mindmap")
  • x - (optional) horizontal space between the start of a diagram and the first item
  • y - (optional) vertical space between the start of a diagram and the first item

Default config

margin: {
x: 40, y: 40,
itemX: 40, itemY: 40
}

Example

const diagram = new dhx.Diagram("diagram_container", {
type: "org",
margin: {
x: 20, y: 20,
itemX: 50, itemY: 50
}
});

Related sample: Diagram. Org chart mode. Margin between shapes