We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Slowness issue when having large number of the connectors

Hello Sir/Madam,

We are currently using the diagram feature in our web application to draw something like floor plan. We are using around 6000 node connectors to draw the floor map. The plotting process we have done successfully, but it is taking a lot of time to load the view on website. Below are the steps what we did,

1) Getting data from the service.
2) Doing basic operations on the data in the ngOnInit() of a component.
3) Drawing the nodes using *ngFor in the component.html file.

Do you have any idea/solution to get rid of this. Because we are facing slowness issue. Please help on this.

3 Replies

RT Ramya Thirugnanam Syncfusion Team July 17, 2019 10:55 AM UTC

Hi Siddharth,  
Please enable Virtualization Diagram Constraints in your sample as shown in below code example.  Also, we have created a sample in which we have rendered 6000 nodes and connectors.  
Code example:  
  <ejs-diagram #diagram id="diagram" width="100%" height="700px" [constraints]="constraints" [nodes]="nodes" [connectors]="connectors">   
public constraints: DiagramConstraints = DiagramConstraints.Default | DiagramConstraints.Virtualization;  
Ramya T  

SK Siddharth Kulat July 17, 2019 03:03 PM UTC

Hello Sir,

Thanks for the update. Actually I want to add only the e-connectors dynamically. Please look the below code snippet,

In app.component.html file,

      <e-connector *ngFor="let coordinates of finalCordinates" [sourcePoint]='{"x":coordinates.sourcePoint.sourcePointx,"y":coordinates.sourcePoint.sourcePointy}'
        [targetPoint]='{"x":coordinates.targetPoint.targetPointx,"y":coordinates.targetPoint.targetPointy}'  [style]='{  "strokeWidth": 2,"strokeColor": "#fff","fill": "transparent","strokeDashArray": "","opacity": 1,"gradient": {"type": "Straight"}}' [targetDecorator] = '{ shape: "None" }'>

Where the finalCordinates is my input array. It Contains 6000 entries and it is taking a lot of time to render.

I have tried your solution, but it is not working. It showing the error "invalid host/origin header" in the console. I am using Angular version 7, typescript version 3.2.4 respectively.

RT Ramya Thirugnanam Syncfusion Team July 22, 2019 01:05 PM UTC

Hi Siddharth,  
Thanks for your patience. 
We have applied your code in our sample to render 6000 connectors. Also, we have enabled Virtualization DiagramConstraints in the sample. The sample is working fine in our end. Could you please check in the below sample?  
Ramya T  

Live Chat Icon For mobile
Up arrow icon