← Gallery

Flow

Assessment workflow

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

Preview
Assessment workflowTyped lanes, decisions and branched routesAssessment workflowTyped lanes, decisions and branched routesServiceReviewEvaluateReview requiredPassedAcceptedRequestreceivedAutomatic checks pass?PReviewobservationsAssessmentcomplete
Assessment workflow
Assessment workflowTyped lanes, decisions and branched routesAssessment workflowTyped lanes, decisions and branched routesServiceReviewEvaluateReview requiredPassedAcceptedRequestreceivedAutomatic checks pass?PReviewobservationsAssessmentcomplete
Assessment workflow
900 × 600 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.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
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 = VisualThemeMode.Light;
var theme = VisualTheme.Graphite();
var model = FlowRecipe.Create("expanded", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(900, 600)), theme, mode,
    new VisualFrame("Assessment workflow", "Typed lanes, decisions and branched routes", 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.Flow).ToHtmlPage());

/// <summary>Creates a branched assessment workflow with typed lanes and semantic statuses.</summary>
public static class FlowRecipe {
    /// <summary>Creates the expanded workflow model.</summary>
    /// <param name="variant">Use wide or expanded for the workflow.</param>
    /// <param name="mode">The rendering mode; diagram colors are resolved when the model is prepared.</param>
    public static FlowArtifact Create(string variant = "wide", VisualThemeMode mode = VisualThemeMode.Light) {
        if (variant is not ("wide" or "expanded"))
            throw new ArgumentOutOfRangeException(nameof(variant), variant, "Use wide or expanded.");

        return FlowArtifact.Create("assessment-flow").WithSize(900, 600)
            .AddLane("service", "Service").AddLane("review", "Review")
            .AddStep("received", "Request received", FlowArtifactStepKind.Start, "service")
            .AddStep("decision", "Automatic checks pass?", FlowArtifactStepKind.Decision, "service")
            .ConfigureStep("decision", step => step.Width = 200)
            .AddStep("manual", "Review observations", FlowArtifactStepKind.Process, "review", VisualStatus.Warning)
            .AddStep("complete", "Assessment complete", FlowArtifactStepKind.End, "service", VisualStatus.Positive)
            .AddConnector("received", "decision", "Evaluate")
            .AddConnector("decision", "manual", "Review required")
            .AddConnector("decision", "complete", "Passed")
            .AddConnector("manual", "complete", "Accepted");
    }
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
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 = VisualThemeMode.Dark;
var theme = VisualTheme.Graphite();
var model = FlowRecipe.Create("expanded", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(900, 600)), theme, mode,
    new VisualFrame("Assessment workflow", "Typed lanes, decisions and branched routes", 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.Flow).ToHtmlPage());

/// <summary>Creates a branched assessment workflow with typed lanes and semantic statuses.</summary>
public static class FlowRecipe {
    /// <summary>Creates the expanded workflow model.</summary>
    /// <param name="variant">Use wide or expanded for the workflow.</param>
    /// <param name="mode">The rendering mode; diagram colors are resolved when the model is prepared.</param>
    public static FlowArtifact Create(string variant = "wide", VisualThemeMode mode = VisualThemeMode.Light) {
        if (variant is not ("wide" or "expanded"))
            throw new ArgumentOutOfRangeException(nameof(variant), variant, "Use wide or expanded.");

        return FlowArtifact.Create("assessment-flow").WithSize(900, 600)
            .AddLane("service", "Service").AddLane("review", "Review")
            .AddStep("received", "Request received", FlowArtifactStepKind.Start, "service")
            .AddStep("decision", "Automatic checks pass?", FlowArtifactStepKind.Decision, "service")
            .ConfigureStep("decision", step => step.Width = 200)
            .AddStep("manual", "Review observations", FlowArtifactStepKind.Process, "review", VisualStatus.Warning)
            .AddStep("complete", "Assessment complete", FlowArtifactStepKind.End, "service", VisualStatus.Positive)
            .AddConnector("received", "decision", "Evaluate")
            .AddConnector("decision", "manual", "Review required")
            .AddConnector("decision", "complete", "Passed")
            .AddConnector("manual", "complete", "Accepted");
    }
}