# Organization hierarchy with branch layout policies

Mix standard, compact, and vertical branches in one deterministic hierarchy.

 [All examples](/examples/) Static Topology 

 organization-hierarchy.svg  [SVG 191.9 KB](/site/examples/organization-hierarchy-light.svg) [SVG 191.9 KB](/site/examples/organization-hierarchy-dark.svg) [PNG 35 KB](/site/examples/organization-hierarchy-light.png) [PNG 35 KB](/site/examples/organization-hierarchy-dark.png) [HTML](/site/examples/organization-hierarchy-light.html) [HTML](/site/examples/organization-hierarchy-dark.html) [C# program](/site/examples/organization-hierarchy.csharp.txt)  

 ![Organization hierarchy with branch layout policies: the SVG this program renders.](/site/examples/organization-hierarchy-light.svg) ![Organization hierarchy with branch layout policies: the SVG this program renders, dark theme.](/site/examples/organization-hierarchy-dark.svg) 

Rendered by ChartForgeX from the program below. The files follow the page theme.

`TopologyChart` draws a static organization view, and hierarchy policy changes the density of one branch without touching the rest. The output above is this program's SVG; choose `--dark` when running the complete program to use the dark theme.

## Describe the people

Each member names its manager; the small `Reports` helper keeps the leaf entries short. A layout policy on a member applies to the branch below it and is inherited, so most of a tree can stay automatic while one team becomes compact or vertical.

```csharp
using System;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Themes;
using ChartForgeX.Topology;

var mode = args.Contains("--dark")
    ? ThemeMode.Dark : ThemeMode.Light;

var members = new[] {
    new TopologyTeamMember("marta", "Marta", "Head of platform") {
        LayoutPolicy = TopologyHierarchyLayoutPolicy.Standard
    },
    new TopologyTeamMember("jonas", "Jonas", "Sales lead") {
        ParentId = "marta",
        LayoutPolicy = TopologyHierarchyLayoutPolicy.Vertical
    },
    new TopologyTeamMember("deniz", "Deniz", "Design lead") {
        ParentId = "marta",
        LayoutPolicy = TopologyHierarchyLayoutPolicy.Compact
    },
    Reports("ana", "Ana", "Product designer", "deniz"),
    Reports("pawel", "Pawel", "Illustrator", "deniz", TopologyHealthStatus.Warning),
    Reports("ruben", "Ruben", "Brand designer", "deniz"),
    Reports("emre", "Emre", "Product designer", "deniz"),
    Reports("vipul", "Vipul", "Account manager", "jonas"),
    Reports("karan", "Karan", "Account manager", "jonas"),
    Reports("lena", "Lena", "Sales engineer", "jonas")
};

static TopologyTeamMember Reports(string id, string name, string role, string manager,
    TopologyHealthStatus status = TopologyHealthStatus.Unknown) =>
    new(id, name, role) { ParentId = manager, Status = status };
```

## Pick a policy per branch

- `Auto` lets the renderer select a deterministic layout from branch density.
- `Standard` sets a conventional row of direct reports.
- `Compact` wraps a dense branch.
- `Vertical` stacks a narrow branch in a single column.

## Build the chart

`AddTeam` turns the parent links into nodes and ownership edges. `MaxLevel` bounds how deep the chart goes.

```csharp
var chart = TopologyChart.Create()
    .ThemeMode(mode)
    .Title("Platform team")
    .Subtitle("Standard, compact and vertical branches")
    .Viewport(new TopologyViewport(1180, 620, 28))
    .AddTeam("platform", "Platform team", members,
        new TopologyTeamOptions { MaxLevel = 3 });
```

## Save it

SVG and PNG share the same hierarchy geometry, so documentation and raster consumers see the same chart.

```csharp
chart.SaveSvg("platform-team.svg");
chart.SavePng("platform-team.png");
```

The maintained [team hierarchy example](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX.Examples/TopologyVisualExamples.cs) adds a legend, routing metadata and a larger team.

<!-- PowerForge markdown source sha256:425DE7167664856F978B43AC8247972663C7A1CB8B04E1A9D47E0653B95BB7C4; title=True -->

<!-- PowerForge markdown artifact sha256:F7D56665E608BDDDC41ECF7977145F82A1C7904A458C82D4FB8623F0781A8E3A -->
