convertToDiagramModel
Function
Definition
Package:@progress/kendo-angular-diagrams
Syntax:
TS
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: [...] }
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.
Parameters:inputany
The raw input data object containing source data for shapes and connections
mappingDiagramMappingConfiguration object defining how to extract and map data from input
Returns:An object containing arrays of mapped shapes and connections ready for diagram rendering