UDraw(Graph) is a free software which we can use to generate graphs.After creating a graph it creates a file call fileName.udg with a specific format.
Example Image :
Download Software
We can use a XML file to create above graph through C# code.
Sample XML File :
Code to display the graph :
DataSet dsUDG = new DataSet();
dsUDG.ReadXml("Services.xml");
DataRow []servOprs = dsUDG.Tables["ServiceOperation"].Select("ServiceName = 'Flooring'");
StreamWriter sw = new StreamWriter("servOprs.udg");
sw.WriteLine("[l");
for(int i = 0;i < servOprs.Length;i++)
{
if(servOprs[i]["ParentServOprsID"].ToString() != "ROOT")
{
DataRow []temp = dsUDG.Tables["ServiceOperation"].Select("ServOprsID = '"+servOprs[i]["ParentServOprsID"].ToString()+"'");
if(i != 0)
{
sw.WriteLine("l("+va+"_"+servOprs[i]["OperationName"].ToString()+va+",n("+va+"node"+va+",[a("+va+"_GO"+va+","+va+"ellipse"+va+"),a("+va+"OBJECT"+va+","+va+servOprs[i]["OperationName"].ToString()+va+"),a("+va+"COLOR"+va+","+va+"lightred"+va+"),a("+va+"INFO"+va+","+va+va+")],");
}
else
{
sw.WriteLine("("+va+"_"+servOprs[i]["OperationName"].ToString()+va+",n("+va+"node"+va+",[a("+va+"_GO"+va+","+va+"ellipse"+va+"),a("+va+"OBJECT"+va+","+va+servOprs[i]["OperationName"].ToString()+va+"),a("+va+"COLOR"+va+","+va+"lightred"+va+"),a("+va+"INFO"+va+","+va+va+")],");
}
if(temp.Length != 0)
{
sw.WriteLine("[l("+va+"@"+servOprs[i]["OperationName"].ToString()+va+",e("+va+"edge"+va+",[a("+va+"EDGEPATTERN"+va+","+va+"single;solid;1;0"+va+"),a("+va+"OBJECT"+va+","+va+va+"),a("+va+"FONTSTYLE"+va+","+va+"bold"+va+"),a("+va+"INFO"+va+","+va+va+")],");
}
}
else
{
sw.WriteLine("l("+va+"_"+servOprs[i]["OperationName"].ToString()+va+",n("+va+"node"+va+",[a("+va+"_GO"+va+","+va+"ellipse"+va+"),a("+va+"OBJECT"+va+","+va+servOprs[i]["OperationName"].ToString()+va+"),a("+va+"COLOR"+va+","+va+"lightblue"+va+"),a("+va+"INFO"+va+","+va+va+")],[]");
}
}
for(int k = 0;k < servOprs.Length-1;k++)
{
sw.WriteLine("))))]");
}
sw.WriteLine("))]");
sw.Close();
Tuesday, October 10, 2006
Create Graphs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment