← Gallery

Topology

Finite native actor forms

Explore the example, download the output or use the C# source in your own project.

Preview
Finite native use case actor formsHollow, business, silhouette and retained native icon participants share measured captions and routesFinite native actor formsHollow, business, silhouette and retained native icon participants share measured captions and routesSubmit request«business action»All participants retain their own identity
Finite native actor forms
Finite native use case actor formsHollow, business, silhouette and retained native icon participants share measured captions and routesFinite native actor formsHollow, business, silhouette and retained native icon participants share measured captions and routesSubmit request«business action»All participants retain their own identity
Finite native actor forms
1391 × 377 pixels

Create this example

Create a console project, add the ChartForgeX package, 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 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 = UseCaseAdvancedActorsRecipe.Create("wide", mode);
if ((object)model is TopologyChart topology && topology.DefaultRenderOptions?.FitContentToViewport == false) {
    var natural = topology.Title("Finite native actor forms").Subtitle("Hollow, business, silhouette and retained native icon participants share measured captions and routes").Theme(theme).ThemeMode(mode).ToVisualArtifact();
    natural.SaveSvg("visual.svg");
    File.WriteAllBytes("visual.png", natural.ToPng());
    File.WriteAllText("visual.html", natural.ToHtmlPage(new VisualArtifactRenderOptions { HtmlSizing = VisualArtifactHtmlSizing.PreserveSize }));
    return;
}
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1391, 377)), theme, mode,
    new VisualFrame("Finite native actor forms", "Hollow, business, silhouette and retained native icon participants share measured captions and routes", 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>Authors every finite native Actor form and a business use case through the Core topology model.</summary>
/// <remarks>The separately shared .mmd fixture proves parsed-source consumption. This recipe has no Mermaid dependency.</remarks>
public static class UseCaseAdvancedActorsRecipe {
    /// <summary>Creates wide/compact and light/dark examples with source-stable actors, glyphs, stereotypes, routes and notes.</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().Id("native-usecase-advanced-actors").Title("Participants in a request")
            .Subtitle("Plain, hollow, business, silhouette and finite native icon actors")
            .Theme(VisualTheme.Graphite()).ThemeMode(mode).Viewport(new TopologyViewport(compact ? 390 : 1100, compact ? 1160 : 680, 28))
            .LayoutMode(TopologyLayoutMode.Layered).LayoutDirection(compact ? TopologyLayoutDirection.LeftToRight : TopologyLayoutDirection.TopToBottom);
        chart.DefaultRenderOptions = new TopologyRenderOptions { FitContentToViewport = false, IncludeLegend = false,
            WrapNodeLabels = true, AllowMultilineNodeLabels = true, MaxNodeLabelLines = 6, MaxNodeSubtitleLines = 6 };
        var ids = new[] { "Plain", "Hollow", "Business", "BusinessHollow", "Silhouette", "Icon" };
        var stereotypes = new[] { "participant", "external", "business", "partner", "operator", "system" };
        var shapes = new[] { TopologyNodeShape.Actor, TopologyNodeShape.ActorHollow, TopologyNodeShape.ActorBusiness,
            TopologyNodeShape.ActorBusinessHollow, TopologyNodeShape.ActorSilhouette, TopologyNodeShape.ActorIcon };
        var associations = new[] { "plain", "hollow", "business", "partner", "operator", "system" };
        for (var index = 0; index < ids.Length; index++) {
            chart.AddAutoNode(ids[index], ids[index], width: 140, height: 116);
            var actor = chart.Nodes[index]; actor.Shape = shapes[index]; actor.Kind = TopologyNodeKind.Generic;
            actor.Subtitle = "«" + stereotypes[index] + "»";
        }
        // Retain finite native geometry independently of the optional catalog id, including after save/load.
        chart.Nodes[5].IconId = "network:router"; chart.Nodes[5].IconShape = TopologyIconShape.Router;
        chart.Nodes[5].Kind = TopologyNodeKind.Gateway; chart.Nodes[5].Symbol = "RTR"; chart.Nodes[5].Color = ChartColor.FromHex("#2563EB");
        chart.AddAutoNode("Submit", "Submit request", width: 190, height: 100);
        chart.Nodes[6].Shape = TopologyNodeShape.BusinessEllipse; chart.Nodes[6].Kind = TopologyNodeKind.Generic; chart.Nodes[6].Subtitle = "«business action»";
        foreach (var node in chart.Nodes) { node.ShowStatusBadge = false; node.DisplayMode = TopologyNodeDisplayMode.Card; node.PreserveDisplayModeSize = true; }
        for (var index = 0; index < ids.Length; index++)
            chart.AddEdge(associations[index], ids[index], "Submit", kind: TopologyEdgeKind.Dependency,
                direction: VisualLinkDirection.Forward, routing: TopologyEdgeRouting.Straight);
        chart.Annotations.Add(new TopologyAnnotation("participants", "All participants retain their own identity", "Submit"));
        chart.Accessibility.Name = "Finite native use case actor forms";
        return chart;
    }
}
#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 = UseCaseAdvancedActorsRecipe.Create("wide", mode);
if ((object)model is TopologyChart topology && topology.DefaultRenderOptions?.FitContentToViewport == false) {
    var natural = topology.Title("Finite native actor forms").Subtitle("Hollow, business, silhouette and retained native icon participants share measured captions and routes").Theme(theme).ThemeMode(mode).ToVisualArtifact();
    natural.SaveSvg("visual.svg");
    File.WriteAllBytes("visual.png", natural.ToPng());
    File.WriteAllText("visual.html", natural.ToHtmlPage(new VisualArtifactRenderOptions { HtmlSizing = VisualArtifactHtmlSizing.PreserveSize }));
    return;
}
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1391, 377)), theme, mode,
    new VisualFrame("Finite native actor forms", "Hollow, business, silhouette and retained native icon participants share measured captions and routes", 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>Authors every finite native Actor form and a business use case through the Core topology model.</summary>
/// <remarks>The separately shared .mmd fixture proves parsed-source consumption. This recipe has no Mermaid dependency.</remarks>
public static class UseCaseAdvancedActorsRecipe {
    /// <summary>Creates wide/compact and light/dark examples with source-stable actors, glyphs, stereotypes, routes and notes.</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().Id("native-usecase-advanced-actors").Title("Participants in a request")
            .Subtitle("Plain, hollow, business, silhouette and finite native icon actors")
            .Theme(VisualTheme.Graphite()).ThemeMode(mode).Viewport(new TopologyViewport(compact ? 390 : 1100, compact ? 1160 : 680, 28))
            .LayoutMode(TopologyLayoutMode.Layered).LayoutDirection(compact ? TopologyLayoutDirection.LeftToRight : TopologyLayoutDirection.TopToBottom);
        chart.DefaultRenderOptions = new TopologyRenderOptions { FitContentToViewport = false, IncludeLegend = false,
            WrapNodeLabels = true, AllowMultilineNodeLabels = true, MaxNodeLabelLines = 6, MaxNodeSubtitleLines = 6 };
        var ids = new[] { "Plain", "Hollow", "Business", "BusinessHollow", "Silhouette", "Icon" };
        var stereotypes = new[] { "participant", "external", "business", "partner", "operator", "system" };
        var shapes = new[] { TopologyNodeShape.Actor, TopologyNodeShape.ActorHollow, TopologyNodeShape.ActorBusiness,
            TopologyNodeShape.ActorBusinessHollow, TopologyNodeShape.ActorSilhouette, TopologyNodeShape.ActorIcon };
        var associations = new[] { "plain", "hollow", "business", "partner", "operator", "system" };
        for (var index = 0; index < ids.Length; index++) {
            chart.AddAutoNode(ids[index], ids[index], width: 140, height: 116);
            var actor = chart.Nodes[index]; actor.Shape = shapes[index]; actor.Kind = TopologyNodeKind.Generic;
            actor.Subtitle = "«" + stereotypes[index] + "»";
        }
        // Retain finite native geometry independently of the optional catalog id, including after save/load.
        chart.Nodes[5].IconId = "network:router"; chart.Nodes[5].IconShape = TopologyIconShape.Router;
        chart.Nodes[5].Kind = TopologyNodeKind.Gateway; chart.Nodes[5].Symbol = "RTR"; chart.Nodes[5].Color = ChartColor.FromHex("#2563EB");
        chart.AddAutoNode("Submit", "Submit request", width: 190, height: 100);
        chart.Nodes[6].Shape = TopologyNodeShape.BusinessEllipse; chart.Nodes[6].Kind = TopologyNodeKind.Generic; chart.Nodes[6].Subtitle = "«business action»";
        foreach (var node in chart.Nodes) { node.ShowStatusBadge = false; node.DisplayMode = TopologyNodeDisplayMode.Card; node.PreserveDisplayModeSize = true; }
        for (var index = 0; index < ids.Length; index++)
            chart.AddEdge(associations[index], ids[index], "Submit", kind: TopologyEdgeKind.Dependency,
                direction: VisualLinkDirection.Forward, routing: TopologyEdgeRouting.Straight);
        chart.Annotations.Add(new TopologyAnnotation("participants", "All participants retain their own identity", "Submit"));
        chart.Accessibility.Name = "Finite native use case actor forms";
        return chart;
    }
}