Skip to content

Commit 30ab8f8

Browse files
committed
stay on .net 6, update fantomas, format /src and /docs
1 parent 4a37217 commit 30ab8f8

File tree

104 files changed

+2915
-2916
lines changed

Some content is hidden

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

104 files changed

+2915
-2916
lines changed

.config/dotnet-tools.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"version": 1,
33
"isRoot": true,
44
"tools": {
5-
"fantomas-tool": {
6-
"version": "4.7.9",
5+
"fantomas": {
6+
"version": "5.2.2",
77
"commands": [
88
"fantomas"
99
]
1010
},
1111
"fsdocs-tool": {
12-
"version": "17.2.2",
12+
"version": "16.1.1",
1313
"commands": [
1414
"fsdocs"
1515
]

docs/00_0_basics.fsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ index: 1
1616
#r "nuget: Giraffe.ViewEngine, 1.4.0"
1717
#r "../src/Plotly.NET/bin/Release/netstandard2.0/Plotly.NET.dll"
1818

19-
Plotly.NET.Defaults.DefaultDisplayOptions <- Plotly.NET.DisplayOptions.init(PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
19+
Plotly.NET.Defaults.DefaultDisplayOptions <-
20+
Plotly.NET.DisplayOptions.init (PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
2021

2122
(*** condition: ipynb ***)
2223
#if IPYNB
@@ -85,8 +86,7 @@ Here is an example on how to create a simple 2D point chart:
8586

8687
open Plotly.NET
8788

88-
let pointChart =
89-
Chart.Point(xy=[1,2; 3,4])
89+
let pointChart = Chart.Point(xy = [ 1, 2; 3, 4 ])
9090

9191
(*** condition: ipynb ***)
9292
#if IPYNB
@@ -110,12 +110,7 @@ You can clearly see the advantages and disadvantages of both approaches.
110110
*)
111111

112112
let withTraceStyle =
113-
Trace2D.initScatter(
114-
Trace2DStyle.Scatter(
115-
X = [1; 3],
116-
Y = [2; 4]
117-
)
118-
)
113+
Trace2D.initScatter (Trace2DStyle.Scatter(X = [ 1; 3 ], Y = [ 2; 4 ]))
119114
|> GenericChart.ofTraceObject true
120115

121116
(*** condition: ipynb ***)
@@ -141,8 +136,8 @@ So if you want to set any kind of property on one of these objects you can do it
141136
*)
142137

143138
let myTrace = Trace("scatter") // create a scatter trace
144-
myTrace?x <- [0;3] // set the x property (the x dimension of the data)
145-
myTrace?y <- [2;4] // set the y property (the y dimension of the data)
139+
myTrace?x <- [ 0; 3 ] // set the x property (the x dimension of the data)
140+
myTrace?y <- [ 2; 4 ] // set the y property (the y dimension of the data)
146141

147142
let withDynObj = GenericChart.ofTraceObject true myTrace
148143

@@ -162,4 +157,4 @@ lets have a look at the trace object that will be created. The relevant section
162157
var data = [{"type":"scatter","x":[0,1,2],"y":[0,1,2]}];
163158
```
164159
165-
*)
160+
*)

docs/00_1_image-export.fsx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,12 @@ The parameters for all three functions are exactly the same.
6464
open Plotly.NET
6565
open Plotly.NET.ImageExport
6666

67-
let exampleChart =
68-
Chart.Histogram2DContour(
69-
[1.;2.;2.;4.;5.],
70-
[1.;2.;2.;4.;5.]
71-
)
67+
let exampleChart =
68+
Chart.Histogram2DContour([ 1.; 2.; 2.; 4.; 5. ], [ 1.; 2.; 2.; 4.; 5. ])
7269

7370
(***do-not-eval***)
7471
exampleChart
75-
|> Chart.saveJPG(
76-
"/your/path/without/extension/here",
77-
Width=300,
78-
Height=300
79-
)
72+
|> Chart.saveJPG ("/your/path/without/extension/here", Width = 300, Height = 300)
8073

8174
(**
8275
## Generating URIs for static chart images
@@ -92,12 +85,7 @@ By referencing the `Plotly.NET.ImageExport` package, you get access to:
9285
*)
9386

9487
(***do-not-eval***)
95-
let base64JPG =
96-
exampleChart
97-
|> Chart.toBase64JPGString(
98-
Width=300,
99-
Height=300
100-
)
88+
let base64JPG = exampleChart |> Chart.toBase64JPGString (Width = 300, Height = 300)
10189

10290
(**
10391
It is very easy to construct a html tag that includes this image via a base64 uri. For SVGs,
@@ -107,4 +95,4 @@ not even that is necessary and just the SVG string can be used.
10795
(***do-not-eval***)
10896
$"""<img
10997
src= "{base64JPG}"
110-
/>"""
98+
/>"""

docs/00_2_display-options.fsx

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ index: 3
1515
#r "nuget: Giraffe.ViewEngine, 1.4.0"
1616
#r "../src/Plotly.NET/bin/Release/netstandard2.0/Plotly.NET.dll"
1717

18-
Plotly.NET.Defaults.DefaultDisplayOptions <- Plotly.NET.DisplayOptions.init(PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
18+
Plotly.NET.Defaults.DefaultDisplayOptions <-
19+
Plotly.NET.DisplayOptions.init (PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
1920

2021

2122
(*** condition: ipynb ***)
@@ -41,10 +42,10 @@ let's first create some data for the purpose of creating example charts:
4142
4243
*)
4344

44-
open Plotly.NET
45-
46-
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
47-
let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
45+
open Plotly.NET
46+
47+
let x = [ 1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10. ]
48+
let y = [ 2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1. ]
4849

4950
(**
5051
## Referencing PlotlyJS
@@ -64,9 +65,7 @@ You can control this on a per-chart basis via `Chart.withDisplayOptionsStyle`, f
6465

6566
(***do-not-eval***)
6667
Chart.Point(x = x, y = y)
67-
|> Chart.withDisplayOptionsStyle(
68-
PlotlyJSReference = Full
69-
)
68+
|> Chart.withDisplayOptionsStyle (PlotlyJSReference = Full)
7069

7170

7271
(**
@@ -80,19 +79,11 @@ For example, use `Chart.withDescription` to append a list of html tags below the
8079
open Giraffe.ViewEngine
8180

8281
let desc1 =
83-
Chart.Point(
84-
x = x,
85-
y = y,
86-
Name="desc1"
87-
)
88-
|> Chart.withDescription [
89-
h1 [] [str "Hello"]
90-
p [] [str "F#"]
91-
ol [] [
92-
li [] [str "Item 1"]
93-
li [] [str "Item 2"]
94-
]
95-
]
82+
Chart.Point(x = x, y = y, Name = "desc1")
83+
|> Chart.withDescription
84+
[ h1 [] [ str "Hello" ]
85+
p [] [ str "F#" ]
86+
ol [] [ li [] [ str "Item 1" ]; li [] [ str "Item 2" ] ] ]
9687

9788

9889
(*** condition: ipynb ***)
@@ -115,28 +106,22 @@ For example, you can load external css libraries to style the chart description:
115106
*)
116107

117108
//html for description containing bulma classes such as "hero"
118-
let bulmaHero =
119-
section [_class"hero is-primary is-bold"] [
120-
div [_class "hero-body"] [
121-
p [_class "title"] [str "Hero title"]
122-
p [_class "subtitle"] [str "Hero subtitle"]
123-
]
124-
]
109+
let bulmaHero =
110+
section
111+
[ _class "hero is-primary is-bold" ]
112+
[ div
113+
[ _class "hero-body" ]
114+
[ p [ _class "title" ] [ str "Hero title" ]
115+
p [ _class "subtitle" ] [ str "Hero subtitle" ] ] ]
125116
// chart description containing bulma classes
126-
let description3 = [
127-
h1 [_class "title"] [str "I am heading"]
128-
bulmaHero
129-
]
117+
let description3 = [ h1 [ _class "title" ] [ str "I am heading" ]; bulmaHero ]
130118

131119
let desc3 =
132-
Chart.Point(
133-
x = x,
134-
y = y,
135-
Name="desc3"
136-
)
137-
|> Chart.withAdditionalHeadTags [
138-
link [_rel "stylesheet"; _href "https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"]
139-
]
120+
Chart.Point(x = x, y = y, Name = "desc3")
121+
|> Chart.withAdditionalHeadTags
122+
[ link
123+
[ _rel "stylesheet"
124+
_href "https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" ] ]
140125
|> Chart.withDescription description3
141126

142127
(**
@@ -150,13 +135,11 @@ It will add a MathJax script reference to your document based on which version (
150135
*)
151136

152137
let mathtex_chart =
153-
[
154-
Chart.Point(xy = [(1.,2.)],Name = @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
155-
Chart.Point(xy = [(2.,4.)],Name = @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
156-
]
138+
[ Chart.Point(xy = [ (1., 2.) ], Name = @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
139+
Chart.Point(xy = [ (2., 4.) ], Name = @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") ]
157140
|> Chart.combine
158141
|> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$"
159-
|> Chart.withMathTex(AppendTags = true, MathJaxVersion = 3)
142+
|> Chart.withMathTex (AppendTags = true, MathJaxVersion = 3)
160143

161144
(*** condition: ipynb ***)
162145
#if IPYNB
@@ -166,4 +149,3 @@ mathtex_chart
166149
(***hide***)
167150
mathtex_chart |> GenericChart.toChartHTML
168151
(***include-it-raw***)
169-

docs/00_3_chart-config.fsx

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ index: 4
1515
#r "nuget: Giraffe.ViewEngine, 1.4.0"
1616
#r "../src/Plotly.NET/bin/Release/netstandard2.0/Plotly.NET.dll"
1717

18-
Plotly.NET.Defaults.DefaultDisplayOptions <- Plotly.NET.DisplayOptions.init(PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
18+
Plotly.NET.Defaults.DefaultDisplayOptions <-
19+
Plotly.NET.DisplayOptions.init (PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
1920

2021
(*** condition: ipynb ***)
2122
#if IPYNB
@@ -52,18 +53,17 @@ open Plotly.NET.ConfigObjects
5253

5354
let svgConfig =
5455
Config.init (
55-
ToImageButtonOptions = ToImageButtonOptions.init(
56-
Format = StyleParam.ImageFormat.JPEG,
57-
Filename = "mySvgChart",
58-
Width = 900.,
59-
Height = 600.,
60-
Scale = 10.
61-
)
56+
ToImageButtonOptions =
57+
ToImageButtonOptions.init (
58+
Format = StyleParam.ImageFormat.JPEG,
59+
Filename = "mySvgChart",
60+
Width = 900.,
61+
Height = 600.,
62+
Scale = 10.
63+
)
6264
)
6365

64-
let svgButtonChart =
65-
Chart.Point(xy = [(1.,2.)])
66-
|> Chart.withConfig svgConfig
66+
let svgButtonChart = Chart.Point(xy = [ (1., 2.) ]) |> Chart.withConfig svgConfig
6767

6868

6969
(*** condition: ipynb ***)
@@ -82,11 +82,9 @@ To create a static plot that has no hoverable elements, use `StaticPlot=true` on
8282
8383
*)
8484

85-
let staticConfig = Config.init(StaticPlot=true)
85+
let staticConfig = Config.init (StaticPlot = true)
8686

87-
let staticPlot =
88-
Chart.Point(xy = [(1.,2.)])
89-
|> Chart.withConfig staticConfig
87+
let staticPlot = Chart.Point(xy = [ (1., 2.) ]) |> Chart.withConfig staticConfig
9088

9189
(*** condition: ipynb ***)
9290
#if IPYNB
@@ -104,19 +102,10 @@ You can define fields that can be edited on the chart by setting `Editable = tru
104102
105103
*)
106104

107-
let editableConfig =
108-
Config.init(
109-
Editable = true,
110-
Edits = Edits.init(
111-
LegendPosition = true,
112-
AxisTitleText = true,
113-
LegendText = true
114-
)
115-
)
105+
let editableConfig =
106+
Config.init (Editable = true, Edits = Edits.init (LegendPosition = true, AxisTitleText = true, LegendText = true))
116107

117-
let editablePlot =
118-
Chart.Point(xy = [(1.,2.)])
119-
|> Chart.withConfig editableConfig
108+
let editablePlot = Chart.Point(xy = [ (1., 2.) ]) |> Chart.withConfig editableConfig
120109

121110
(*** condition: ipynb ***)
122111
#if IPYNB
@@ -135,11 +124,10 @@ To create a chart that is reponsive to its container size, use `Responsive=true`
135124
(try resizing the window)
136125
*)
137126

138-
let responsiveConfig = Config.init(Responsive=true)
127+
let responsiveConfig = Config.init (Responsive = true)
139128

140129
let responsivePlot =
141-
Chart.Point(xy = [(1.,2.)])
142-
|> Chart.withConfig responsiveConfig
130+
Chart.Point(xy = [ (1., 2.) ]) |> Chart.withConfig responsiveConfig
143131

144132
(*** condition: ipynb ***)
145133
#if IPYNB
@@ -148,4 +136,4 @@ responsivePlot
148136

149137
(***hide***)
150138
responsivePlot |> GenericChart.toChartHTML
151-
(***include-it-raw***)
139+
(***include-it-raw***)

docs/00_4_templates.fsx

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ index: 5
1515
#r "nuget: Giraffe.ViewEngine, 1.4.0"
1616
#r "../src/Plotly.NET/bin/Release/netstandard2.0/Plotly.NET.dll"
1717

18-
Plotly.NET.Defaults.DefaultDisplayOptions <- Plotly.NET.DisplayOptions.init(PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
18+
Plotly.NET.Defaults.DefaultDisplayOptions <-
19+
Plotly.NET.DisplayOptions.init (PlotlyJSReference = Plotly.NET.PlotlyJSReference.NoReference)
1920

2021
(*** condition: ipynb ***)
2122
#if IPYNB
@@ -35,9 +36,8 @@ premade templates can be accessed via the `ChartTemplates` module. In fact, the
3536
*)
3637
open Plotly.NET
3738

38-
let lightMirrored =
39-
Chart.Point(xy = [1,2])
40-
|> Chart.withTemplate ChartTemplates.lightMirrored
39+
let lightMirrored =
40+
Chart.Point(xy = [ 1, 2 ]) |> Chart.withTemplate ChartTemplates.lightMirrored
4141

4242
(*** condition: ipynb ***)
4343
#if IPYNB
@@ -59,25 +59,18 @@ Chart Templates consist of a `Layout` object and a collection of `Trace` objects
5959

6060
open Plotly.NET.TraceObjects
6161

62-
let layoutTemplate =
63-
Layout.init(
64-
Title = Title.init("I will always be there now!")
65-
)
62+
let layoutTemplate =
63+
Layout.init (Title = Title.init ("I will always be there now!"))
6664

67-
let traceTemplates =
68-
[
69-
Trace2D.initScatter(
70-
Trace2DStyle.Scatter(
71-
Marker = Marker.init(Symbol = StyleParam.MarkerSymbol.ArrowLeft, Size = 20)
72-
)
73-
)
74-
]
65+
let traceTemplates =
66+
[ Trace2D.initScatter (
67+
Trace2DStyle.Scatter(Marker = Marker.init (Symbol = StyleParam.MarkerSymbol.ArrowLeft, Size = 20))
68+
) ]
7569

76-
let myTemplate = Template.init(layoutTemplate, traceTemplates)
70+
let myTemplate = Template.init (layoutTemplate, traceTemplates)
7771

7872
let myTemplateExampleChart =
79-
Chart.Point(xy = [1,2])
80-
|> Chart.withTemplate myTemplate
73+
Chart.Point(xy = [ 1, 2 ]) |> Chart.withTemplate myTemplate
8174

8275
(*** condition: ipynb ***)
8376
#if IPYNB

0 commit comments

Comments
 (0)