← Gallery

Funnel

Independent stage and connection presentation

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

Preview
Independent stage and connection presentationRequests through the intake stages with 1 data series: Requests.Received to Reviewed: 120 to 80Reviewed to Qualified: 80 to 40Qualified to Completed: 40 to 0Received: 120, retained 100.0%Reviewed: 80, retained 66.7%, drop-off 33.3%Qualified: 40, retained 33.3%, drop-off 50.0%Completed: 0, retained 0.0%, drop-off 100.0%
Independent stage and connection presentation
Independent stage and connection presentationRequests through the intake stages with 1 data series: Requests.Received to Reviewed: 120 to 80Reviewed to Qualified: 80 to 40Qualified to Completed: 40 to 0Received: 120, retained 100.0%Reviewed: 80, retained 66.7%, drop-off 33.3%Qualified: 40, retained 33.3%, drop-off 50.0%Completed: 0, retained 0.0%, drop-off 100.0%
Independent stage and connection presentation
390 × 560 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 = FunnelPresentationRecipe.Create("compact", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(390, 560)), theme, mode,
    new VisualFrame("Independent stage and connection presentation", "Measured component captions and source-owned connection paint retain every ordered stage", 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 intake funnel with independent captions and native connection paint.</summary>
public static class FunnelPresentationRecipe {
    /// <summary>Creates the complete requested form. Exact documentation typography needs Carlito regular/bold installed or registered; other hosts use normal font fallback.</summary>
    public static Chart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact" or "cone" or "compact-cone" or "horizontal" or "compact-horizontal" or "cone-horizontal" or "compact-cone-horizontal")) throw new ArgumentOutOfRangeException(nameof(variant));
        var compact = variant.StartsWith("compact", StringComparison.Ordinal);
        var cone = variant is "cone" or "compact-cone" or "cone-horizontal" or "compact-cone-horizontal";
        var horizontal = variant.EndsWith("horizontal", StringComparison.Ordinal);
        var chart = Chart.Create().Size(compact ? 390 : 800, compact ? 560 : 620)
            .Theme(VisualTheme.Graphite()).ThemeMode(mode).Title("Requests through the intake stages")
            .Subtitle("Native paint and captions retain every source value, including the zero completion stage")
            .Legend(false).DataLabels().XLabels("Received", "Reviewed", "Qualified", "Completed");
        var series = new ChartSeries(new ChartSeriesId("requests"), "Requests", ChartSeriesKind.Funnel,
            new[] { new ChartPoint(1, 120), new ChartPoint(2, 80), new ChartPoint(3, 40), new ChartPoint(4, 0) })
            .ObservationIds(new[] { new ChartObservationId("received"), new ChartObservationId("reviewed"), new ChartObservationId("qualified"), new ChartObservationId("completed") })
            .PointColor(0, ChartColor.FromHex("#2978A5")).PointColor(1, ChartColor.FromHex("#3C8D70")).PointColor(2, ChartColor.FromHex("#BA7834"))
            .PointFillPattern(1, ChartFillPattern.DiagonalForward)
            .PointStrokeColor(1, ChartColor.FromHex("#93455E"));
        chart.AddSeries(series).Funnel(options => {
            options.Form = cone ? ChartFunnelForm.Cone : ChartFunnelForm.StageBars;
            options.Orientation = horizontal ? ChartOrientation.Horizontal : ChartOrientation.Vertical;
            options.LabelContent = ChartStageLabelContent.Separate;
            options.CategoryLabel.Style.FontSize = 12; options.ValueLabel.Style.FontSize = 13;
            options.RetentionLabel.Style.FontSize = 11; options.DropOffLabel.Style.FontSize = 11;
            options.RetentionLabel.Placement = horizontal ? ChartDataLabelPlacement.Above : ChartDataLabelPlacement.Left;
            options.DropOffLabel.Placement = horizontal ? ChartDataLabelPlacement.Above : ChartDataLabelPlacement.Left;
            options.StageOutline = new ChartStrokeStyle(width: 2, dash: new[] { 5d, 3d });
            options.StageOutlineDashOffset = 1;
            options.ConnectorStyle = new ChartFunnelConnectorStyle(fillOpacity: .16);
        });
        series.FunnelConnectorStyle(1, new ChartFunnelConnectorStyle(fill: ChartColor.FromHex("#8763A1"), fillOpacity: .45,
            fillPattern: ChartFillPattern.DiagonalBackward, outlineStroke: new ChartStrokeStyle(width: 1.5, dash: new[] { 4d, 2d }), strokeDashOffset: 2));
        // Crowded captions can be omitted at the requested size; the complete source, ratio and connection facts remain descriptive.
        return chart.ValueFormat(ChartValueFormat.Number("0", CultureInfo.InvariantCulture));
    }
}
#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 = FunnelPresentationRecipe.Create("compact", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(390, 560)), theme, mode,
    new VisualFrame("Independent stage and connection presentation", "Measured component captions and source-owned connection paint retain every ordered stage", 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 intake funnel with independent captions and native connection paint.</summary>
public static class FunnelPresentationRecipe {
    /// <summary>Creates the complete requested form. Exact documentation typography needs Carlito regular/bold installed or registered; other hosts use normal font fallback.</summary>
    public static Chart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact" or "cone" or "compact-cone" or "horizontal" or "compact-horizontal" or "cone-horizontal" or "compact-cone-horizontal")) throw new ArgumentOutOfRangeException(nameof(variant));
        var compact = variant.StartsWith("compact", StringComparison.Ordinal);
        var cone = variant is "cone" or "compact-cone" or "cone-horizontal" or "compact-cone-horizontal";
        var horizontal = variant.EndsWith("horizontal", StringComparison.Ordinal);
        var chart = Chart.Create().Size(compact ? 390 : 800, compact ? 560 : 620)
            .Theme(VisualTheme.Graphite()).ThemeMode(mode).Title("Requests through the intake stages")
            .Subtitle("Native paint and captions retain every source value, including the zero completion stage")
            .Legend(false).DataLabels().XLabels("Received", "Reviewed", "Qualified", "Completed");
        var series = new ChartSeries(new ChartSeriesId("requests"), "Requests", ChartSeriesKind.Funnel,
            new[] { new ChartPoint(1, 120), new ChartPoint(2, 80), new ChartPoint(3, 40), new ChartPoint(4, 0) })
            .ObservationIds(new[] { new ChartObservationId("received"), new ChartObservationId("reviewed"), new ChartObservationId("qualified"), new ChartObservationId("completed") })
            .PointColor(0, ChartColor.FromHex("#2978A5")).PointColor(1, ChartColor.FromHex("#3C8D70")).PointColor(2, ChartColor.FromHex("#BA7834"))
            .PointFillPattern(1, ChartFillPattern.DiagonalForward)
            .PointStrokeColor(1, ChartColor.FromHex("#93455E"));
        chart.AddSeries(series).Funnel(options => {
            options.Form = cone ? ChartFunnelForm.Cone : ChartFunnelForm.StageBars;
            options.Orientation = horizontal ? ChartOrientation.Horizontal : ChartOrientation.Vertical;
            options.LabelContent = ChartStageLabelContent.Separate;
            options.CategoryLabel.Style.FontSize = 12; options.ValueLabel.Style.FontSize = 13;
            options.RetentionLabel.Style.FontSize = 11; options.DropOffLabel.Style.FontSize = 11;
            options.RetentionLabel.Placement = horizontal ? ChartDataLabelPlacement.Above : ChartDataLabelPlacement.Left;
            options.DropOffLabel.Placement = horizontal ? ChartDataLabelPlacement.Above : ChartDataLabelPlacement.Left;
            options.StageOutline = new ChartStrokeStyle(width: 2, dash: new[] { 5d, 3d });
            options.StageOutlineDashOffset = 1;
            options.ConnectorStyle = new ChartFunnelConnectorStyle(fillOpacity: .16);
        });
        series.FunnelConnectorStyle(1, new ChartFunnelConnectorStyle(fill: ChartColor.FromHex("#8763A1"), fillOpacity: .45,
            fillPattern: ChartFillPattern.DiagonalBackward, outlineStroke: new ChartStrokeStyle(width: 1.5, dash: new[] { 4d, 2d }), strokeDashOffset: 2));
        // Crowded captions can be omitted at the requested size; the complete source, ratio and connection facts remain descriptive.
        return chart.ValueFormat(ChartValueFormat.Number("0", CultureInfo.InvariantCulture));
    }
}