# Requests across processing stages · Sankey

Preview

![Requests across processing stages](family-sankey-compact-gradient-colors-light.png)

![Requests across processing stages](family-sankey-compact-gradient-colors-dark.png)

360 × 360 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](family-sankey-compact-gradient-colors-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 = SankeyPaintRecipe.Create("compact-gradient-colors", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(360, 360)), theme, mode,
    new VisualFrame("Requests across processing stages", "", showLegend: null, 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.Chart).ToHtmlPage());
#endregion

/// <summary>Endpoint gradients and outlined labels use the same native Sankey scene in SVG and PNG.</summary>
public static class SankeyPaintRecipe {
    public static Chart Create(string variant = "gradient-colors", ThemeMode mode = ThemeMode.Light) {
        var chart = Chart.Create().AddSankey("Requests", new[] {
            new ChartNode("received", "Received"), new ChartNode("review", "Review"), new ChartNode("ready", "Ready")
        }, new[] {
            new ChartFlowLink("standard", "received", "review", 60),
            new ChartFlowLink("priority", "received", "review", 20),
            new ChartFlowLink("delivered", "review", "ready", 80)
        }).Sankey(options => {
            options.FlowColorMode = ChartSankeyFlowColorMode.Gradient;
            options.LabelStyle = ChartSankeyLabelStyle.Outlined;
            options.RibbonOpacity = .6; options.NodeWidth = 16;
        }).ValueFormat(ChartValueFormat.Number("0", CultureInfo.InvariantCulture));
        chart.Series[0].PointColor(0, ChartColor.FromHex("#2864B4"))
            .PointColor(1, ChartColor.FromHex("#BB6428")).PointColor(2, ChartColor.FromHex("#279473"))
            .FlowStyle("priority", new ChartFlowStyle(fill: ChartColor.FromHex("#7954AA"), fillOpacity: .75));
        return chart;
    }
}
```

```
#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 = SankeyPaintRecipe.Create("compact-gradient-colors", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(360, 360)), theme, mode,
    new VisualFrame("Requests across processing stages", "", showLegend: null, 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.Chart).ToHtmlPage());
#endregion

/// <summary>Endpoint gradients and outlined labels use the same native Sankey scene in SVG and PNG.</summary>
public static class SankeyPaintRecipe {
    public static Chart Create(string variant = "gradient-colors", ThemeMode mode = ThemeMode.Light) {
        var chart = Chart.Create().AddSankey("Requests", new[] {
            new ChartNode("received", "Received"), new ChartNode("review", "Review"), new ChartNode("ready", "Ready")
        }, new[] {
            new ChartFlowLink("standard", "received", "review", 60),
            new ChartFlowLink("priority", "received", "review", 20),
            new ChartFlowLink("delivered", "review", "ready", 80)
        }).Sankey(options => {
            options.FlowColorMode = ChartSankeyFlowColorMode.Gradient;
            options.LabelStyle = ChartSankeyLabelStyle.Outlined;
            options.RibbonOpacity = .6; options.NodeWidth = 16;
        }).ValueFormat(ChartValueFormat.Number("0", CultureInfo.InvariantCulture));
        chart.Series[0].PointColor(0, ChartColor.FromHex("#2864B4"))
            .PointColor(1, ChartColor.FromHex("#BB6428")).PointColor(2, ChartColor.FromHex("#279473"))
            .FlowStyle("priority", new ChartFlowStyle(fill: ChartColor.FromHex("#7954AA"), fillOpacity: .75));
        return chart;
    }
}
```

<!-- PowerForge markdown artifact sha256:23CE89B825F7ED56ABCFBBEF9B27D606A98FC7075969D2A0656C81503390F615 -->
