Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic generating FlowChartDiagramm from SQL-Data (Read 4152 times)
Dunkelelb
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Apr 24th, 2007
generating FlowChartDiagramm from SQL-Data
Apr 24th, 2007 at 12:10pm
Print Post  
hello,

I got a SQL-Table with some entries belonging state and connection informations in several columns.

I already importet the nodes. Now I'd like to organize
the connections. Have you some hints which way I should choose to reach that?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: generating FlowChartDiagramm from SQL-Data
Reply #1 - Apr 24th, 2007 at 12:41pm
Print Post  
Hello,

Do you ask how to import the connections, or how to arrange the diagram once they are imported?

In order to create the connections, you might assign the node ID in the database to the Box.Tag property. Run a second loop over the node records, and for each related node ID you have for a node, call CreateArrow(node, FlowChart.FindBox(relatedID)). If you already use the Tags to store other information, save the relations in a Hashtable.

To arrange the diagram, use some of the layout algorithm classes, e.g. LayeredLayout.

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


I love YaBB 1G - SP1!

Posts: 19
Joined: Apr 24th, 2007
Re: generating FlowChartDiagramm from SQL-Data
Reply #2 - Apr 25th, 2007 at 6:43am
Print Post  
thanks,

I beleave, thats enough Information for the moment
  
Back to top
 
IP Logged
 
macleon
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jun 20th, 2007
Re: generating FlowChartDiagramm from SQL-Data
Reply #3 - Jun 20th, 2007 at 7:08pm
Print Post  
Dear Mr. Stoyan,

Do you have a sample done in c Sharp. I'm really having problem loading / binding the database from to creat tree diagram. I'm using mysql database buts that  nots a problem as I already manipulate it, but don't really quite sure on how or what type of db structure it support and how to connect them. Sorry for I am really a beginner.

Thanks for the help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: generating FlowChartDiagramm from SQL-Data
Reply #4 - Jun 21st, 2007 at 5:41am
Print Post  
Here is a small example:

[code]
Hashtable childToParent = new Hashtable();

SqlCommand cmd = new SqlCommand();
cmd.Connection = conn1;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT * FROM dbo.TreeNodes";
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
     Box node = fc.CreateBox(0, 0, 40, 30);

     int nodeID = reader.GetInt32(0);
     node.Text = reader.GetString(1);
     int parentID = reader.GetInt32(2);

     node.Tag = nodeID;
     childToParent[nodeID] = parentID;
}

foreach (Box b in fc.Boxes)
{
     if  (!childToParent.ContainsKey(b.Tag))
           continue;

     fc.CreateArrow(
           fc.FindBox(childToParent[b.Tag]), b);
}

TreeLayout tl = new TreeLayout();
tl.Arrange(fc);
[/code]

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


I love YaBB 1G - SP1!

Posts: 3
Joined: Jun 20th, 2007
Re: generating FlowChartDiagramm from SQL-Data
Reply #5 - Jun 21st, 2007 at 2:23pm
Print Post  
Thank you for your quick reply.
These code really help me, even not what actually I wanted yet but I'm heading the right directions.

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