# Northwind Services team · Org chart

Preview

![Northwind Services team](family-org-chart-wide-light.png)

![Northwind Services team](family-org-chart-wide-dark.png)

960 × 520 pixels

## Create this example

Create a console project, add the ChartForgeX and ChartForgeX.Interactivity.Html packages, and replace Program.cs with this source. Run it to write SVG, PNG and HTML with the default system fonts.

For the same typography as the gallery, [download the gallery-font recipe](family-org-chart-wide-dark.gallery.csharp.txt) and copy the gallery’s fonts directory beside your program.

```
#region Setup
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Core;
using ChartForgeX.Primitives;
using ChartForgeX.Rendering;
using ChartForgeX.Themes;
using ChartForgeX.Topology;
using ChartForgeX.Typography;
using ChartForgeX.VisualArtifacts;
using ChartForgeX.VisualBlocks;

var mode = ThemeMode.Light;
var theme = VisualTheme.Graphite();
var model = OrgChartRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(960, 520)), theme, mode,
    new VisualFrame("Northwind Services team", "Reporting lines across three levels", showLegend: null, showSurface: false));
var prepared = model.Prepare(context);
File.WriteAllText("visual.svg", prepared.ToSvg());
File.WriteAllBytes("visual.png", prepared.ToPng());
File.WriteAllText("visual.html", prepared.ToArtifact("example", VisualArtifactKind.Topology).ToHtmlPage());
#endregion

/// <summary>An organization chart: people, their roles and reporting lines laid out as cards.</summary>
public static class OrgChartRecipe {
    /// <summary>Creates a three-level team; the compact variant stacks the deepest branch vertically.</summary>
    public static TopologyChart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact")) throw new ArgumentOutOfRangeException(nameof(variant));
        var compact = variant == "compact";
        var chart = TopologyChart.Create().Viewport(new TopologyViewport(compact ? 390 : 960, compact ? 520 : 520)).Legend((TopologyLegend?)null);
        chart.Theme = VisualTheme.Graphite(); chart.ThemeMode = mode;
        chart.DefaultRenderOptions = new TopologyRenderOptions { IncludeLegend = false, FitContentToViewport = true };
        chart.AddTeam("company", "Northwind Services", new[] {
            // Wide charts keep each team in one row; compact ones stack every team under its manager.
            Person("avery", "Avery Quinn", "Managing director", policy: compact ? TopologyHierarchyLayoutPolicy.Vertical : null),
            Person("jordan", "Jordan Vale", "Engineering", "avery"),
            Person("morgan", "Morgan Reed", "Operations", "avery"),
            Person("casey", "Casey Lund", "Customer success", "avery"),
            Person("riley", "Riley Shaw", "Platform", "jordan"),
            Person("sam", "Sam Okafor", "Security", "jordan"),
            Person("taylor", "Taylor Brandt", "Service desk", "morgan"),
            Person("drew", "Drew Alvarez", "Field support", "morgan"),
            Person("kim", "Kim Novak", "Onboarding", "casey")
        }, new TopologyTeamOptions { IncludeTeamNode = false });
        return chart;
    }

    private static TopologyTeamMember Person(string id, string name, string role, string? manager = null, TopologyHierarchyLayoutPolicy? policy = null) =>
        new(id, name, role) { ParentId = manager, LayoutPolicy = policy };
}
```

```
#region Setup
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using ChartForgeX;
using ChartForgeX.Core;
using ChartForgeX.Primitives;
using ChartForgeX.Rendering;
using ChartForgeX.Themes;
using ChartForgeX.Topology;
using ChartForgeX.Typography;
using ChartForgeX.VisualArtifacts;
using ChartForgeX.VisualBlocks;

var mode = ThemeMode.Dark;
var theme = VisualTheme.Graphite();
var model = OrgChartRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(960, 520)), theme, mode,
    new VisualFrame("Northwind Services team", "Reporting lines across three levels", showLegend: null, showSurface: false));
var prepared = model.Prepare(context);
File.WriteAllText("visual.svg", prepared.ToSvg());
File.WriteAllBytes("visual.png", prepared.ToPng());
File.WriteAllText("visual.html", prepared.ToArtifact("example", VisualArtifactKind.Topology).ToHtmlPage());
#endregion

/// <summary>An organization chart: people, their roles and reporting lines laid out as cards.</summary>
public static class OrgChartRecipe {
    /// <summary>Creates a three-level team; the compact variant stacks the deepest branch vertically.</summary>
    public static TopologyChart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact")) throw new ArgumentOutOfRangeException(nameof(variant));
        var compact = variant == "compact";
        var chart = TopologyChart.Create().Viewport(new TopologyViewport(compact ? 390 : 960, compact ? 520 : 520)).Legend((TopologyLegend?)null);
        chart.Theme = VisualTheme.Graphite(); chart.ThemeMode = mode;
        chart.DefaultRenderOptions = new TopologyRenderOptions { IncludeLegend = false, FitContentToViewport = true };
        chart.AddTeam("company", "Northwind Services", new[] {
            // Wide charts keep each team in one row; compact ones stack every team under its manager.
            Person("avery", "Avery Quinn", "Managing director", policy: compact ? TopologyHierarchyLayoutPolicy.Vertical : null),
            Person("jordan", "Jordan Vale", "Engineering", "avery"),
            Person("morgan", "Morgan Reed", "Operations", "avery"),
            Person("casey", "Casey Lund", "Customer success", "avery"),
            Person("riley", "Riley Shaw", "Platform", "jordan"),
            Person("sam", "Sam Okafor", "Security", "jordan"),
            Person("taylor", "Taylor Brandt", "Service desk", "morgan"),
            Person("drew", "Drew Alvarez", "Field support", "morgan"),
            Person("kim", "Kim Novak", "Onboarding", "casey")
        }, new TopologyTeamOptions { IncludeTeamNode = false });
        return chart;
    }

    private static TopologyTeamMember Person(string id, string name, string role, string? manager = null, TopologyHierarchyLayoutPolicy? policy = null) =>
        new(id, name, role) { ParentId = manager, LayoutPolicy = policy };
}
```

<!-- PowerForge markdown artifact sha256:9937F4E54E8FA17E404AB18DEEFAFCA19F786CBC8CEF7C3429DC5BDD910A9C13 -->
