Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
180 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
(** | ||
--- | ||
title: Funnel Charts | ||
category: Finance Charts | ||
categoryindex: 7 | ||
index: 2 | ||
--- | ||
*) | ||
|
||
(*** hide ***) | ||
|
||
(*** condition: prepare ***) | ||
#r "nuget: Newtonsoft.JSON, 12.0.3" | ||
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll" | ||
|
||
(*** condition: ipynb ***) | ||
#if IPYNB | ||
#r "nuget: Plotly.NET, {{fsdocs-package-version}}" | ||
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}" | ||
#endif // IPYNB | ||
|
||
(** | ||
# Funnel Charts | ||
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)  | ||
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx)  | ||
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb) | ||
*Summary:* This example shows how to create funnel charts in F#. | ||
let's first create some data for the purpose of creating example charts: | ||
*) | ||
|
||
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]({{root}}/6_2_funnel_area.html) chart for a different approach to visualizing funnel data. | ||
*) | ||
|
||
open Plotly.NET | ||
|
||
// Customize the connector lines used to connect the funnel bars | ||
let connectorLine = Line.init (Color="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="3E4E88") | ||
|
||
// create a funnel chart using custom connectors and outlines | ||
let funnel = | ||
Chart.Funnel (x,y,Color="59D4E8", Line=line, Connector=connector) | ||
|> Chart.withMarginSize(Left=100) | ||
|
||
(*** condition: ipynb ***) | ||
#if IPYNB | ||
funnel | ||
#endif // IPYNB | ||
|
||
(***hide***) | ||
funnel |> GenericChart.toChartHTML | ||
(***include-it-raw***) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(** | ||
--- | ||
title: FunnelArea Charts | ||
category: Finance Charts | ||
categoryindex: 7 | ||
index: 3 | ||
--- | ||
*) | ||
|
||
(*** hide ***) | ||
|
||
(*** condition: prepare ***) | ||
#r "nuget: Newtonsoft.JSON, 12.0.3" | ||
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll" | ||
|
||
(*** condition: ipynb ***) | ||
#if IPYNB | ||
#r "nuget: Plotly.NET, {{fsdocs-package-version}}" | ||
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}" | ||
#endif // IPYNB | ||
|
||
(** | ||
# FunnelArea Charts | ||
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)  | ||
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx)  | ||
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb) | ||
*Summary:* This example shows how to create funnel area charts in F#. | ||
let's first create some data for the purpose of creating example charts: | ||
*) | ||
|
||
let values = [|5; 4; 3; 2; 1|] | ||
let text = [|"The 1st"; "The 2nd"; "The 3rd"; "The 4th"; "The 5th"|] | ||
|
||
(** | ||
FunnelArea charts visualize stages in a process using area-encoded trapezoids. | ||
This trace can be used to show data in a part-to-whole representation similar to a "pie" trace, | ||
wherein each item appears in a single stage. See also the the [Funnel]({{root}}/6_1_funnel.html) chart for a different approach | ||
to visualizing funnel data. | ||
*) | ||
|
||
open Plotly.NET | ||
|
||
let line = Line.init (Color="purple", Width=3.) | ||
|
||
let funnelArea = | ||
Chart.FunnelArea(Values=values, Text=text, Line=line) | ||
|
||
(*** condition: ipynb ***) | ||
#if IPYNB | ||
funnelArea | ||
#endif // IPYNB | ||
|
||
(***hide***) | ||
funnelArea |> GenericChart.toChartHTML | ||
(***include-it-raw***) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters