# From visitor to renewed subscription · Cone funnel

Preview

![From visitor to renewed subscription](family-cone-funnel-wide-light.png)

![From visitor to renewed subscription](family-cone-funnel-wide-dark.png)

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](family-cone-funnel-wide-dark.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 = 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;
            });
    }
}
```

<!-- PowerForge markdown artifact sha256:231F6602B4663F9801BEDCF0FD75022E04BA156E8A81BDDA8EA48C45EF023670 -->
