Org Chart Implementation


#1

Hi,
I was quite impressed with GO diagram for ASP.Net. I am currently need to draw an Org chart with data from an HR database. The structure is a simple Reports to structure. I have been able to add nodes to daigram though uable to layout the org chart

Any help wl be appreciated.


#2

At first I couldn’t understand what you meant, but when I tried the “Layout Chart” button in the OrgCharter sample, I also got some unexpected results.
But the Windows Forms OrgCharter application works just fine, even though all it’s all the same code.
I suspect the problem is due to drawing the links in the wrong direction, starting at the employee and going up to the supervisor. I found that I couldn’t draw (by mouse-down-and-drag) a second link coming out of a port, so I tried to start at the supervisee node. But apparently that doesn’t draw the link backwards, so the supervisee is put in a “layer” as if he were the boss.
I find if I use the “Select Two and Make Link” button to connect a supervisor and a supervisee, everything works well and the “Layout Chart” button produces good results.
If you can’t get good results by not drawing the links using “drag-and-drop”, then please describe the situation you have. In any case we’ll investigate making the ports work better–both in having the cursor showing the ports and in mouse-down at such points.


#3

Please add the following statement as the second line in the constructor of GraphDoc:
this.LinksLayer = this.Layers.CreateNewLayerBefore(this.Layers.Default);
Having the links in a layer behind the nodes makes it easier for a user to do a mouse-down on a port, instead of accidentally selecting the link itself.
Anyway, with this change, it is easy to construct org charts interactively using drag-and-drop to draw the relationships. And the “Layout Chart” button works well.


#4

Thanks for the quick reply…
Here is my predicament. I have an org structure in a database.
Assume an employee row with a numeric id field. A linking numeric field that refers the person he reports to. Now how I can create the nodes and link them. Also I need the graph laid out as follows

CEO

Director1 Director2

Manager1 Manager2 Manager1 Manager2

I need to create the nodes programatically and the link them together. and finally layout org chart intelligently....

Also this for an ASP.NET application though I would like to know where to get the 'Org Chart chapter' from.....


#5

Look at the org charter example in the example code distrubuted with the project. Also, you can create links between objects by creating an instance of a GoLink object, settings its top and bottom ports to equal the top and bottom ports of two nodes in your view, and adding it to your view.document.linkslayer.

Ryan


#6

Fixed the problem using the auto layout