Articles in this section

How to change node and connector shape of the Angular Diagram dynamically?

The Syncfusion Angular Diagram control provides support for adding various shapes to Nodes and Connectors. These shapes are categorized as follows:

Node Shapes:

  • Node shapes
  • Text node
  • Image node
  • HTML node
  • Native node
  • Basic shapes
  • Flow shapes
  • Bpmn shapes
  • UML diagram shapes

Connector Types:
The Diagram supports different connector types, including:

  • Straight
  • Orthogonal
  • Bezier

Additionally, connectors of distinct shapes are available for different Node shapes. Specific connector shapes are applicable to BPMN Flow lines, and UML Relationships and UML class connectors.

To change the shape of the node or Connector dynamically at run time with the button click refer the code below


<input type="button" value="shape change" (click)="shapeChange()" id="show" />

<ejs-diagram #diagram id="diagram" width="100%" height="600" [nodes]="nodes" [connectors]="connectors"
   [getConnectorDefaults]='getConnectorDefaults'
   (created)='create($event)' [getNodeDefaults]='getNodeDefaults'>
</ejs-diagram>

public shapeChange() {
   for (let i = 0; i < this.diagram.nodes.length; i++) {
     let node = this.diagram.nodes[i];
     node.shape = {
       type: 'Flow',
       shape: 'Decision'
     }
   }
   this.diagram.dataBind();
   for (let i = 0; i < this.diagram.connectors.length; i++) {
     let connector = this.diagram.connectors[i];
     connector.type = 'Bezier';
   }
 }

You can find a working example of this implementation in the provided sample on StackBlitz.

Sample

Conclusion

Hope you enjoyed learning about how to change node and connector shape of the Angular Diagram dynamically.

You can refer to our Angular Diagram feature tour page to learn about its other groundbreaking feature representations. You can explore our Angular Diagram documentation to understand how to present and manipulate data.

For current customers, you can check out our Angular components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our Angular Diagram and other Angular components.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied