forked from plotly/Plotly.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtension.fs
More file actions
29 lines (21 loc) · 859 Bytes
/
Extension.fs
File metadata and controls
29 lines (21 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace Plotly.NET.Interactive
open System.Threading.Tasks
open Microsoft.DotNet.Interactive
open Microsoft.DotNet.Interactive.Formatting
open Plotly.NET.GenericChart
type FormatterKernelExtension() =
let registerFormatter () =
Formatter.Register<GenericChart>
((fun chart writer ->
let html = toChartHTML chart
writer.Write(html)),
HtmlFormatter.MimeType)
interface IKernelExtension with
member _.OnLoadAsync _ =
registerFormatter ()
if isNull KernelInvocationContext.Current |> not then
let message =
"Added Kernel Extension including formatters for GenericChart"
KernelInvocationContext.Current.Display(message, "text/markdown")
|> ignore
Task.CompletedTask