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

convertToDiagramModel

Updated on Oct 31, 2025

Converts input data to diagram model format using the provided mapping configuration.

This function takes raw input data and transforms it into a structured diagram model containing shapes and connections arrays. It uses the mapping configuration to extract data from the input and apply field mappings to create properly formatted ShapeOptions and ConnectionOptions objects.

typescript
const input = {
  items: [{ id: '1', name: 'Node 1', x: 100, y: 100 }],
  links: [{ from: '1', to: '2' }]
};

const mapping = {
  shapes: {
    source: 'items',
    map: { id: 'id', content: 'name', x: 'x', y: 'y' }
  },
  connections: {
    source: 'links',
    map: { from: 'from', to: 'to' }
  }
};

const result = convertToDiagramModel(input, mapping);
// Returns: { shapes: [...], connections: [...] }

Parameters

input

any

The raw input data object containing source data for shapes and connections
mapping

DiagramMapping

Configuration object defining how to extract and map data from input

Returns

ConvertResult

An object containing arrays of mapped shapes and connections ready for diagram rendering
Not finding the help you need?
Contact Support