# Requests from receipt to completion · Funnel

Preview

![Requests from receipt to completion](family-funnel-wide-light.png)

![Requests from receipt to completion](family-funnel-wide-dark.png)

800 × 440 pixels

## Create this example

Create a console project, add the ChartForgeX and ChartForgeX.Interactivity.Html packages, 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-funnel-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 = FunnelRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(800, 440)), theme, mode,
    new VisualFrame("Requests from receipt to completion", "", 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>Builds an ordered request funnel as proportional stages or a cone.</summary>
public static class FunnelRecipe {
    /// <summary>Creates the selected funnel example, preserving zero-valued completion stages.</summary>
    public static Chart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact" or "sparse" or "options" or "compact-options" or "cone-vertical" or "stage-bars-horizontal"))
            throw new ArgumentOutOfRangeException(nameof(variant));
        var chart = Chart.Create().DataLabels();
        if (variant is "options" or "compact-options" or "cone-vertical" or "stage-bars-horizontal") {
            var requests = new ChartSeries(new ChartSeriesId("requests"), "Requests", ChartSeriesKind.Funnel, new[] {
                new ChartPoint(1, 100), new ChartPoint(2, 75), new ChartPoint(3, 25), new ChartPoint(4, 0)
            });
            chart.XLabels("Received", "Reviewed", "Qualified", "Completed").AddSeries(requests)
                .Funnel(options => {
                    options.Form = variant == "stage-bars-horizontal" ? ChartFunnelForm.StageBars : ChartFunnelForm.Cone;
                    options.Orientation = variant == "cone-vertical" ? ChartOrientation.Vertical : ChartOrientation.Horizontal;
                });
        }
        else {
            var requests = new ChartSeries(new ChartSeriesId("requests"), "Requests", ChartSeriesKind.Funnel, new[] {
                new ChartPoint(1, 120), new ChartPoint(2, 95), new ChartPoint(3, 74), new ChartPoint(4, 41)
            });
            chart.XLabels("Received", "Qualified", "Reviewed", "Completed").AddSeries(requests);
        }
        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 = FunnelRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(800, 440)), theme, mode,
    new VisualFrame("Requests from receipt to completion", "", 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>Builds an ordered request funnel as proportional stages or a cone.</summary>
public static class FunnelRecipe {
    /// <summary>Creates the selected funnel example, preserving zero-valued completion stages.</summary>
    public static Chart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact" or "sparse" or "options" or "compact-options" or "cone-vertical" or "stage-bars-horizontal"))
            throw new ArgumentOutOfRangeException(nameof(variant));
        var chart = Chart.Create().DataLabels();
        if (variant is "options" or "compact-options" or "cone-vertical" or "stage-bars-horizontal") {
            var requests = new ChartSeries(new ChartSeriesId("requests"), "Requests", ChartSeriesKind.Funnel, new[] {
                new ChartPoint(1, 100), new ChartPoint(2, 75), new ChartPoint(3, 25), new ChartPoint(4, 0)
            });
            chart.XLabels("Received", "Reviewed", "Qualified", "Completed").AddSeries(requests)
                .Funnel(options => {
                    options.Form = variant == "stage-bars-horizontal" ? ChartFunnelForm.StageBars : ChartFunnelForm.Cone;
                    options.Orientation = variant == "cone-vertical" ? ChartOrientation.Vertical : ChartOrientation.Horizontal;
                });
        }
        else {
            var requests = new ChartSeries(new ChartSeriesId("requests"), "Requests", ChartSeriesKind.Funnel, new[] {
                new ChartPoint(1, 120), new ChartPoint(2, 95), new ChartPoint(3, 74), new ChartPoint(4, 41)
            });
            chart.XLabels("Received", "Qualified", "Reviewed", "Completed").AddSeries(requests);
        }
        return chart;
    }
}
```

<!-- PowerForge markdown artifact sha256:1A439B9C9C655D1F6577F177E542AAF7D79C9593E2DB696DA6FCEA13153455D0 -->
