#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; // Native PNG and standalone SVG use bundled Archivo. // Add ChartFontAssets.StyleSheet once for other text on a host page. var mode = ThemeMode.Light; var theme = VisualTheme.Graphite(); var model = SequenceParticipantViewsRecipe.Create("wide", mode); var context = new VisualRenderContext( new VisualLayoutOptions(new VisualSize(1000, 820)), theme, mode, new VisualFrame("Participant views", "Retained source records and mirrored lifetime footers", showLegend: false, showSurface: false), FontSpec.FromFamily(ChartFontStacks.ProductSans)); 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 /// Creates a native sequence view with retained unused source records and measured participant footers. public static class SequenceParticipantViewsRecipe { /// Creates compact or wide native source facts; natural exports retain measured minima and may scroll in a compact host. 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-participant-views").Width(variant=="compact"?390:1000).Height(820) .Title("Participant views").Subtitle("Unused records stay editable; footer occurrences share source identity") .AddParticipant("A","Review",SequenceArtifactParticipantKind.Actor).AddParticipant("Unused","Retained unused participant") .AddParticipant("B","Archive").AddParticipant("Empty","Retained empty-group participant").AddParticipant("N","Audit") .AddMessage("A","B","Store").AddMessage("B","A","Saved",SequenceArtifactMessageLineStyle.Dashed,SequenceArtifactMessageKind.Return).AddMessage("A","B","Close") .AddNote(SequenceArtifactNotePlacement.Over,new[]{"N"},"Retained note").AddActivation("B",true,1).AddActivation("B",false,2) .AddParticipantGroup("handlers","Handlers",0,2).AddParticipantGroup("empty","Not participating",3,3); model.Notes[0].StepIndex=0;model.Participants[2].DestroyedAtMessageIndex=2; model.Layout=new SequenceLayoutPolicy(participantMinimumWidth:64,participantMinimumHeight:60,participantSpacing:8,fragmentMargin:10,mirrorParticipants:true,hideUnusedParticipants:true); model.Typography=new SequenceTypography(participant:new TextStyleOverride{FontSize=14},message:new TextStyleOverride{FontSize=12},note:new TextStyleOverride{FontSize=12}); model.Theme=VisualTheme.Graphite();model.ThemeMode=mode;return model; } }