← Gallery

Sequence

Measured review sequence

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

Preview
Measured review sequenceIndependent native role typography and spacing
Measured review sequence
Measured review sequenceIndependent native role typography and spacing
Measured review sequence
390 × 620 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 = SequenceLayoutTypographyRecipe.Create("compact", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(390, 620)), theme, mode,
    new VisualFrame("Measured review sequence", "Independent native role typography and spacing", showLegend: false, 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.Sequence).ToHtmlPage());
#endregion

/// <summary>Creates a native sequence with independent measured role typography and explicit logical spacing.</summary>
public static class SequenceLayoutTypographyRecipe {
    /// <summary>Creates compact 390x620 or wide 1000x620 authored minima; natural exports may grow. No source parser or browser is invoked.</summary>
    public static SequenceArtifact Create(string variant="wide",ThemeMode mode=ThemeMode.Light) {
        if(variant is not ("compact" or "wide"))throw new ArgumentOutOfRangeException(nameof(variant));
        var model=SequenceArtifact.Create("sequence-layout").Width(variant=="compact"?390:1000).Height(620)
            .Title("Measured review sequence").Subtitle("Each role retains its own font and source identity")
            .AddParticipant("A","Review").AddParticipant("B","Store")
            .AddMessage("A","B","Save").AddMessage("B","A","Ready",SequenceArtifactMessageLineStyle.Dashed,SequenceArtifactMessageKind.Return)
            .AddBlock(SequenceArtifactBlockKind.Alt,"Accepted",0,1).AddActivation("B",true,0).AddActivation("B",false,2)
            .AddNote(SequenceArtifactNotePlacement.Over,new[]{"A","B"},"Retain record facts");
        model.Notes[0].StepIndex=1;model.Metadata["mermaid.autonumber"]="true";model.Theme=VisualTheme.Graphite();model.ThemeMode=mode;
        model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:90,participantMinimumHeight:60,participantSpacing:20,messageSpacing:18,
            noteSpacing:12,fragmentMargin:10,fragmentLabelPadding:6,activationWidth:14,wrapPadding:8);
        model.Typography=new SequenceTypography(new TextStyleOverride{FontSize=17,FontWeight=700},new TextStyleOverride{FontSize=16,FontWeight=500},
            new TextStyleOverride{FontSize=14,FontWeight=400},new TextStyleOverride{FontSize=15,FontWeight=600},new TextStyleOverride{FontSize=13,FontWeight=700});
        return model;
    }
}
#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 = SequenceLayoutTypographyRecipe.Create("compact", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(390, 620)), theme, mode,
    new VisualFrame("Measured review sequence", "Independent native role typography and spacing", showLegend: false, 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.Sequence).ToHtmlPage());
#endregion

/// <summary>Creates a native sequence with independent measured role typography and explicit logical spacing.</summary>
public static class SequenceLayoutTypographyRecipe {
    /// <summary>Creates compact 390x620 or wide 1000x620 authored minima; natural exports may grow. No source parser or browser is invoked.</summary>
    public static SequenceArtifact Create(string variant="wide",ThemeMode mode=ThemeMode.Light) {
        if(variant is not ("compact" or "wide"))throw new ArgumentOutOfRangeException(nameof(variant));
        var model=SequenceArtifact.Create("sequence-layout").Width(variant=="compact"?390:1000).Height(620)
            .Title("Measured review sequence").Subtitle("Each role retains its own font and source identity")
            .AddParticipant("A","Review").AddParticipant("B","Store")
            .AddMessage("A","B","Save").AddMessage("B","A","Ready",SequenceArtifactMessageLineStyle.Dashed,SequenceArtifactMessageKind.Return)
            .AddBlock(SequenceArtifactBlockKind.Alt,"Accepted",0,1).AddActivation("B",true,0).AddActivation("B",false,2)
            .AddNote(SequenceArtifactNotePlacement.Over,new[]{"A","B"},"Retain record facts");
        model.Notes[0].StepIndex=1;model.Metadata["mermaid.autonumber"]="true";model.Theme=VisualTheme.Graphite();model.ThemeMode=mode;
        model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:90,participantMinimumHeight:60,participantSpacing:20,messageSpacing:18,
            noteSpacing:12,fragmentMargin:10,fragmentLabelPadding:6,activationWidth:14,wrapPadding:8);
        model.Typography=new SequenceTypography(new TextStyleOverride{FontSize=17,FontWeight=700},new TextStyleOverride{FontSize=16,FontWeight=500},
            new TextStyleOverride{FontSize=14,FontWeight=400},new TextStyleOverride{FontSize=15,FontWeight=600},new TextStyleOverride{FontSize=13,FontWeight=700});
        return model;
    }
}