Skip to content

Commit e243260

Browse files
committed
Update docs to fsdocs 11, add display options docs
1 parent 61fba67 commit e243260

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+746
-160
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"fsharp.formatting.commandtool": {
18-
"version": "9.0.1",
18+
"version": "11.1.0",
1919
"commands": [
2020
"fsdocs"
2121
]

Plotly.NET.sln

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "reference", "reference", "{
5050
EndProject
5151
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{60FB82C0-F472-494E-BCF7-7B3C54212406}"
5252
ProjectSection(SolutionItems) = preProject
53-
docs\1_0_basics.fsx = docs\1_0_basics.fsx
54-
docs\1_1_axis-styling.fsx = docs\1_1_axis-styling.fsx
55-
docs\1_2_errorbars.fsx = docs\1_2_errorbars.fsx
56-
docs\1_3_multiple-charts.fsx = docs\1_3_multiple-charts.fsx
57-
docs\1_4_shapes.fsx = docs\1_4_shapes.fsx
53+
docs\0_0_basics.fsx = docs\0_0_basics.fsx
54+
docs\1_0_axis-styling.fsx = docs\1_0_axis-styling.fsx
55+
docs\1_1_errorbars.fsx = docs\1_1_errorbars.fsx
56+
docs\1_2_multiple-charts.fsx = docs\1_2_multiple-charts.fsx
57+
docs\1_3_shapes.fsx = docs\1_3_shapes.fsx
58+
docs\1_4_display-options.fsx = docs\1_4_display-options.fsx
5859
docs\2_0_line-scatter-plots.fsx = docs\2_0_line-scatter-plots.fsx
5960
docs\2_1_bar-and-column-charts.fsx = docs\2_1_bar-and-column-charts.fsx
6061
docs\2_2_area-plots.fsx = docs\2_2_area-plots.fsx
6162
docs\2_3_range-plots.fsx = docs\2_3_range-plots.fsx
6263
docs\2_4_bubble-charts.fsx = docs\2_4_bubble-charts.fsx
6364
docs\2_5_pie-doughnut-charts.fsx = docs\2_5_pie-doughnut-charts.fsx
6465
docs\2_6_table.fsx = docs\2_6_table.fsx
66+
docs\2_7_heatmaps.fsx = docs\2_7_heatmaps.fsx
6567
docs\3_0_3d-scatter-plots.fsx = docs\3_0_3d-scatter-plots.fsx
6668
docs\3_1_3d-line-plots.fsx = docs\3_1_3d-line-plots.fsx
6769
docs\3_2_3d-surface-plots.fsx = docs\3_2_3d-surface-plots.fsx
6870
docs\3_3_3d-mesh-plots.fsx = docs\3_3_3d-mesh-plots.fsx
6971
docs\4_0_histograms.fsx = docs\4_0_histograms.fsx
7072
docs\4_1_box-plots.fsx = docs\4_1_box-plots.fsx
7173
docs\4_2_violin-plots.fsx = docs\4_2_violin-plots.fsx
72-
docs\4_3_heatmaps.fsx = docs\4_3_heatmaps.fsx
73-
docs\4_4_contour-plots.fsx = docs\4_4_contour-plots.fsx
74-
docs\4_5_2d-histograms.fsx = docs\4_5_2d-histograms.fsx
75-
docs\4_6_splom.fsx = docs\4_6_splom.fsx
74+
docs\4_3_contour-plots.fsx = docs\4_3_contour-plots.fsx
75+
docs\4_4_2d-histograms.fsx = docs\4_4_2d-histograms.fsx
76+
docs\4_5_splom.fsx = docs\4_5_splom.fsx
7677
docs\5_0_choropleth-map.fsx = docs\5_0_choropleth-map.fsx
7778
docs\6_0_candlestick.fsx = docs\6_0_candlestick.fsx
7879
docs\7_0_polar-charts.fsx = docs\7_0_polar-charts.fsx
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
(**
2+
---
3+
title: Basics
4+
category: General
5+
categoryindex: 1
6+
index: 1
7+
---
8+
*)
9+
10+
111
(*** hide ***)
212

313
(*** condition: prepare ***)
@@ -13,6 +23,10 @@
1323
open Plotly.NET
1424

1525
(**
26+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
27+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
28+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
29+
1630
# Plotly.NET basics
1731
1832
_This section is WIP._
@@ -25,7 +39,6 @@ _This section is WIP._
2539
2640
## GenericChart
2741
28-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=1_0_basics.fsx.ipynb)
2942
3043
Plotly.NET is a .NET wrapper for creation of [plotly charts]() written in F#. This means that, under the hood, all functionality creates JSON objects that can be rendered by plotly.
3144
@@ -35,15 +48,16 @@ The central type that gets created by all Chart constructors is `GenericChart`,
3548

3649
(***do-not-eval***)
3750
type GenericChart =
38-
| Chart of Trace * Layout * Config
39-
| MultiChart of Trace list * Layout * Config
51+
| Chart of Trace * Layout * Config * DisplayOptions
52+
| MultiChart of Trace list * Layout * Config * DisplayOptions
4053

4154
(**
42-
As you can see, a `GenericChart` consists of three top level objects - `Trace` (multiple of those in the case of a MultiChart) , `Layout`, and `Config`.
55+
As you can see, a `GenericChart` consists of four top level objects - `Trace` (multiple of those in the case of a MultiChart) , `Layout`, `Config`, and `DisplayOptions`.
4356
4457
- `Trace` is in principle the representation of a dataset on a chart, including for example the data itself, color and shape of the visualization, etc.
4558
- `Layout` is everything of the chart that is not dataset specifivc - e.g. the shape and style of axes, the chart title, etc.
4659
- `Config` is an object that configures high level properties of the chart like making all chart elements editable or the tool bar on top
60+
- `DisplayOptions` is an object that contains meta information about how the html document that contains the chart.
4761
4862
## Working with GenericCharts
4963
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(**
2+
---
3+
title: Axis styling
4+
category: Chart Layout
5+
categoryindex: 2
6+
index: 1
7+
---
8+
*)
9+
110
(*** hide ***)
211

312
(*** condition: prepare ***)
@@ -13,7 +22,9 @@
1322
(**
1423
# Axis styling
1524
16-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=1_1_axis-styling.ipynb)
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
1728
1829
*Summary:* This example shows how to style chart axes in F#.
1930
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(**
2+
---
3+
title: Error bars
4+
category: Chart Layout
5+
categoryindex: 2
6+
index: 2
7+
---
8+
*)
9+
110
(*** hide ***)
211

312
(*** condition: prepare ***)
@@ -13,7 +22,9 @@
1322
(**
1423
# Error bars
1524
16-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=1_3_errorbars.ipynb)
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
1728
1829
*Summary:* This example shows how to add error bars to plots in F#.
1930
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(**
2+
---
3+
title: Multicharts and subplots
4+
category: Chart Layout
5+
categoryindex: 2
6+
index: 3
7+
---
8+
*)
9+
110
(*** hide ***)
211

312
(*** condition: prepare ***)
@@ -13,7 +22,9 @@
1322
(**
1423
# Multicharts and subplots
1524
16-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=1_3_multiple-charts.ipynb)
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
1728
1829
*Summary:* This example shows how to create charts with multiple subplots in F#.
1930
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(**
2+
---
3+
title: Shapes
4+
category: Chart Layout
5+
categoryindex: 2
6+
index: 4
7+
---
8+
*)
9+
110
(*** hide ***)
211

312
(*** condition: prepare ***)
@@ -13,7 +22,9 @@
1322
(**
1423
# Shapes
1524
16-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=1_4_shapes.ipynb)
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
1728
1829
*Summary:* This example shows how to create Shapes and add them to the Charts in F#.
1930

docs/1_4_display-options.fsx

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
(**
2+
---
3+
title: Display Options
4+
category: Chart Layout
5+
categoryindex: 2
6+
index: 5
7+
---
8+
*)
9+
10+
(*** hide ***)
11+
12+
(*** condition: prepare ***)
13+
#r "nuget: Newtonsoft.JSON, 12.0.3"
14+
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll"
15+
16+
(*** condition: ipynb ***)
17+
#if IPYNB
18+
#r "nuget: Plotly.NET, {{fsdocs-package-version}}"
19+
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}"
20+
#endif // IPYNB
21+
22+
(**
23+
# Display Options
24+
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
28+
29+
*Summary:* This example shows how to alter the display options that control the html document that contains plotly charts
30+
31+
You can control the html document that gets created via `Chart.Show` with various functions that change a chart's `DisplayOptions`.
32+
33+
Naturally, these full html documents can not be embedded in this documentation page, so images have to suffice in this case.
34+
35+
let's first create some data for the purpose of creating example charts:
36+
37+
*)
38+
39+
open Plotly.NET
40+
41+
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
42+
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
43+
44+
45+
(**
46+
## Chart description
47+
48+
To create a chart description to put below the chart, use `ChartDescription.create` to create the description, and `Chart.WithDescription`
49+
to add the description to the chart's display options:
50+
*)
51+
52+
let description1 =
53+
ChartDescription.create "Hello" "F#"
54+
55+
(***do-not-eval***)
56+
let desc1 =
57+
Chart.Point(x,y,Name="desc1")
58+
|> Chart.WithDescription(description1)
59+
|> Chart.Show
60+
61+
(**
62+
63+
![]({{root}}img/desc1.png)
64+
65+
The `ChartDescription` type is a bit barebones for now, but you can contain any valid html in both `Heading` and `Text` fields:
66+
*)
67+
68+
let description2 =
69+
ChartDescription.create "<h1>I am heading</h1>" "<ol><li>Hi</li><li>there</li></ol>"
70+
71+
(***do-not-eval***)
72+
let desc2 =
73+
Chart.Point(x,y,Name="desc1")
74+
|> Chart.WithDescription(description2)
75+
|> Chart.Show
76+
77+
(**
78+
79+
![]({{root}}img/desc2.png)
80+
81+
## Adding additional head tags
82+
83+
You can add any number of additional html tags to the documents `<head>` tag using `Chart.WithAdditionalHeadTags`.
84+
85+
For example, you can load external css libraries to style the chart description:
86+
87+
*)
88+
89+
//html for description containing bulma classes such as "hero"
90+
let bulmaHero = """<section class="hero is-primary is-bold">
91+
<div class="hero-body">
92+
<p class="title">
93+
Hero title
94+
</p>
95+
<p class="subtitle">
96+
Hero subtitle
97+
</p>
98+
</div>
99+
</section>
100+
"""
101+
102+
// chart description containing bulma classes
103+
let description3 =
104+
ChartDescription.create
105+
"""<h1 class="title">I am heading</h1>"""
106+
bulmaHero
107+
108+
(***do-not-eval***)
109+
let desc3 =
110+
Chart.Point(x,y,Name="desc3")
111+
|> Chart.WithDescription description3
112+
// Add reference to the bulma css framework
113+
|> Chart.WithAdditionalHeadTags ["""<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.2/css/bulma.min.css">"""]
114+
|> Chart.Show
115+
116+
(**
117+
118+
![]({{root}}img/desc3.png)
119+
120+
## Using MathTeX
121+
122+
By popular request, `Chart.WithMathTex` is a prebuilt function to enable MathTeX for your generated plotly chart documents:
123+
124+
*)
125+
126+
[
127+
Chart.Point([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
128+
Chart.Point([(2.,4.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
129+
]
130+
|> Chart.Combine
131+
|> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$"
132+
// include mathtex tags in <head>. pass true to append these scripts, false to ONLY include MathTeX.
133+
|> Chart.WithMathTex(true)
134+
|> Chart.Show
135+
136+
(**
137+
138+
![]({{root}}img/desc4.png)
139+
140+
*)

docs/2_0_line-scatter-plots.fsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(**
2+
---
3+
title: Line and scatter plots
4+
category: Simple Charts
5+
categoryindex: 3
6+
index: 1
7+
---
8+
*)
9+
110
(*** hide ***)
211

312
(*** condition: prepare ***)
@@ -13,7 +22,9 @@
1322
(**
1423
# Line and scatter plots
1524
16-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=2_0_line-scatter-plots.ipynb)
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)&emsp;
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx)&emsp;
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
1728
1829
*Summary:* This example shows how to create line and point charts in F#.
1930

docs/2_1_bar-and-column-charts.fsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
(**
2+
---
3+
title: Bar and column charts
4+
category: Simple Charts
5+
categoryindex: 3
6+
index: 2
7+
---
8+
*)
9+
110
(*** hide ***)
211

312
(*** condition: prepare ***)
@@ -13,7 +22,9 @@
1322
(**
1423
# Bar and column charts
1524
16-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath=2_1_bar-and-column-charts.ipynb)
25+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb)&emsp;
26+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx)&emsp;
27+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
1728
1829
*Summary:* This example shows how to create bar and a column charts in F#.
1930

0 commit comments

Comments
 (0)