New to Kendo UI for AngularStart a free 30-day trial

Represents the Kendo UI Diagram component for Angular.

The Diagram component is used to create organizational charts, and other types of diagrams.

Definition

Package:@progress/kendo-angular-diagrams

Selector:kendo-diagram

Export Name:Accessible in templates as #kendoDiagramInstance="kendoDiagram"

Syntax:

html
<kendo-diagram [shapes]="shapesData"></kendo-diagram>

Inputs

Defines the default configuration options applicable to all connections.

Defines the field mapping configuration for connections data binding (see example). Maps source object properties to Diagram connection properties. Only used when connections is an array of custom objects instead of ConnectionOptions.

Defines the connections that render between the shapes in the Diagram (see Connections article). Accepts either an array of ConnectionOptions or an array of any objects that will be mapped using the connectionModelFields configuration.

Default:

[]

A set of settings to configure the Diagram behavior when the user attempts to drag, resize, or remove shapes. Changing the property value dynamically triggers a reinitialization of the Diagram.

Default:

true

Defines the layout configuration for arranging shapes and connections in the Diagram (see Layout article).

Enables keyboard navigation in the Diagram. When set to true, navigate between shapes using arrow keys. Alternatively, pass a DiagramNavigationOptions object to customize navigation behavior.

Default:

true

Defines the pannable options. Use this setting to disable Diagram pan or change the key that activates the pan behavior.

Default:

true

Defines the Diagram selection options.

By default, you can select shapes in the Diagram in one of two ways:

  • Clicking a single shape to select it and deselect any previously selected shapes.
  • Holding the Ctrl/Cmd on MacOS key while clicking multiple shapes to select them and any other shapes between them.

Use the selectable configuration to allow single selection only, enable selection by drawing a rectangular area with the mouse around shapes in the canvas, or disable selection altogether.

Default:

true

Defines the default configuration options applicable to all shapes.

Defines the field mapping configuration for shapes data binding (see example). Maps source object properties to Diagram shape properties. Only used when shapes is an array of custom objects instead of ShapeOptions.

shapes?

any[]

Defines the shapes that render in the Diagram (see Shapes article). Accepts either an array of ShapeOptions or an array of any objects that will be mapped using the shapeModelFields configuration.

Default:

[]

zoom?

number

Defines the zoom level of the Diagram.

Default:

1

zoomMax?

number

Defines the maximum zoom level of the Diagram.

Default:

2

zoomMin?

number

Defines the minimum zoom level of the Diagram.

Default:

0.1

zoomRate?

number

Defines the zoom rate of the Diagram.

Default:

0.1

Fields

The actual connections created by the Diagram.

The actual shapes created by the Diagram.

The currently selected items in the Diagram.

Events

Fires when a shape or connection is created or removed.

Fires when the user clicks on a shape or a connection.

Fires when the user drags an item.

Fires when the user stops dragging an item.

Fires when the user starts dragging an item.

Fires when the mouse pointer enters a shape or connection.

Fires when the mouse pointer leaves a shape or connection.

Fires when the user pans the Diagram.

Fires when the user selects one or more items.

Fires when the location or size of an item are changed.

Fires when a tooltip should be hidden.

Fires when a tooltip should shown for a shape or connection.

Fires when the Diagram has finished zooming out.

Fires when the Diagram starts zooming in or out.

Methods

Adds connection to the Diagram.

Parameters:connectionConnectionundoable?booleanReturns:

Connection

The newly created connection.

Adds shape to the Diagram.

Parameters:itemShapeOptions | Shape | Pointundoable?booleanReturns:

Shape

The newly created shape.

Aligns shapes in the specified direction.

Parameters:directionDirection

Gets the bounding rectangle of the given items.

Parameters:itemsShape | Connection | Shape | Connection[]origin?booleanReturns:

Rect

Bounding rectangle.

Bring into view the passed item(s) or rectangle.

Parameters:itemShape | Connection | Shape | Connection[] | Rectoptions?BringIntoViewOptions

Sends to back the passed items.

Parameters:itemsShape | Connection | Shape | Connection[]undoable?boolean

Brings to front the passed items.

Parameters:itemsShape | Connection | Shape | Connection[]undoable?boolean

Clears the Diagram.

Connects two items in the Diagram.

Parameters:sourceShape | Point | ConnectortargetShape | Point | Connectoroptions?ConnectionOptionsReturns:

Connection

The created connection.

Determines whether two shapes are connected.

Parameters:sourceShapetargetShapeReturns:

boolean

true if the two shapes are connected.

Copies selected items to clipboard.

Deselects the specified items or all items if no item is specified.

Parameters:items?Shape | Connection | Shape | Connection[]

Converts document coordinates to model coordinates.

Parameters:pointPointReturns:

any

Point in model coordinates.

Converts document coordinates to view coordinates.

Parameters:pointPointReturns:

Point

Point in view coordinates.

Exports the diagram's DOM visual representation for rendering or export purposes. Creates a clipped group containing the canvas content with proper transformations.

Returns:

Group

A drawing Group element containing the exported DOM visual

Exports the diagram's visual representation with proper scaling based on zoom level. Creates a scaled group containing the main layer content.

Returns:

Group

A drawing Group element containing the exported visual with inverse zoom scaling

Focuses the Diagram.

Returns:

boolean

true if focus was set successfully.

Gets a shape on the basis of its identifier.

Parameters:idstringReturns:

Shape

The shape with the specified ID.

Provides the current Diagram's shapes and connections that can be used to create a new Diagram when needed.

Returns:

DiagramState

Object containing shapes and connections arrays.

Converts layer coordinates to model coordinates.

Parameters:pointPointReturns:

any

Point in model coordinates.

Converts model coordinates to document coordinates.

Parameters:pointPointReturns:

Point

Point in document coordinates.

Converts model coordinates to layer coordinates.

Parameters:pointPointReturns:

any

Point in layer coordinates.

Converts model coordinates to view coordinates.

Parameters:pointPointReturns:

any

Point in view coordinates.

Pastes items from clipboard.

Executes the previous undoable action on top of the redo stack if any.

Removes shape(s) and/or connection(s) from the Diagram.

Parameters:itemsShape | Connection | Shape | Connection[]undoable?boolean

Selects items on the basis of the given input.

Parameters:itemsShape | Connection | Shape | Connection[]options?SelectionOptionsReturns:

Shape | Connection[]

Array of selected items.

Selects all items in the Diagram.

Selects items in the specified area.

Parameters:rectRect

Rectangle area to select.

Executes the next undoable action on top of the undo stack if any.

Gets the current Diagram viewport rectangle.

Returns:

Rect

Viewport rectangle.

Converts view coordinates to document coordinates.

Parameters:pointPointReturns:

Point

Point in document coordinates.

Converts view coordinates to model coordinates.

Parameters:pointPointReturns:

any

Point in model coordinates.