I noticed that Visual Studio can generate graphs using something called DGML.
I would like to generate a graph like the following one in my C# application.
It does not have to be interactive like the VS. I just want to generate a static such image and save it as a general graphics file, such as PNG.
Is there any free .NET library for this?
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
A little late, but it's actually relatively easy to implement yourself:
public class DGMLWriter { public struct Graph { public Node[] Nodes; public Link[] Links; } public struct Node { [XmlAttribute] public string Id; [XmlAttribute] public string Label; public Node(string id, string label) { this.Id = id; this.Label = label; } } public struct Link { [XmlAttribute] public string Source; [XmlAttribute] public string Target; [XmlAttribute] public string Label; public Link(string source, string target, string label) { this.Source = source; this.Target = target; this.Label = label; } } public List<Node> Nodes { get; protected set; } public List<Link> Links { get; protected set; } public DGMLWriter() { Nodes = new List<Node>(); Links = new List<Link>(); } public void AddNode(Node n) { this.Nodes.Add(n); } public void AddLink(Link l) { this.Links.Add(l); } public void Serialize(string xmlpath) { Graph g = new Graph(); g.Nodes = this.Nodes.ToArray(); g.Links = this.Links.ToArray(); XmlRootAttribute root = new XmlRootAttribute("DirectedGraph"); root.Namespace = "http://schemas.microsoft.com/vs/2009/dgml"; XmlSerializer serializer = new XmlSerializer(typeof(Graph), root); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; using (XmlWriter xmlWriter = XmlWriter.Create(xmlpath, settings)) { serializer.Serialize(xmlWriter, g); } } }
I have used NodeXL in the past, for generating workflow graphs within a web application, but it is suitable for desktop applications and interaction as well.
The description might confuse you a bit, making you think it's just for Excel. Not at all, you can use it's object model directly and graph whatever you want from .NET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With