Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) TreeLayout with Levels (Read 11626 times)
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
TreeLayout with Levels
Jul 16th, 2008 at 9:39am
Print Post  
I have to draw a position wise organization chart.
Each position holds one and only one employee and each position also have a level
(1-7).

Each position has a parent position except the top most position.

One position can have child positions from its same level and from any level below it.
Required organization chart should be in tree layout showing all the positions with same level in one group.

I am attaching a sample layout that I want to generate

Is it possible? If yes then please provide with source code (vb.net)

More Info:
I am using tablenode with 8 rows and 1 column to represent a node in organization chart
  

Regards&&Manoj
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #1 - Jul 16th, 2008 at 12:33pm
Print Post  
Hi,

If you want to use the built-in TreeLayout class in this case, you will have to insert some invisible/temporary nodes, so that each leaf node has ancestors in every level above the leaf. Otherwise, I suppose t shouldn't be hard to arrange them yourself using a recursive function that tracks the current level.

Stoyan
  
Back to top
 
IP Logged
 
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #2 - Jul 17th, 2008 at 12:13am
Print Post  
Is it possible to first use the tree layout then push the tablenodes down depending upon its level?

How to get the left,top coordinate of the treenode?

Thanks & Regards
Manu
  

Regards&&Manoj
Back to top
 
IP Logged
 
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #3 - Jul 17th, 2008 at 2:35am
Print Post  
after implementing the tree layout if i hide any of the tree node item (item.visible=false) then the chart looses its layout, links are broke n its mess.

Regards
Manoj
  

Regards&&Manoj
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #4 - Jul 17th, 2008 at 8:09am
Print Post  
Regarding pushing down the nodes, I suppose that might work. Try moving each top-most node in a level to the beginning of the level, and apply TreeLayout with Root set to that node. Do that recursively starting from level 1 and you should get the layout you need. The recursive method should take a 'DiagramNode root' and 'int level' arguments. Each time it is called, apply a TreeLayout with the specified root, and find the first descendants at 'level + 1'. Call the method recursively for each of these descendants.

Stoyan
  
Back to top
 
IP Logged
 
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #5 - Jul 18th, 2008 at 5:50am
Print Post  
After applying the treelayout. I am trying to push down the treenodes depending upon the level they belong to.
Node are pushed down perfectly but the links (Outgoing links from the pushed down node) are not pushed down, whereas (Incoming links are fine)
Please help........

for this i am using following code:

For Each item As DiagramNode In DG.Nodes
If TypeOf item Is TableNode Then
Dim n As TableNode = CType(item, TableNode)

Dim sizeF As RectangleF = item.Bounds
Dim x As Integer = sizeF.X
Dim y As Integer = sizeF.Y

Dim nDistanceToPush As Integer = y
'Some calculation to get how much to push down

y = nDistanceToPush
item.Move(x, y)
End If
Next
  

Regards&&Manoj
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #6 - Jul 18th, 2008 at 9:43am
Print Post  
After pushing down the top-most node in a level, apply TreeLayout again with the following settings:

.Root = item
.KeepRootPosition = true

This will push down the child nodes and arrange the links.

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


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #7 - Jul 21st, 2008 at 8:13am
Print Post  
This solution is not going to solve my problem.
I found you have a containernode object.

Can i use the containernode object to group all nodes in one level.

I tried to do this but it had no effect/change in the output.

Is it possible to do in this way.
Please help.........

I used following code:

For nLevel As Integer = 1 To 7
Dim nodeContainer As ContainerNode = Nothing

For Each item As DiagramNode In DG.Nodes
If TypeOf item Is TableNode Then
Dim n As TableNode = CType(item, TableNode)
If n.Tag IsNot Nothing Then
Dim sTags() As String = n.Tag.ToString.Split(","c)
Dim sNodePos As String = sTags(0)
Dim sNodeLevel As String = sTags(1)

If sNodeLevel = nLevel Then
If nodeContainer Is Nothing Then
nodeContainer = New ContainerNode(DG)
End If
nodeContainer.Add(item)
End If
End If
End If
Next
If nodeContainer IsNot Nothing Then
nodeContainer.Foldable = True
nodeContainer.Folded = False
nodeContainer.Caption = "Level " & nLevel.ToString
nodeContainer.ShadowColor = drawing.Color.AliceBlue
nodeContainer.Visible = True
End If
Next
  

Regards&&Manoj
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #8 - Jul 21st, 2008 at 8:56am
Print Post  
ContainerNodes won't help. FlowLayout lets you assign nodes to lanes, I will check if it can arrange the nodes as in your screenshot.

Stoyan
  
Back to top
 
IP Logged
 
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #9 - Jul 22nd, 2008 at 5:52am
Print Post  
when diagram is exported in Visio its all color formatting is lost where as when exported to PDF its fine.

Please help

Regards
Manoj
  

Regards&&Manoj
Back to top
 
IP Logged
 
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #10 - Jul 22nd, 2008 at 7:59am
Print Post  
Can we achieve the required layout with flowchart.NET control.


  

Regards&&Manoj
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #11 - Jul 22nd, 2008 at 10:43am
Print Post  
FlowChart.NET and NetDiagram provide the same layout classes. I will send you some code for the layout in a few days.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #12 - Jul 22nd, 2008 at 1:09pm
Print Post  
What color properties exactly are lost when exporting to Visio?
  
Back to top
 
IP Logged
 
manu
YaBB Newbies
*
Offline


Manu bhai moter chale
pum pum pum...

Posts: 25
Location: Japan
Joined: May 25th, 2008
Re: TreeLayout with Levels
Reply #13 - Jul 23rd, 2008 at 2:19am
Print Post  
I am using following code to give different background to table captions

newTableNode.CaptionBackBrush = New MindFusion.Drawing.SolidBrush(Color.FromArgb(248, 113, 60))

but when exported to visio this color is lost i.e table caption has no background color.

Other then colors following formatting are lost:
1. Table border color and row line colors
2. Rounded rectangle node loose their rounded corners


Regards
Manoj
« Last Edit: Jul 23rd, 2008 at 5:21am by manu »  

Regards&&Manoj
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout with Levels
Reply #14 - Jul 23rd, 2008 at 8:16am
Print Post  
Try exporting to Visio with ExportTablesAsGroups = true.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint