Free C# .NET Library for Interactive & Customizable Diagrams
A Powerful Open Source Free C# .NET Diagramming Library to Create & Manage Interactive Diagrams, Charts, and Graphs, Convert diagram to image with ease.
What is GoDiagram Library?
Creating engaging and visually appealing diagrams in software development can be challenging. Whether you’re designing a flowchart, organizational chart, or any diagram-centric project, having a reliable library is crucial. This is where GoDiagram, a .NET library, comes into play. GoDiagram serves as a powerful resource for .NET developers, providing a variety of tools to simplify the process of designing and personalizing interactive diagrams in Windows Forms and WPF applications. With GoDiagram, you can develop applications for different purposes such as designing business processes and illustrating network structures. This tool offers a range of diagram elements, such as nodes, links, and groups that you can customize to meet your needs. Additionally, it includes layout algorithms that help you arrange nodes and links in an attractive manner effortlessly.
Imagine having the power to create unique and interactive diagrams tailored to your needs. Thanks to GoDiagram, a versatile .NET tool, developers like you can now do just that. Crafted by Northwoods Software, a trusted name in diagram solutions, this library provides a range of features. It gives you the tools you need to build diagram applications seamlessly on Windows Forms and WPF platforms. The main aim is to streamline the development process, making it simple for you to create, edit, and manage diagrams with ease. Whether you are working on a project that involves creating diagrams for your job, academic pursuits, or any other field, GoDiagram can simplify the process and cater to your specific needs. Why not give it a try, explore its capabilities, and discover the potential of using diagrams in your .NET projects?
Getting Started with GoDiagram
The recommend way to install GoDiagram is using NuGet. Please use the following command for a smooth installation.
Install GoDiagram via NuGet
Install-Package Northwoods.GoDiagram.WinForms -Version 10.0.6
Create a Simple Diagram via C# API
The open source GoDiagram library has included compete support for creating a new diagram from the scratch and manage its properties inside C# applications. It supports creating various types of diagrams, such as Flowchart, State Chart, Organizational Chart, Block Diagram, Pert Chart, Visual Tree, and many more. Here is an a simple example that demonstrates how software developers can create a basic diagram using C# .NET commands. It is also very easy to customize and extend the diagram as needed.
How to Generate a Basic Diagram with a Single Node inside C# Apps?
// Create a GoView control
GoView myView = new GoView();
// Add it to your Windows Forms or WPF application
// Create a node
GoBasicNode myNode = new GoBasicNode();
myNode.Text = "My Node";
// Add the node to the view
myView.Document.Add(myNode);
Convert Diagram to Image via C# Library
The GoDiagram library gives software developers the power to convert an existing diagram to different types of image formats inside .NET applications. The library has provided two methods for creating images from diagrams, the first one generate Base64 image data string and the second method generate new image with the image data as its source. The following example shows how to convert an existing diagram to a PNG image format. You can easily customize the export format and file path as needed for your specific use case.
How to Convert a Diagram to Image Format using .NET Library?
using System;
namespace GoDiagramToImage
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
InitializeGoDiagram();
}
private void InitializeGoDiagram()
{
// Create a GoView control and add it to the form
GoView goView = new GoView();
goView.Dock = DockStyle.Fill;
Controls.Add(goView);
// Load a sample diagram from a file (you can load your own diagram here)
goView.Document.Clear();
goView.Document.Add(new GoBasicNode() { Location = new PointF(100, 100), Text = "Sample Node 1" });
goView.Document.Add(new GoBasicNode() { Location = new PointF(300, 100), Text = "Sample Node 2" });
goView.Document.Add(new GoLink() { FromPort = goView.Document[0].BottomPort, ToPort = goView.Document[1].TopPort });
// Optional: Perform an automatic layout to arrange the diagram nicely
goView.Document.Layout = new GoLayoutForceDirected();
}
private void exportButton_Click(object sender, EventArgs e)
{
// Create a Bitmap to render the diagram
Bitmap diagramImage = new Bitmap(goView.ClientSize.Width, goView.ClientSize.Height);
Graphics graphics = Graphics.FromImage(diagramImage);
// Render the diagram onto the Bitmap
goView.DrawView(graphics);
// Save the Bitmap as an image file (e.g., PNG)
diagramImage.Save("Diagram.png", System.Drawing.Imaging.ImageFormat.Png);
// Clean up resources
graphics.Dispose();
diagramImage.Dispose();
}
}
}
Versatile Node/Link Types & Serialization Support
The GoDiagram library offers a variety of built-in node and link types, including simple shapes, text labels, and custom elements. You can easily create and customize these elements to represent data or concepts in your application. Whether you need to draw flowcharts, organizational charts, or any other type of diagram, the library has you covered. Moreover, the library also allows users to save and load diagrams to and from various formats, including XML, binary, and image files. This feature makes it easy to persist user-created diagrams and share them across different platforms.