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
|