Skip to content

Commit d3f5033

Browse files
authored
Merge pull request #24 from muehlhaus/master
sync with master (whoopsie)
2 parents aa3b605 + fa47224 commit d3f5033

File tree

8 files changed

+458
-43
lines changed

8 files changed

+458
-43
lines changed

.paket/Paket.Restore.targets

+68-41
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
88

99
<DetectedMSBuildVersion>$(MSBuildVersion)</DetectedMSBuildVersion>
10-
<DetectedMSBuildVersion Condition="$(MSBuildVersion) == ''">15.0.0</DetectedMSBuildVersion>
10+
<DetectedMSBuildVersion Condition="'$(MSBuildVersion)' == ''">15.0.0</DetectedMSBuildVersion>
1111
<MSBuildSupportsHashing>false</MSBuildSupportsHashing>
1212
<MSBuildSupportsHashing Condition=" '$(DetectedMSBuildVersion)' &gt; '15.8.0' ">true</MSBuildSupportsHashing>
1313
<!-- Mark that this target file has been loaded. -->
@@ -20,59 +20,86 @@
2020
<PaketBootstrapperStyle Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">proj</PaketBootstrapperStyle>
2121
<PaketExeImage>assembly</PaketExeImage>
2222
<PaketExeImage Condition=" '$(PaketBootstrapperStyle)' == 'proj' ">native</PaketExeImage>
23-
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
23+
<MonoPath Condition="'$(MonoPath)' == '' AND Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
2424
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
2525

2626
<!-- PaketBootStrapper -->
2727
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2828
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2929
<PaketBootStrapperExeDir Condition=" Exists('$(PaketBootStrapperExePath)') " >$([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\</PaketBootStrapperExeDir>
30+
31+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT' ">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
32+
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
33+
34+
<!-- Disable Paket restore under NCrunch build -->
35+
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
3036

31-
<!-- Paket -->
37+
<!-- Disable test for CLI tool completely - overrideable via properties in projects or via environment variables -->
38+
<PaketDisableCliTest Condition=" '$(PaketDisableCliTest)' == '' ">False</PaketDisableCliTest>
3239

33-
<!-- windows, root => tool => proj style => bootstrapper => global -->
34-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
35-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
36-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket.exe</PaketExePath>
37-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(_PaketBootStrapperExeDir)paket.exe</PaketExePath>
38-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' ">paket.exe</PaketExePath>
40+
<PaketIntermediateOutputPath Condition=" '$(PaketIntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))</PaketIntermediateOutputPath>
41+
</PropertyGroup>
3942

40-
<!-- no windows, try native paket as default, root => tool => proj style => mono paket => bootstrpper => global -->
41-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
42-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
43-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
43+
<!-- Resolve how paket should be called -->
44+
<!-- Current priority is: local (1: repo root, 2: .paket folder) => 3: as CLI tool => as bootstrapper (4: proj Bootstrapper style, 5: BootstrapperExeDir) => 6: global path variable -->
45+
<Target Name="SetPaketCommand" >
46+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 1/2 - non-windows specific -->
47+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
48+
<!-- no windows, try native paket as default, root => tool -->
49+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
50+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
51+
</PropertyGroup>
4452

45-
<!-- no windows, try mono paket -->
46-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
47-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
53+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 2/2 - same across platforms -->
54+
<PropertyGroup>
55+
<!-- root => tool -->
56+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
57+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
58+
</PropertyGroup>
4859

49-
<!-- no windows, try bootstrapper -->
50-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket.exe</PaketExePath>
60+
<!-- If paket hasn't be found in standard locations, test for CLI tool usage. -->
61+
<!-- First test: Is CLI configured to be used in "dotnet-tools.json"? - can result in a false negative; only a positive outcome is reliable. -->
62+
<PropertyGroup Condition=" '$(PaketExePath)' == '' ">
63+
<_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json"))</_DotnetToolsJson>
64+
<_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"'))</_ConfigContainsPaket>
65+
<_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false</_ConfigContainsPaket>
66+
</PropertyGroup>
5167

52-
<!-- no windows, try global native paket -->
53-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' ">paket</PaketExePath>
68+
<!-- Second test: Call 'dotnet paket' and see if it returns without an error. Mute all the output. Only run if previous test failed and the test has not been disabled. -->
69+
<!-- WARNING: This method can lead to processes hanging forever, and should be used as little as possible. See https://github.com/fsprojects/Paket/issues/3705 for details. -->
70+
<Exec Condition=" '$(PaketExePath)' == '' AND !$(PaketDisableCliTest) AND !$(_ConfigContainsPaket)" Command="dotnet paket --version" IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" >
71+
<Output TaskParameter="ExitCode" PropertyName="LocalPaketToolExitCode" />
72+
</Exec>
5473

55-
<!-- Paket command -->
56-
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
57-
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
58-
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
59-
<PaketCommand Condition=" '$(PaketCommand)' == '' ">"$(PaketExePath)"</PaketCommand>
74+
<!-- If paket is installed as CLI use that. Again, only if paket haven't already been found in standard locations. -->
75+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND ($(_ConfigContainsPaket) OR '$(LocalPaketToolExitCode)' == '0') ">
76+
<_PaketCommand>dotnet paket</_PaketCommand>
77+
</PropertyGroup>
6078

79+
<!-- If neither local files nor CLI tool can be found, final attempt is searching for boostrapper config before falling back to global path variable. -->
80+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND '$(_PaketCommand)' == '' ">
81+
<!-- Test for bootstrapper setup -->
82+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
83+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket</PaketExePath>
6184

62-
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
63-
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
85+
<!-- If all else fails, use global path approach. -->
86+
<PaketExePath Condition=" '$(PaketExePath)' == ''">paket</PaketExePath>
87+
</PropertyGroup>
6488

65-
<!-- Disable automagic references for F# dotnet sdk -->
66-
<!-- This will not do anything for other project types -->
67-
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
68-
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
69-
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
89+
<!-- If not using CLI, setup correct execution command. -->
90+
<PropertyGroup Condition=" '$(_PaketCommand)' == '' ">
91+
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
92+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</_PaketCommand>
93+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</_PaketCommand>
94+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)"</_PaketCommand>
95+
</PropertyGroup>
7096

71-
<!-- Disable Paket restore under NCrunch build -->
72-
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
97+
<!-- The way to get a property to be available outside the target is to use this task. -->
98+
<CreateProperty Value="$(_PaketCommand)">
99+
<Output TaskParameter="Value" PropertyName="PaketCommand"/>
100+
</CreateProperty>
73101

74-
<PaketIntermediateOutputPath Condition=" '$(PaketIntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))</PaketIntermediateOutputPath>
75-
</PropertyGroup>
102+
</Target>
76103

77104
<Target Name="PaketBootstrapping" Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">
78105
<MSBuild Projects="$(PaketToolsPath)paket.bootstrapper.proj" Targets="Restore" />
@@ -81,7 +108,7 @@
81108
<!-- Official workaround for https://docs.microsoft.com/en-us/visualstudio/msbuild/getfilehash-task?view=vs-2019 -->
82109
<UsingTask TaskName="Microsoft.Build.Tasks.GetFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
83110
<UsingTask TaskName="Microsoft.Build.Tasks.VerifyFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
84-
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="PaketBootstrapping">
111+
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="SetPaketCommand;PaketBootstrapping">
85112

86113
<!-- Step 1 Check if lockfile is properly restored (if the hash of the lockfile and the cache-file match) -->
87114
<PropertyGroup>
@@ -203,7 +230,7 @@
203230
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
204231
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
205232
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
206-
<CopyLocal Condition="'$(Splits)' == '6'">$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
233+
<CopyLocal Condition="'%(PaketReferencesFileLinesInfo.Splits)' == '6'">$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
207234
</PaketReferencesFileLinesInfo>
208235
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
209236
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
@@ -246,7 +273,7 @@
246273
</PropertyGroup>
247274
</Target>
248275

249-
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(PaketIntermediateOutputPath)/$(MSBuildProjectFile).references')" >
276+
<Target Name="PaketOverrideNuspec" DependsOnTargets="SetPaketCommand" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(PaketIntermediateOutputPath)/$(MSBuildProjectFile).references')" >
250277
<ItemGroup>
251278
<_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/>
252279
<MSBuildMajorVersion Include="$(DetectedMSBuildVersion.Replace(`-`, `.`).Split(`.`)[0])" />
@@ -300,7 +327,7 @@
300327
DevelopmentDependency="$(DevelopmentDependency)"
301328
BuildOutputInPackage="@(_BuildOutputInPackage)"
302329
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
303-
SymbolPackageFormat="symbols.nupkg"
330+
SymbolPackageFormat="$(SymbolPackageFormat)"
304331
TargetFrameworks="@(_TargetFrameworks)"
305332
AssemblyName="$(AssemblyName)"
306333
PackageOutputPath="$(PackageOutputAbsolutePath)"
@@ -347,7 +374,7 @@
347374
DevelopmentDependency="$(DevelopmentDependency)"
348375
BuildOutputInPackage="@(_BuildOutputInPackage)"
349376
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
350-
SymbolPackageFormat="symbols.nupkg"
377+
SymbolPackageFormat="$(SymbolPackageFormat)"
351378
TargetFrameworks="@(_TargetFrameworks)"
352379
AssemblyName="$(AssemblyName)"
353380
PackageOutputPath="$(PackageOutputAbsolutePath)"

FSharp.Plotly.sln

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 15
3-
VisualStudioVersion = 15.0.27703.2000
2+
# Visual Studio Version 16
3+
VisualStudioVersion = 16.0.29613.14
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B98-5CED-492C-A5B7-A5B4F73CF142}"
66
ProjectSection(SolutionItems) = preProject
@@ -36,6 +36,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D
3636
docsrc\content\bar-charts.fsx = docsrc\content\bar-charts.fsx
3737
docsrc\content\box-plots.fsx = docsrc\content\box-plots.fsx
3838
docsrc\content\bubble-charts.fsx = docsrc\content\bubble-charts.fsx
39+
docsrc\content\candlestick.fsx = docsrc\content\candlestick.fsx
3940
docsrc\content\choropleth-map.fsx = docsrc\content\choropleth-map.fsx
4041
docsrc\content\contour-plots.fsx = docsrc\content\contour-plots.fsx
4142
docsrc\content\errorbars.fsx = docsrc\content\errorbars.fsx
@@ -51,6 +52,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D
5152
docsrc\content\plotly-wpf.fsx = docsrc\content\plotly-wpf.fsx
5253
docsrc\content\polar-charts.fsx = docsrc\content\polar-charts.fsx
5354
docsrc\content\range-plots.fsx = docsrc\content\range-plots.fsx
55+
docsrc\content\sankey.fsx = docsrc\content\sankey.fsx
5456
docsrc\content\shapes.fsx = docsrc\content\shapes.fsx
5557
docsrc\content\splom.fsx = docsrc\content\splom.fsx
5658
docsrc\content\violin-plots.fsx = docsrc\content\violin-plots.fsx

docsrc/content/candlestick.fsx

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
(*** hide ***)
2+
#r "netstandard"
3+
#r @"../../lib/Formatting/FSharp.Plotly.dll"
4+
5+
(**
6+
# FSharp.Plotly: Candlestick Charts
7+
8+
*Summary:* This example shows how to create candlestick charts in F#.
9+
10+
A candlestick chart is useful for plotting stock prices over time. A candle
11+
is a group of high, open, close and low values over a period of time, e.g. 1 minute, 5 minute, hour, day, etc..
12+
The x-axis is usually dateime values and y is a sequence of candle structures.
13+
*)
14+
15+
open FSharp.Plotly
16+
open FSharp.Plotly.StyleParam
17+
18+
let candles =
19+
[|("2020-01-17T13:40:00", 0.68888, 0.68888, 0.68879, 0.6888);
20+
("2020-01-17T13:41:00", 0.68883, 0.68884, 0.68875, 0.68877);
21+
("2020-01-17T13:42:00", 0.68878, 0.68889, 0.68878, 0.68886);
22+
("2020-01-17T13:43:00", 0.68886, 0.68886, 0.68876, 0.68879);
23+
("2020-01-17T13:44:00", 0.68879, 0.68879, 0.68873, 0.68874);
24+
("2020-01-17T13:45:00", 0.68875, 0.68877, 0.68867, 0.68868);
25+
("2020-01-17T13:46:00", 0.68869, 0.68887, 0.68869, 0.68883);
26+
("2020-01-17T13:47:00", 0.68883, 0.68899, 0.68883, 0.68899);
27+
("2020-01-17T13:48:00", 0.68898, 0.689, 0.68885, 0.68889);
28+
("2020-01-17T13:49:00", 0.68889, 0.68893, 0.68881, 0.68893);
29+
("2020-01-17T13:50:00", 0.68891, 0.68896, 0.68886, 0.68891);
30+
|]
31+
|> Array.map (fun (d,o,h,l,c)->System.DateTime.Parse d, Candle.Create(o,h,l,c))
32+
33+
34+
let ch1 = candles |> Chart.Candelstick
35+
36+
37+
(***do-not-eval***)
38+
ch1 |> Chart.Show
39+
40+
(*** include-value:ch1 ***)
41+
42+

docsrc/content/sankey.fsx

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
(*** hide ***)
2+
#r "netstandard"
3+
#r @"../../lib/Formatting/FSharp.Plotly.dll"
4+
5+
(**
6+
# FSharp.Plotly: Sankey Charts
7+
8+
*Summary:* This example shows how to create sankey charts in F#.
9+
10+
Sankey charts are a visualization of multiple, linked graphs layed out linearly.
11+
These are usually used to depict flow between nodes or stations.
12+
To create Sankey, a set of nodes and links between them are required.
13+
These are created using the provided Node and Link structures.
14+
*)
15+
16+
open FSharp.Plotly
17+
open FSharp.Plotly.StyleParam
18+
let n1 = Node.Create("a",color="Black")
19+
let n2 = Node.Create("b",color="Red")
20+
let n3 = Node.Create("c",color="Purple")
21+
let n4 = Node.Create("d",color="Green")
22+
let n5 = Node.Create("e",color="Orange")
23+
let link1 = Link.Create(n1,n2,value=1.0)
24+
let link2 = Link.Create(n2,n3,value=2.0)
25+
let link3 = Link.Create(n1,n5,value=1.3)
26+
let link4 = Link.Create(n4,n5,value=1.5)
27+
let link5 = Link.Create(n3,n5,value=0.5)
28+
29+
let ch1 =
30+
Chart.Sankey([n1;n2;n3;n4;n5],[link1;link2;link3;link4;link5])
31+
|> Chart.withTitle "Sankey Sample"
32+
33+
34+
(***do-not-eval***)
35+
ch1 |> Chart.Show
36+
37+
(*** include-value:ch1 ***)
38+

lib/Formatting/FSharp.Plotly.dll

35 KB
Binary file not shown.

0 commit comments

Comments
 (0)