// can't yet format YamlFrontmatter (["title: Funnel Charts"; "category: Finance Charts"; "categoryindex: 7"; "index: 2"], Some { StartLine = 2 StartColumn = 0 EndLine = 6 EndColumn = 8 }) to pynb markdown

In [ ]:
#r "nuget: Plotly.NET, 2.0.0-preview.14"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.14"

Funnel Charts


Summary: This example shows how to create funnel charts in F#.

let's first create some data for the purpose of creating example charts:

In [3]:
let y = [|"Sales person A"; "Sales person B"; "Sales person C"; "Sales person D"; "Sales person E"|]
let x = [|1200.; 909.4; 600.6; 300.; 80.|]

Funnel charts visualize stages in a process using length-encoded bars. This trace can be used to show data in either a part-to-whole representation wherein each item appears in a single stage, or in a "drop-off" representation wherein each item appears in each stage it traversed. See also the FunnelArea chart for a different approach to visualizing funnel data.

In [4]:
open Plotly.NET 
open Plotly.NET.TraceObjects

// Customize the connector lines used to connect the funnel bars
let connectorLine = Line.init (Color=Color.fromString "royalblue", Dash=StyleParam.DrawingStyle.Dot, Width=3.)
let connector = FunnelConnector.init(Line=connectorLine)

// Customize the outline of the funnel bars
let line = Line.init(Width=2.,Color=Color.fromHex "3E4E88")

// create a funnel chart using custom connectors and outlines
let funnel =
    Chart.Funnel (x,y,Color=Color.fromHex "59D4E8", Line=line, Connector=connector)
    |> Chart.withMarginSize(Left=100)
In [ ]:
Out[ ]: