Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
842e932
First batch of fixes
WhiteBlackGoose Aug 9, 2021
edeac3e
C# Extensions reverted
WhiteBlackGoose Aug 9, 2021
c180198
Working on chart extesions
WhiteBlackGoose Aug 9, 2021
acf2492
Chart extension case unification finished
WhiteBlackGoose Aug 9, 2021
1d90f4a
Docs library added
WhiteBlackGoose Aug 9, 2021
739ab30
Verification
WhiteBlackGoose Aug 9, 2021
a66f5ab
Project removed
WhiteBlackGoose Aug 9, 2021
5deef60
Create verify-docs.yml
WhiteBlackGoose Aug 9, 2021
26be7b5
Update build.fsx
WhiteBlackGoose Aug 9, 2021
8bd761d
Update build.fsx
WhiteBlackGoose Aug 9, 2021
445af46
Update build.fsx
WhiteBlackGoose Aug 9, 2021
d916014
Update build.fsx
WhiteBlackGoose Aug 9, 2021
364b8cd
Update build.fsx
WhiteBlackGoose Aug 9, 2021
7d79490
Update build.fsx
WhiteBlackGoose Aug 9, 2021
87cb0c7
Update build.fsx
WhiteBlackGoose Aug 9, 2021
8e97d0a
Update build.fsx
WhiteBlackGoose Aug 9, 2021
305fa20
Update verify-docs.yml
WhiteBlackGoose Aug 9, 2021
0410c0b
Update build.fsx
WhiteBlackGoose Aug 9, 2021
f81aa26
Update build.fsx
WhiteBlackGoose Aug 10, 2021
0dec087
Update build.fsx
WhiteBlackGoose Aug 10, 2021
7aef727
Update build.fsx
WhiteBlackGoose Aug 10, 2021
da8a975
More advanced verification algorithm
WhiteBlackGoose Aug 10, 2021
4b2902c
Trying to fix verification script
WhiteBlackGoose Aug 10, 2021
22b6394
Trying to fix..
WhiteBlackGoose Aug 10, 2021
9416b76
Update build.fsx
WhiteBlackGoose Aug 10, 2021
21850be
Update build.fsx
WhiteBlackGoose Aug 10, 2021
a5847fa
Update build.fsx
WhiteBlackGoose Aug 10, 2021
8d02d34
Warning also prohibited
WhiteBlackGoose Aug 10, 2021
8bb9362
Sorting
WhiteBlackGoose Aug 10, 2021
b25d636
Only counting the numeric part when sorting
WhiteBlackGoose Aug 10, 2021
8eb0e30
with*_ -> with*
WhiteBlackGoose Aug 10, 2021
8ad1bb0
Many fixes ; ignore unused variable wanring
WhiteBlackGoose Aug 10, 2021
9196922
Combine -> combine
WhiteBlackGoose Aug 10, 2021
67cac09
Generic chart extensions underscores and a few warnings fixed
WhiteBlackGoose Aug 10, 2021
1360462
Playground revert ; more underscores removed
WhiteBlackGoose Aug 10, 2021
2335931
VS Version revert
WhiteBlackGoose Aug 10, 2021
d8b4383
Merged
WhiteBlackGoose Aug 13, 2021
223270d
Remaining errors fixed
WhiteBlackGoose Aug 13, 2021
c1aab1b
Docs fixed
WhiteBlackGoose Aug 13, 2021
726d9dc
One arg reverted
WhiteBlackGoose Aug 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/verify-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Verify docs

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

jobs:
verify-docs:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.302'

- name: Run verification script
run: |
dotnet tool restore
dotnet fake build -t verifydocs
42 changes: 41 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ nuget Fake.Api.Github
nuget Fake.DotNet.Testing.Expecto
nuget Fake.Tools.Git //"

#r "FSharp.Compiler.Service.dll"

#if !FAKE
#load "./.fake/build.fsx/intellisense.fsx"
#r "netstandard" // Temp fix for https://github.com/dotnet/fsharp/issues/5216
Expand Down Expand Up @@ -168,6 +170,44 @@ module TestTasks =
) testProject
}


module VerificationTasks =
open FSharp.Compiler.Diagnostics
open BasicTasks

let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] {
let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString())

let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create ()

let ignoredDiagnostics = Set.ofList [
1182; // unused variable
]

targets
|> Seq.map (
fun target ->
checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] )
|> Async.RunSynchronously
|> fst
|> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false)
)
|> Seq.collect id
|> Seq.where (fun c -> not (ignoredDiagnostics.Contains c.ErrorNumber))
|> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName.[..6] (* to only count the numeric part *) )
|> Seq.map (fun diag ->
(match diag.Severity with
| FSharpDiagnosticSeverity.Error -> "--- Error: "
| _ -> "--- Warning: ")
+ diag.ToString())
|> String.concat "\n"
|> (fun errorText ->
match errorText with
| "" -> ()
| text -> raise (System.Exception $"Errors:\n{text}" )
)
}

/// Package creation
module PackageTasks =

Expand Down Expand Up @@ -404,4 +444,4 @@ let _preReleaseNoDocs =
[setPrereleaseTag; clean; build; copyBinaries; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease]

// run copyBinaries by default
BuildTask.runOrDefault copyBinaries
BuildTask.runOrDefault copyBinaries
3 changes: 2 additions & 1 deletion docs/0_0_basics.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The central type that gets created by all Chart constructors is `GenericChart`,
*)

(***do-not-eval***)
[<NoComparison>]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's that for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It yielded a warning that there are types which do not override Equals. So it suggested me adding this attribute.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we can safely ignore that, because this is just a showcase of how the type looks like internally. But ill rework this page anyways so it can stay as it is

type GenericChart =
| Chart of Trace * Layout * Config * DisplayOptions
| MultiChart of Trace list * Layout * Config * DisplayOptions
Expand Down Expand Up @@ -75,7 +76,7 @@ myTrace?x <- [0;1;2] // set the x property (the x dimension of the data)
myTrace?y <- [0;1;2] // set the y property (the y dimension of the data)

GenericChart.ofTraceObject myTrace // create a generic chart (layout and config are empty objects)
|> Chart.Show
|> Chart.show

(**
lets have a look at the trace object that will be created. The relevant section of the html generated with Chart.Show is the following:
Expand Down
20 changes: 10 additions & 10 deletions docs/0_2_display-options.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ let description1 =
(***do-not-eval***)
let desc1 =
Chart.Point(x,y,Name="desc1")
|> Chart.WithDescription(description1)
|> Chart.Show
|> Chart.withDescription(description1)
|> Chart.show

(**

Expand All @@ -71,8 +71,8 @@ let description2 =
(***do-not-eval***)
let desc2 =
Chart.Point(x,y,Name="desc1")
|> Chart.WithDescription(description2)
|> Chart.Show
|> Chart.withDescription(description2)
|> Chart.show

(**

Expand Down Expand Up @@ -108,10 +108,10 @@ let description3 =
(***do-not-eval***)
let desc3 =
Chart.Point(x,y,Name="desc3")
|> Chart.WithDescription description3
|> Chart.withDescription description3
// Add reference to the bulma css framework
|> Chart.WithAdditionalHeadTags ["""<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.2/css/bulma.min.css">"""]
|> Chart.Show
|> Chart.withAdditionalHeadTags ["""<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.2/css/bulma.min.css">"""]
|> Chart.show

(**

Expand All @@ -128,11 +128,11 @@ By popular request, `Chart.WithMathTex` is a prebuilt function to enable MathTeX
Chart.Point([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
Chart.Point([(2.,4.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$")
]
|> Chart.Combine
|> Chart.combine
|> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$"
// include mathtex tags in <head>. pass true to append these scripts, false to ONLY include MathTeX.
|> Chart.WithMathTex(true)
|> Chart.Show
|> Chart.withMathTex(true)
|> Chart.show

(**

Expand Down
22 changes: 11 additions & 11 deletions docs/1_0_axis-styling.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ To style a specific axis of a plot, use the respective `Chart.with*_AxisStyle` f

let plot1 =
Chart.Point(x,y)
|> Chart.withX_AxisStyle ("X axis title", MinMax = (-1.,10.))
|> Chart.withY_AxisStyle ("Y axis title", MinMax = (-1.,10.))
|> Chart.withXAxisStyle ("X axis title", MinMax = (-1.,10.))
|> Chart.withYAxisStyle ("Y axis title", MinMax = (-1.,10.))

(*** condition: ipynb ***)
#if IPYNB
Expand Down Expand Up @@ -83,8 +83,8 @@ let mirroredLogYAxis =

let plot2 =
Chart.Point(x,y)
|> Chart.withX_Axis mirroredXAxis
|> Chart.withY_Axis mirroredLogYAxis
|> Chart.withXAxis mirroredXAxis
|> Chart.withYAxis mirroredLogYAxis

(*** condition: ipynb ***)
#if IPYNB
Expand Down Expand Up @@ -122,13 +122,13 @@ let twoXAxes1 =
anchoredAt1
anchoredAt2
]
|> Chart.Combine
|> Chart.withY_AxisStyle(
|> Chart.combine
|> Chart.withYAxisStyle(
"axis 1",
Side=StyleParam.Side.Left,
Id=1
)
|> Chart.withY_AxisStyle(
|> Chart.withYAxisStyle(
"axis2",
Side=StyleParam.Side.Right,
Id=2,
Expand Down Expand Up @@ -156,16 +156,16 @@ let twoXAxes2 =
anchoredAt1
anchoredAt2
]
|> Chart.Combine
|> Chart.withY_AxisStyle(
|> Chart.combine
|> Chart.withYAxisStyle(
"first y-axis",
ShowLine=true
)
|> Chart.withX_AxisStyle(
|> Chart.withXAxisStyle(
"x-axis",
Domain=(0.3, 1.0) // moves the first axis and the whole plot to the right
)
|> Chart.withY_AxisStyle(
|> Chart.withYAxisStyle(
"second y-axis",
Side=StyleParam.Side.Left,
Id=2,
Expand Down
70 changes: 35 additions & 35 deletions docs/1_2_multiple-charts.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ let combinedChart =
Chart.Line(x,y,Name="first")
Chart.Line(y,x,Name="second")
]
|> Chart.Combine
|> Chart.combine

#if IPYNB
combinedChart
Expand All @@ -77,17 +77,17 @@ You can either use Chart.Grid with a 1 dimensional sequence of Charts and specif
let grid =
[
Chart.Point(x,y,Name="1,1")
|> Chart.withX_AxisStyle "x1"
|> Chart.withY_AxisStyle "y1"
|> Chart.withXAxisStyle "x1"
|> Chart.withYAxisStyle "y1"
Chart.Line(x,y,Name="1,2")
|> Chart.withX_AxisStyle "x2"
|> Chart.withY_AxisStyle "y2"
|> Chart.withXAxisStyle "x2"
|> Chart.withYAxisStyle "y2"
Chart.Spline(x,y,Name="2,1")
|> Chart.withX_AxisStyle "x3"
|> Chart.withY_AxisStyle "y3"
|> Chart.withXAxisStyle "x3"
|> Chart.withYAxisStyle "y3"
Chart.Point(x,y,Name="2,2")
|> Chart.withX_AxisStyle "x4"
|> Chart.withY_AxisStyle "y4"
|> Chart.withXAxisStyle "x4"
|> Chart.withYAxisStyle "y4"
]
|> Chart.Grid(2,2)

Expand All @@ -109,19 +109,19 @@ let grid2 =
[
[
Chart.Point(x,y,Name="1,1")
|> Chart.withX_AxisStyle "x1"
|> Chart.withY_AxisStyle "y1"
|> Chart.withXAxisStyle "x1"
|> Chart.withYAxisStyle "y1"
Chart.Line(x,y,Name="1,2")
|> Chart.withX_AxisStyle "x2"
|> Chart.withY_AxisStyle "y2"
|> Chart.withXAxisStyle "x2"
|> Chart.withYAxisStyle "y2"
]
[
Chart.Spline(x,y,Name="2,1")
|> Chart.withX_AxisStyle "x3"
|> Chart.withY_AxisStyle "y3"
|> Chart.withXAxisStyle "x3"
|> Chart.withYAxisStyle "y3"
Chart.Point(x,y,Name="2,2")
|> Chart.withX_AxisStyle "x4"
|> Chart.withY_AxisStyle "y4"
|> Chart.withXAxisStyle "x4"
|> Chart.withYAxisStyle "y4"

]
]
Expand All @@ -146,18 +146,18 @@ to the row with the highest amount of charts, and the other rows will be filled
let grid3 =
[
Chart.Point(x,y,Name="1,1")
|> Chart.withX_AxisStyle "x1"
|> Chart.withY_AxisStyle "y1"
|> Chart.withXAxisStyle "x1"
|> Chart.withYAxisStyle "y1"

Chart.Invisible()

Chart.Spline(x,y,Name="2,1")
|> Chart.withX_AxisStyle "x3"
|> Chart.withY_AxisStyle "y3"
|> Chart.withXAxisStyle "x3"
|> Chart.withYAxisStyle "y3"

Chart.Point(x,y,Name="2,2")
|> Chart.withX_AxisStyle "x4"
|> Chart.withY_AxisStyle "y4"
|> Chart.withXAxisStyle "x4"
|> Chart.withYAxisStyle "y4"
]
|> Chart.Grid(2,2)

Expand All @@ -178,17 +178,17 @@ use `Pattern=StyleParam.LayoutGridPatter.Coupled` to use one shared x axis per c
let grid4 =
[
Chart.Point(x,y,Name="1,1")
|> Chart.withX_AxisStyle "x1"
|> Chart.withY_AxisStyle "y1"
|> Chart.withXAxisStyle "x1"
|> Chart.withYAxisStyle "y1"
Chart.Line(x,y,Name="1,2")
|> Chart.withX_AxisStyle "x2"
|> Chart.withY_AxisStyle "y2"
|> Chart.withXAxisStyle "x2"
|> Chart.withYAxisStyle "y2"
Chart.Spline(x,y,Name="2,1")
|> Chart.withX_AxisStyle "x3"
|> Chart.withY_AxisStyle "y3"
|> Chart.withXAxisStyle "x3"
|> Chart.withYAxisStyle "y3"
Chart.Point(x,y,Name="2,2")
|> Chart.withX_AxisStyle "x4"
|> Chart.withY_AxisStyle "y4"
|> Chart.withXAxisStyle "x4"
|> Chart.withYAxisStyle "y4"
]
|> Chart.Grid(2,2,Pattern=StyleParam.LayoutGridPattern.Coupled)

Expand All @@ -214,19 +214,19 @@ As with all grid charts, you can also use the Chart.withLayoutGridStyle to style
let singleStack =
[
Chart.Point(x,y)
|> Chart.withY_AxisStyle("This title must")
|> Chart.withYAxisStyle("This title must")

Chart.Line(x,y)
|> Chart.withY_AxisStyle("be set on the")
|> Chart.withYAxisStyle("be set on the")

Chart.Spline(x,y)
|> Chart.withY_AxisStyle("respective subplots")
|> Chart.withYAxisStyle("respective subplots")
]
|> Chart.SingleStack(Pattern= StyleParam.LayoutGridPattern.Coupled)
//increase spacing between plots by using the withLayoutGridStyle function
|> Chart.withLayoutGridStyle(YGap= 0.1)
|> Chart.withTitle("Hi i am the new SingleStackChart")
|> Chart.withX_AxisStyle("im the shared xAxis")
|> Chart.withXAxisStyle("im the shared xAxis")

(*** condition: ipynb ***)
#if IPYNB
Expand Down
4 changes: 2 additions & 2 deletions docs/2_1_bar-and-column-charts.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ let stackedBar =
Chart.StackedBar(keys,values,Name="old");
Chart.StackedBar(keys,[8; 21; 13;],Name="new")
]
|> Chart.Combine
|> Chart.combine

(*** condition: ipynb ***)
#if IPYNB
Expand All @@ -104,7 +104,7 @@ let stackedColumn =
Chart.StackedColumn(keys,values,Name="old");
Chart.StackedColumn(keys,[8; 21; 13;],Name="new")
]
|> Chart.Combine
|> Chart.combine

(*** condition: ipynb ***)
#if IPYNB
Expand Down
2 changes: 1 addition & 1 deletion docs/2_2_area-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ let stackedArea =
Chart.StackedArea(x,y)
Chart.StackedArea(x,y |> Seq.rev)
]
|> Chart.Combine
|> Chart.combine

(*** condition: ipynb ***)
#if IPYNB
Expand Down
6 changes: 3 additions & 3 deletions docs/3_0_3d-scatter-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ let z = [19; 26; 55;]

let scatter3d =
Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers)
|> Chart.withX_AxisStyle("my x-axis")
|> Chart.withY_AxisStyle("my y-axis")
|> Chart.withZ_AxisStyle("my z-axis")
|> Chart.withXAxisStyle("my x-axis")
|> Chart.withYAxisStyle("my y-axis")
|> Chart.withZAxisStyle("my z-axis")
|> Chart.withSize(800.,800.)

(*** condition: ipynb ***)
Expand Down
Loading