https://github.com/victor-wiki/orgchart
Draw organization chart
https://github.com/victor-wiki/orgchart
chart diagram image org organization orgchart tree
Last synced: about 1 year ago
JSON representation
Draw organization chart
- Host: GitHub
- URL: https://github.com/victor-wiki/orgchart
- Owner: victor-wiki
- Created: 2019-02-26T08:59:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-04T01:59:14.000Z (over 3 years ago)
- Last Synced: 2025-04-10T11:05:05.372Z (about 1 year ago)
- Topics: chart, diagram, image, org, organization, orgchart, tree
- Language: C#
- Size: 25.4 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OrgChart
Draw organization chart, refer to https://www.codeproject.com/Articles/18378/Organization-Chart-Generator. In addition, it handles overloap
of nodes , and it can set auto height/width according to the content of a node.
# Sample

# Usage
```
static void Main(string[] args)
{
OrgChartOption defaultOption = new OrgChartOption
{
BoxFillColor = ColorTranslator.FromHtml("#A7E7FC"),
BoxBorderColor = ColorTranslator.FromHtml("#A7E7FC"),
ConnectLineColor = ColorTranslator.FromHtml("#424242")
};
OrgChartOption option = new OrgChartOption()
{
BoxFillColor = defaultOption.BoxFillColor,
BoxBorderColor = defaultOption.BoxBorderColor,
ConnectLineColor = defaultOption.ConnectLineColor,
FontSize = 9,
HorizontalSpace = 10,
VerticalSpace=20,
BoxHeight=45,
BoxWidth = 110,
//UseMinBoxWidthWhenHasOnlyOne = true,
//MinBoxWidth = 80
};
OrgChartGenerator orgChartGenerator = new OrgChartGenerator(GetOrgChartNodes(), option) { DefaultOption = defaultOption };
string filePath = "org.png";
using (FileStream fs = File.Create(filePath))
{
MemoryStream ms = orgChartGenerator.Generate();
ms.WriteTo(fs);
fs.Flush();
} ;
Process.Start(filePath);
}
private static List GetOrgChartNodes()
{
List nodes = new List();
nodes.Add(new OrgChartNode("0", "President",
new OrgChartNode("1.1", "Vice President Account Services",
new OrgChartNode("1.1.1", "Account Supervisor A",
new OrgChartNode("1.1.1.1", "Account Executive A"),
new OrgChartNode("1.1.1.2", "Account Executive B")
),
new OrgChartNode("1.1.2", "Account Supervisor B")
),
new OrgChartNode("1.2", "Vice President Creative Services",
new OrgChartNode("1.2.1", "Art/Copy"),
new OrgChartNode("1.2.2", "Production")
),
new OrgChartNode("1.3", "Vice President Marketing Services",
new OrgChartNode("1.3.1", "Media"),
new OrgChartNode("1.3.2", "Research")
),
new OrgChartNode("1.4", "Vice President Management Services",
new OrgChartNode("1.4.1", "Accounting"),
new OrgChartNode("1.4.2", "Perchasing"),
new OrgChartNode("1.4.3", "Personnel")
)
));
return nodes;
}
```