Created
July 13, 2023 06:29
-
-
Save HarryMcCarney/30aa24e7999b6674b92c91b23a9dd530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget: Feliz.ViewEngine" | |
#r "nuget: Plotly.NET" | |
open Feliz.ViewEngine | |
open System | |
open System.Diagnostics | |
open System.IO | |
open Plotly.NET | |
let displayCharts charts = | |
let build charts = | |
Html.html [ | |
Html.head [ Html.title "Charts" ] | |
Html.body [ | |
for c in (charts|> Seq.rev) do | |
prop.dangerouslySetInnerHTML (c |> GenericChart.toEmbeddedHTML) | |
] | |
] | |
let document = Render.htmlDocument (build charts) | |
let fileName = sprintf "%s%s%s" (Path.GetTempPath()) (Guid.NewGuid().ToString()) ".html" | |
File.WriteAllText(fileName, document) | |
let psi = new ProcessStartInfo(UseShellExecute = true, FileName = fileName) | |
let p = new Process(StartInfo = psi) | |
p.Start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment