# Sequence source defaults · Sequence

Preview

![Sequence source defaults](sequence-source-defaults-wide-light.png)

![Sequence source defaults](sequence-source-defaults-wide-dark.png)

1000 × 820 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](sequence-source-defaults-wide-light.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 = SequenceSourceDefaultsRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1000, 820)), theme, mode,
    new VisualFrame("Sequence source defaults", "Measured tabs and mirrored participants", 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 native fragment tabs, mirrored participants and canonical lifeline strokes.</summary>
public static class SequenceSourceDefaultsRecipe {
    /// <summary>Creates an explicitly tighter compact native view or a wide view of the same source facts.</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 compact=variant=="compact";var model=SequenceArtifact.Create("sequence-source-defaults").Width(compact?390:1000).Height(820).AddParticipant("A","Review").AddParticipant("B","Archive").AddMessage("A","A","Check").AddMessage("A","B","Save");model.AddBlock(SequenceArtifactBlockKind.Loop,"Review work",0,1);model.AddNote(SequenceArtifactNotePlacement.Over,new[]{"A","B"},"Complete note");model.Notes[0].StepIndex=1;
        model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:compact?64:150,participantMinimumHeight:65,participantSpacing:compact?8:50,fragmentMargin:10,fragmentLabelPadding:5,mirrorParticipants:true,messageAlignment:TextAlignment.Center,noteAlignment:TextAlignment.Center,selfMessageRouting:SequenceSelfMessageRouting.Curved,footerBottomMargin:1,fragmentTabMinimumWidth:50,fragmentTabMinimumHeight:20);model.Typography=new SequenceTypography(participant:new TextStyleOverride{FontSize=14},message:new TextStyleOverride{FontSize=compact?12:16},note:new TextStyleOverride{FontSize=14},fragment:new TextStyleOverride{FontSize=compact?12:16});model.Paint.LifelineStroke=new ChartStrokeStyle(width:.5,dash:Array.Empty<double>());model.ThemeMode=mode;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 = SequenceSourceDefaultsRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1000, 820)), theme, mode,
    new VisualFrame("Sequence source defaults", "Measured tabs and mirrored participants", 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 native fragment tabs, mirrored participants and canonical lifeline strokes.</summary>
public static class SequenceSourceDefaultsRecipe {
    /// <summary>Creates an explicitly tighter compact native view or a wide view of the same source facts.</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 compact=variant=="compact";var model=SequenceArtifact.Create("sequence-source-defaults").Width(compact?390:1000).Height(820).AddParticipant("A","Review").AddParticipant("B","Archive").AddMessage("A","A","Check").AddMessage("A","B","Save");model.AddBlock(SequenceArtifactBlockKind.Loop,"Review work",0,1);model.AddNote(SequenceArtifactNotePlacement.Over,new[]{"A","B"},"Complete note");model.Notes[0].StepIndex=1;
        model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:compact?64:150,participantMinimumHeight:65,participantSpacing:compact?8:50,fragmentMargin:10,fragmentLabelPadding:5,mirrorParticipants:true,messageAlignment:TextAlignment.Center,noteAlignment:TextAlignment.Center,selfMessageRouting:SequenceSelfMessageRouting.Curved,footerBottomMargin:1,fragmentTabMinimumWidth:50,fragmentTabMinimumHeight:20);model.Typography=new SequenceTypography(participant:new TextStyleOverride{FontSize=14},message:new TextStyleOverride{FontSize=compact?12:16},note:new TextStyleOverride{FontSize=14},fragment:new TextStyleOverride{FontSize=compact?12:16});model.Paint.LifelineStroke=new ChartStrokeStyle(width:.5,dash:Array.Empty<double>());model.ThemeMode=mode;return model;
    }
}
```

<!-- PowerForge markdown artifact sha256:0A21B03CBFBE9A9DA05E4B40A680EBAC90884F86BCC0877FA9FEDFEDD2EFDA60 -->
