Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram in tree layout (Read 2863 times)
vishnupriya
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 22nd, 2009
Diagram in tree layout
Dec 23rd, 2009 at 9:30am
Print Post  
Hi,

I am able to create the diagram in a tree layout. But the problem in my application is , the links are setting in "LeftInRightOut" . But I want to make it "TopInBottomOut".  I am using below line for the same.

node.AnchorPattern = AnchorPattern.TopInBottomOut;

But it is not working.

Can some one please le tme know how I can chagne the links, that will start at parent bottom center and ends with the child top center.

Thanks in advance ,
Vishnupriya

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram in tree layout
Reply #1 - Dec 23rd, 2009 at 10:11am
Print Post  
Hi,

Setting AnchorPattern does not automatically update existing links. You might try running TreeLayout again with its Anchoring property set to Reassign.

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


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 22nd, 2009
Re: Diagram in tree layout
Reply #2 - Dec 23rd, 2009 at 10:42am
Print Post  
Thanks Stoyan for the information.

I have tried out with the below code.
tl.Anchoring = Anchoring.Reassign;
           tl.Arrange(diagram1);

But this also not working. As I am new to this ,Can you please give me some more information.

Thanks & Regards,
Vishnupriya
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram in tree layout
Reply #3 - Dec 23rd, 2009 at 12:18pm
Print Post  
Have you set AnchorPattern to TopInBottomOut for all nodes before running the layout?
  
Back to top
 
IP Logged
 
vishnupriya
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 22nd, 2009
Re: Diagram in tree layout
Reply #4 - Dec 23rd, 2009 at 12:41pm
Print Post  
Hi, I am using the below code.

private void CreateDiagram()
{

diagram1.LinkCascadeOrientation = MindFusion.Diagramming.Orientation.Vertical;

diagram1.LinkStyle = LinkStyle.Bezier;
diagram1.LinkHeadShape = ArrowHead.BowArrow;
diagram1.LinkHeadShapeSize = 3;
diagram1.ShowAnchors = ShowAnchors.Always;

TableNode rootNode = new TableNode(diagram1);

MindFusion.Drawing.SolidBrush oBrush = new MindFusion.Drawing.SolidBrush(Color.LightGreen);
rootNode.Caption = "Brand(12)";
rootNode.Style = TableStyle.RoundedRectangle;
rootNode.ColumnCount = 3;
rootNode.Columns[0].Width = 25;
rootNode.Columns[1].Width = 13;
rootNode.Columns[2].Width = 12;
rootNode.RowCount = 2;
rootNode[0, 0].Text = "Sales $(M)";
rootNode[0, 1].Text = "Sales $ MAT (M)";
rootNode[1, 0].Text = "12345";

rootNode.Brush = oBrush;
rootNode.Bounds = new RectangleF(50, 15, 50, 20);
rootNode.Tag = 0;
diagram1.Nodes.Add(rootNode);

TableNode curNode = new TableNode(diagram1);

foreach (TreeNode node in trvAttributes.Nodes[0].Nodes)
{
curNode = addChild(rootNode, node, diagram1, oBrush);
foreach (TreeNode secNode in trvAttributes.Nodes[1].Nodes)
{
addChild(curNode, secNode, diagram1, oBrush);
}
}
if (tl == null)
{
tl = new TreeLayout(rootNode,
TreeLayoutType.Centered,
false,
TreeLayoutLinkType.Rounded,
TreeLayoutDirection.TopToBottom,
10, 5, true, new SizeF(10, 10));
}

tl.Anchoring = Anchoring.Reassign;
tl.Arrange(diagram1);

diagram1.ResizeToFitItems(5, true);
}

private TableNode addChild(TableNode rootNode, TreeNode attrNode, Diagram cdgrm, MindFusion.Drawing.SolidBrush brush)
{
TableNode childNode = new TableNode(cdgrm);

if (intLnk == 0)
{
intLnk = 1;
childNode.Bounds = new RectangleF(0, (rootNode.Bounds.Y + 100), 50, 20);
}
else
{
childNode.Bounds = new RectangleF(0, (rootNode.Bounds.Y + 100), 50, 20);
intLnk = 0;
}

childNode.Caption = "Brand : " + attrNode.Text + "(3)";
childNode.Style = TableStyle.RoundedRectangle;
childNode.ColumnCount = 3;
childNode.RowCount = 3;
childNode.Brush = brush;

childNode.Columns[0].Width = 25;
childNode.Columns[1].Width = 13;
childNode.Columns[2].Width = 12;
childNode[0, 0].Text = "Sales $(M)";
childNode[0, 1].Text = "Sales $ MAT (M)";

childNode.AttachTo(rootNode, AttachToNode.BottomLeft);
cdgrm.Nodes.Add(childNode);

DiagramLink link = new DiagramLink(cdgrm, rootNode, childNode);

rootNode.AnchorPattern = AnchorPattern.TopInBottomOut;
childNode.AnchorPattern = AnchorPattern.TopInBottomOut;
link.SnapToNodeBorder = false;
cdgrm.Links.Add(link);

return childNode;
}

}

Can you please let me know the way to do..?
Thanks,
Vishnupriya
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram in tree layout
Reply #5 - Dec 23rd, 2009 at 1:12pm
Print Post  
Try setting the tables' ConnectionStyle property = Table, otherwise the links might be connecting to the tables rows and ignoring the nodes' AnchorPattern (rows have their own AnchorPattern property).

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


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 22nd, 2009
Re: Diagram in tree layout
Reply #6 - Dec 23rd, 2009 at 1:19pm
Print Post  
Thank you very much Stoyan.

It worked.

Thanks & Regards,
Vishnupriya
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint