Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Database design Diagram (Read 4733 times)
JohnJay
YaBB Newbies
*
Offline



Posts: 3
Joined: Jun 23rd, 2009
Database design Diagram
Jun 25th, 2009 at 5:03pm
Print Post  
Hi

I want to create a diagram to show the structure of a database and show the relationships between the tables.

I have got most of the way but just need a bit of help on the arrangement of the tables.

I'ev tried the various auto layout techniques but can't quite get it right.

I can send sample project to show what I've got. (I couldn't work out how to attach a file!) You just need to set an appropriate SQL connection string in the config file.

Any clues would be helpful.

Thanks

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Database design Diagram
Reply #1 - Jun 26th, 2009 at 5:17am
Print Post  
Hi,

Please email the sample to support@mindfusion.eu.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Database design Diagram
Reply #2 - Jun 28th, 2009 at 10:44am
Print Post  
Hi,

Try the following methods.

Code
Select All
private void layout1()
{
	LayeredLayout layout = new LayeredLayout();
	layout.Orientation = MindFusion.Diagramming.Layout.Orientation.Vertical;
	layout.NodeDistance = 100;
	layout.IgnoreNodeSize = false;
	layout.Arrange(diagram1);

	foreach (DiagramLink link in diagram1.Links)
		ResetLink(link);
	diagram1.RouteAllLinks();

	diagram1.ResizeToFitItems(5);
	diagramView1.ZoomToFit();
}

private void layout2()
{
	AnnealLayout layout = new AnnealLayout();
	layout.SplitGraph = true;
	layout.Arrange(diagram1);

	foreach (DiagramLink link in diagram1.Links)
		ResetLink(link);
	diagram1.RouteAllLinks();

	diagram1.ResizeToFitItems(5);
	diagramView1.ZoomToFit();
}

private void layout3()
{
	GridLayout layout = new GridLayout();
	layout.SplitGraph = true;
	layout.GridSize = diagram1.Nodes[0].Bounds.Height * 1.6f;
	layout.Arrange(diagram1);

	foreach (DiagramLink link in diagram1.Links)
		ResetLink(link);
	diagram1.RouteAllLinks();

	diagram1.ResizeToFitItems(5);
	diagramView1.ZoomToFit();
}

private void ResetLink(DiagramLink link)
{
	link.AutoRoute = false;
	link.Style = LinkStyle.Polyline;
	link.SegmentCount = 1;
	link.OriginIndex = -1;
	link.DestinationIndex = -1;
	link.UpdateIntersections();
}
 



The results I'm getting when the connection string is set to the MS Pubs database are shown below.





Since you are not settings connections to specific rows in the test project you've sent us, I took the liberty to reset the links so they do not point to any row. This results in better starting and ending points for the links in the layout (the links were connected to row 3, closest to the table center, when using the default table connection style). If your actual application must display row connections, try the code from this post:

http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=123711413...

edit: note that there is some randomness in layout2 an dlayout3, so you might let your users run the code several times until they get a layout they like better.

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



Posts: 3
Joined: Jun 23rd, 2009
Re: Database design Diagram
Reply #3 - Jun 29th, 2009 at 9:39am
Print Post  
Thanks Stoyan

I've now got what I want.  I feel a purchase order will be coming your way shortly.


regards

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint