layout in diagram

Hi,
I want to apply layout in my diagram and used below code

I have used:
TS: this.diagram.layout.type = 'RadialTree'; 

html: <ejs-diagram #diagram id="diagram" width="100%" height="700px" <./ejs-diagram>


It is not working.
please help

1 Reply

AR Aravind Ravi Syncfusion Team May 13, 2020 08:07 AM UTC

Hi Rakhi 
 
We have create a sample to automatically arrange nodes and connectors in the diagram after set layout in diagram. After you set layout in diagram call diagram public API method doLayout(). Do Layout method in diagram is used to arrange the nodes and connectors in diagram. In this sample on initial render we have display nodes and connector without layout. On button click we have set layout for diagram. Please find the below code snippet for how to use doLayout method in the diagram 
 
public click() { 
      this.diagram.layout.type = "RadialTree"; 
      this.diagram.layout.root = "Category"; 
      this.diagram.doLayout(); 
       
    } 
 
 
Regards 
Aravind Ravi 


Loader.
Up arrow icon