← Gallery

Cone funnel

From visitor to renewed subscription

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

Preview
From visitor to renewed subscriptionChart with 1 data series: Customers.Visitors to Sign-ups: 12,400 to 5,270Sign-ups to Trials: 5,270 to 2,130Trials to Paid: 2,130 to 860Paid to Renewed: 860 to 610Visitors: 12,400, retained 100.0%Sign-ups: 5,270, retained 42.5%, drop-off 57.5%Trials: 2,130, retained 17.2%, drop-off 59.6%Paid: 860, retained 6.9%, drop-off 59.6%Renewed: 610, retained 4.9%, drop-off 29.1%
From visitor to renewed subscription
From visitor to renewed subscriptionChart with 1 data series: Customers.Visitors to Sign-ups: 12,400 to 5,270Sign-ups to Trials: 5,270 to 2,130Trials to Paid: 2,130 to 860Paid to Renewed: 860 to 610Visitors: 12,400, retained 100.0%Sign-ups: 5,270, retained 42.5%, drop-off 57.5%Trials: 2,130, retained 17.2%, drop-off 59.6%Paid: 860, retained 6.9%, drop-off 59.6%Renewed: 610, retained 4.9%, drop-off 29.1%
From visitor to renewed subscription
800 × 480 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 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 = ConeFunnelRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(800, 480)), theme, mode,
    new VisualFrame("From visitor to renewed subscription", "Each stage narrows the cone by the customers it keeps", 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>A cone funnel: trial sign-ups narrowing to renewed subscriptions, with retention captions.</summary>
public static class ConeFunnelRecipe {
    public static Chart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact")) throw new ArgumentOutOfRangeException(nameof(variant));
        var stages = new (string Name, double Count)[] {
            ("Visitors", 12400), ("Sign-ups", 5270), ("Trials", 2130), ("Paid", 860), ("Renewed", 610)
        };
        var series = new ChartSeries(new ChartSeriesId("customers"), "Customers", ChartSeriesKind.Funnel,
            stages.Select((stage, index) => new ChartPoint(index + 1, stage.Count)));
        return Chart.Create().Legend(false).DataLabels().XLabels(stages.Select(stage => stage.Name).ToArray())
            .AddSeries(series).Funnel(options => {
                options.Form = ChartFunnelForm.Cone;
                // Stage names and retention sit beside the cone, so narrow stages keep their full captions.
                options.LabelContent = ChartStageLabelContent.Separate;
            });
    }
}
#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 = ConeFunnelRecipe.Create("wide", mode);
var context = new VisualRenderContext(
    new VisualLayoutOptions(new VisualSize(800, 480)), theme, mode,
    new VisualFrame("From visitor to renewed subscription", "Each stage narrows the cone by the customers it keeps", 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>A cone funnel: trial sign-ups narrowing to renewed subscriptions, with retention captions.</summary>
public static class ConeFunnelRecipe {
    public static Chart Create(string variant = "wide", ThemeMode mode = ThemeMode.Light) {
        if (variant is not ("wide" or "compact")) throw new ArgumentOutOfRangeException(nameof(variant));
        var stages = new (string Name, double Count)[] {
            ("Visitors", 12400), ("Sign-ups", 5270), ("Trials", 2130), ("Paid", 860), ("Renewed", 610)
        };
        var series = new ChartSeries(new ChartSeriesId("customers"), "Customers", ChartSeriesKind.Funnel,
            stages.Select((stage, index) => new ChartPoint(index + 1, stage.Count)));
        return Chart.Create().Legend(false).DataLabels().XLabels(stages.Select(stage => stage.Name).ToArray())
            .AddSeries(series).Funnel(options => {
                options.Form = ChartFunnelForm.Cone;
                // Stage names and retention sit beside the cone, so narrow stages keep their full captions.
                options.LabelContent = ChartStageLabelContent.Separate;
            });
    }
}