← Gallery

Sequence

Measured participant bands

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

Preview
Measured participant bandsIndependent participant and activation paint with portable native edit facts
Measured participant bands
Measured participant bandsIndependent participant and activation paint with portable native edit facts
Measured participant bands
1100 × 860 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 = SequencePresetAppearanceRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1100, 860)), theme, mode,
    new VisualFrame("Measured participant bands", "Independent participant and activation paint with portable native edit facts", 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>Authors native measured participant bands and independently retained row paints; source parsing lives in the adapter example.</summary>
public static class SequencePresetAppearanceRecipe {
    /// <summary>Creates a compact or wide static native sequence with portable edit 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-preset-appearance").Width(compact?390:1100).Height(860).AddParticipant("A","Review\nOwner",SequenceArtifactParticipantKind.Actor).AddParticipant("B","Archive",SequenceArtifactParticipantKind.Control).AddMessage("A","B","Save").AddMessage("B","A","Stored");
        model.ThemeMode=mode;model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:compact?64:150,participantSpacing:compact?8:50,participantBands:new SequenceParticipantBands(),mirrorParticipants:true,fragmentMargin:10,fragmentTabMinimumWidth:50,fragmentTabMinimumHeight:35);model.Typography=new SequenceTypography(participant:new TextStyleOverride{FontSize=14},message:new TextStyleOverride{FontSize=compact?12:16});
        var dark=mode==ThemeMode.Dark;model.Paint.ParticipantFill=ChartColor.FromHex(dark?"#111113":"#FFFFFF");model.Paint.ParticipantText=ChartColor.FromHex(dark?"#E0DFDF":"#28253D");model.Paint.FragmentTitleText=model.Paint.ParticipantText;
        var a=model.Participants[0];a.Border=ChartColor.FromHex("#E879F9");a.ActivationBorder=a.Border;a.ActivationFill=ChartColor.FromHex(dark?"#111113":"#FDF4FF");var b=model.Participants[1];b.Border=ChartColor.FromHex("#2DD4BF");b.ActivationBorder=b.Border;b.ActivationFill=ChartColor.FromHex(dark?"#111113":"#F0FDFA");model.AddActivation("B",true,0).AddActivation("B",false,2).AddBlock(SequenceArtifactBlockKind.Loop,"Audit",1,1);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 = SequencePresetAppearanceRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(1100, 860)), theme, mode,
    new VisualFrame("Measured participant bands", "Independent participant and activation paint with portable native edit facts", 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>Authors native measured participant bands and independently retained row paints; source parsing lives in the adapter example.</summary>
public static class SequencePresetAppearanceRecipe {
    /// <summary>Creates a compact or wide static native sequence with portable edit 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-preset-appearance").Width(compact?390:1100).Height(860).AddParticipant("A","Review\nOwner",SequenceArtifactParticipantKind.Actor).AddParticipant("B","Archive",SequenceArtifactParticipantKind.Control).AddMessage("A","B","Save").AddMessage("B","A","Stored");
        model.ThemeMode=mode;model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:compact?64:150,participantSpacing:compact?8:50,participantBands:new SequenceParticipantBands(),mirrorParticipants:true,fragmentMargin:10,fragmentTabMinimumWidth:50,fragmentTabMinimumHeight:35);model.Typography=new SequenceTypography(participant:new TextStyleOverride{FontSize=14},message:new TextStyleOverride{FontSize=compact?12:16});
        var dark=mode==ThemeMode.Dark;model.Paint.ParticipantFill=ChartColor.FromHex(dark?"#111113":"#FFFFFF");model.Paint.ParticipantText=ChartColor.FromHex(dark?"#E0DFDF":"#28253D");model.Paint.FragmentTitleText=model.Paint.ParticipantText;
        var a=model.Participants[0];a.Border=ChartColor.FromHex("#E879F9");a.ActivationBorder=a.Border;a.ActivationFill=ChartColor.FromHex(dark?"#111113":"#FDF4FF");var b=model.Participants[1];b.Border=ChartColor.FromHex("#2DD4BF");b.ActivationBorder=b.Border;b.ActivationFill=ChartColor.FromHex(dark?"#111113":"#F0FDFA");model.AddActivation("B",true,0).AddActivation("B",false,2).AddBlock(SequenceArtifactBlockKind.Loop,"Audit",1,1);return model;
    }
}