Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) How to add links to dynamically added nodes (Read 6745 times)
smita
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 22nd, 2014
How to add links to dynamically added nodes
Apr 22nd, 2014 at 9:56am
Print Post  
Hi,

I am trying to add nodes dynamically and want to link them and see how auto layout works for large number of nodes

Used below code to add nodes dynamically

  for (int i = 0; i < 500; i++)
            {
                ShapeNode node = new ShapeNode();               
                node.Shape = Shapes.Rectangle;
                node.Visible = true;
                node.Id = "node" + i;
                node.Text = "This is node : " + i;
                DiagramView1.Diagram.Nodes.Add(node);
                           
            }

It is adding nodes but all nodes are not visible.
Now I want them to link but not able to find sample which shows how to link dynamically added nodes

Are there any samples which will guide me, I also want to apply layout to them.


Smita.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add links to dynamically added nodes
Reply #1 - Apr 22nd, 2014 at 11:02am
Print Post  
Hi,

Quote:
It is adding nodes but all nodes are not visible.


All of them will be placed at a (0,0,20,20) rectangle by default and overlap.

Quote:
Now I want them to link but not able to find sample which shows how to link dynamically added nodes


Call diagram.Factory.CreateDiagramLink(node1, node2);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
smita
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 22nd, 2014
Re: How to add links to dynamically added nodes
Reply #2 - Apr 22nd, 2014 at 11:36am
Print Post  
Hi,

I could add link using FindNodeById to all nodes added but diagram shows "Trial Version" as node text and only 15 nodes are visible even after giving layout

It must be limitation of trial version, Can I get extended trial version so that I can evaluate tool in better way?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add links to dynamically added nodes
Reply #3 - Apr 22nd, 2014 at 11:45am
Print Post  
Hi,

Quote:
only 15 nodes are visible even after giving layout


Layout classes do not change diagram.Bounds automatically so the nodes might be moved outside of current boundaries. Call diagram.ResizeToFitItems after Arrange to fix that.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
smita
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 22nd, 2014
Re: How to add links to dynamically added nodes
Reply #4 - Apr 22nd, 2014 at 12:56pm
Print Post  
Thanks for the reply

It worked

1 question about client side mode, when I use JavaApplet as a client side mode, I am not able to view the web page it opens and closes immediately

  
Back to top
 
IP Logged
 
smita
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 22nd, 2014
Re: How to add links to dynamically added nodes
Reply #5 - Apr 22nd, 2014 at 1:10pm
Print Post  
What is the maximum limit of nodes can be added to diagram and use the layout functionality effectively

I tried adding 1200+ nodes and the diagram is not showing any node, till 1200 it worked well
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add links to dynamically added nodes
Reply #6 - Apr 22nd, 2014 at 1:54pm
Print Post  
You might be reaching the default memory limit of applets if using JavaApplet mode. The 1200 nodes do not take that much memory themselves, but the XML deserialization done when loading diagrams sent from server might need more. Try setting DiagramView.JavaArguments="-Xmx512m" or a larger number to allocate more memory to the applet.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
smita
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 22nd, 2014
Re: How to add links to dynamically added nodes
Reply #7 - May 7th, 2014 at 9:35am
Print Post  
I am using ImageMap mode and able to view nodes.
I am trying to export it to VISIO with below code

MindFusion.Diagramming.Export.VisioExporter VISI = new MindFusion.Diagramming.Export.VisioExporter();

String path1 = Server.MapPath(@"~\VISIO\") + Session.SessionID + ".VSDX";
VISI.Export(DiagramView1.Diagram, path1);

and getting error "Could not find file C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\VisioExport.vxt'

from where can I get this file?





  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add links to dynamically added nodes
Reply #8 - May 7th, 2014 at 10:16am
Print Post  
You can find it in \program files\mindfusion ... \redistributable folder. Copy it to your site and set the TemplatePath property to point to its location.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
smita
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Apr 22nd, 2014
Re: How to add links to dynamically added nodes
Reply #9 - May 7th, 2014 at 11:21am
Print Post  
Thanks for help
Could export to VISIO but exported file when opened in VISIO does not show diagram if node count is on higher side

Also about layout option, When I use TreeLayout it works for large number of objects but does not show diagram when applied FlowchartLayout

I have used below code, am I missing something?
                MindFusion.Diagramming.Layout.FlowchartLayout ll = new MindFusion.Diagramming.Layout.FlowchartLayout();
ll.NodeDistance = 6;
ll.Orientation = MindFusion.Diagramming.Layout.Orientation.Vertical;

ll.Arrange(DiagramView1.Diagram);
DiagramView1.Diagram.ResizeToFitItems(10);




  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to add links to dynamically added nodes
Reply #10 - May 7th, 2014 at 1:58pm
Print Post  
Are there any errors or warnings shown by Visio when opening the large exported file?

FlowchartLayout might need a larger layout area than TreeLayout, and could cause ImageMap mode to reach the maximum bitmap size supported by GDI+, which should show an exception in Visual Studio console. Try setting the DiagramView.MaxImageSize property to make the control split the diagram image into smaller bitmaps.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint