Skip to content

Instantly share code, notes, and snippets.

@HarryMcCarney
Created July 13, 2023 06:29
Show Gist options
  • Save HarryMcCarney/30aa24e7999b6674b92c91b23a9dd530 to your computer and use it in GitHub Desktop.
Save HarryMcCarney/30aa24e7999b6674b92c91b23a9dd530 to your computer and use it in GitHub Desktop.
#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