Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Plotly.NET" Version="5.1.0" />
|
||||||
|
<PackageReference Include="Plotly.NET.ImageExport" Version="6.1.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
open Plotly.NET
|
||||||
|
open Plotly.NET.ImageExport
|
||||||
|
|
||||||
|
[<EntryPoint>]
|
||||||
|
let main argv =
|
||||||
|
let chromePathEnvOpt =
|
||||||
|
System.Environment.GetEnvironmentVariable("GOOGLE_CHROME")
|
||||||
|
|> Option.ofObj
|
||||||
|
|
||||||
|
let chromePathOpt: string option =
|
||||||
|
if argv.Length >= 1 then
|
||||||
|
Some (argv[0])
|
||||||
|
else
|
||||||
|
chromePathEnvOpt
|
||||||
|
|
||||||
|
match chromePathOpt with
|
||||||
|
| Some chromePath ->
|
||||||
|
PuppeteerSharpRendererOptions.localBrowserExecutablePath <- Some chromePath
|
||||||
|
|
||||||
|
let chart =
|
||||||
|
Chart.Point (
|
||||||
|
x = [ 0 .. 10 ],
|
||||||
|
y = [ 0 .. 10 ]
|
||||||
|
)
|
||||||
|
|> Chart.withTitle "Hello world!"
|
||||||
|
|
||||||
|
try
|
||||||
|
do chart |> Chart.savePNG("test")
|
||||||
|
with e ->
|
||||||
|
eprintfn "Error saving PNG: %s" e.Message
|
||||||
|
| None ->
|
||||||
|
eprintfn "Usage: <chrome-path> or define GOOLE_CHROME with path to binary"
|
||||||
|
|
||||||
|
0
|
||||||
Reference in New Issue
Block a user