Skip to content
Create DOT diagram using C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources
.gitignore
LICENSE Initial commit Oct 8, 2017
README.md Readme doc fix Mar 22, 2019

README.md

DotNetGraph

Create DOT/GraphViz diagram using C# / .Net

Available on NuGet: #

Documentation

Create a graph (DotGraph)

var graph = new DotGraph("MyGraph");

var directedGraph = new DotGraph("MyDirectedGraph", true);

Create and add a node (DotNode)

var myNode = new DotNode("MyNode") {
    // Set all available properties
    Shape = DotNodeShape.Ellipse,
    Label = "My node !",
    FillColor = DotColor.Lightgrey,
    FontColor = DotColor.Black,
    Style = DotNodeStyle.Default,
    Height = 0.5f
};

// Add the node to the graph
graph.Add(myNode);

Create and add an arrow (DotArrow)

// Create an arrow with node names
var myArrow = new DotArrow("myNode1", "myNode2");

// Create an arrow with node objects
var myArrow = new DotArrow(myNode1, myNode2) {
    // Set all available properties
    ArrowHeadShape = DotArrowShape.Normal;
};

// Add the arrow to the graph
graph.Add(myArrow);

Compile to DOT format

// Indented version
var dot = graph.Compile(false);

// Minified version
var dot = graph.Compile();

// Save it to a file
File.WriteAllText("myFile.dot", dot);
You can’t perform that action at this time.