diff --git a/Sources/Terminal/AngouriMath.Terminal.Lib/FSharpInteractive.fs b/Sources/Terminal/AngouriMath.Terminal.Lib/FSharpInteractive.fs index 115e3bc5a..7fa253e60 100644 --- a/Sources/Terminal/AngouriMath.Terminal.Lib/FSharpInteractive.fs +++ b/Sources/Terminal/AngouriMath.Terminal.Lib/FSharpInteractive.fs @@ -23,10 +23,10 @@ JsonFSharpConverter () |> options.Converters.Add let private objectEncode (o : obj) = match o with | :? ILatexiseable as latexiseable -> - let toSerialize = LatexSuccess (latexiseable.Latexise (), o.ToString ()) + let toSerialize = LatexSuccess (latexiseable.Latexise (), string o) EncodingLatexPrefix + JsonSerializer.Serialize(toSerialize, options) | _ -> - let toSerialize = PlainTextSuccess (o.ToString ()) + let toSerialize = PlainTextSuccess (string o) EncodingPlainPrefix + JsonSerializer.Serialize(toSerialize, options) @@ -34,9 +34,9 @@ let private objectDecode (s : string Option) = match s with | None -> VoidSuccess | Some plain when plain.StartsWith EncodingPlainPrefix -> - JsonSerializer.Deserialize (plain.[EncodingPlainPrefix.Length..], options) + JsonSerializer.Deserialize (plain.[EncodingPlainPrefix.Length..], options) |> nonNull | Some latex when latex.StartsWith EncodingLatexPrefix -> - JsonSerializer.Deserialize (latex.[EncodingLatexPrefix.Length..], options) + JsonSerializer.Deserialize (latex.[EncodingLatexPrefix.Length..], options) |> nonNull | _ -> VoidSuccess let execute (kernel : FSharpKernel) code = @@ -82,7 +82,7 @@ let createKernel () = |> Chart.withSize (1200., 900.) |> Chart.show "Showing in the browser") - |> (fun f -> Func f) + |> (fun f -> Func f) |> (fun f -> - Formatter.Register (f, "text/plain")) + Formatter.Register (f, "text/plain")) } \ No newline at end of file diff --git a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj index 1fd873aca..0400c7495 100644 --- a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj +++ b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj @@ -40,9 +40,9 @@ - - - + + + @@ -51,5 +51,4 @@ interactive-extensions/dotnet - diff --git a/Sources/Wrappers/AngouriMath.Interactive/KernelExtension.fs b/Sources/Wrappers/AngouriMath.Interactive/KernelExtension.fs index 2fff916e5..b8b1bd0da 100644 --- a/Sources/Wrappers/AngouriMath.Interactive/KernelExtension.fs +++ b/Sources/Wrappers/AngouriMath.Interactive/KernelExtension.fs @@ -7,7 +7,7 @@ open System.Threading.Tasks open PeterO.Numbers open System open Plotly.NET -open Plotly.NET.GenericChart +open type Plotly.NET.GenericChart open AngouriMath.FSharp.Functions type KernelExtension() = @@ -43,8 +43,6 @@ type KernelExtension() = Formatter.SetPreferredMimeTypesFor(typeof, "text/html") Formatter.Register (toChartHTML, "text/html") - - interface IKernelExtension with member _.OnLoadAsync _ = KernelExtension.applyMagic() diff --git a/Sources/Wrappers/AngouriMath.Interactive/Plot.fs b/Sources/Wrappers/AngouriMath.Interactive/Plot.fs index 046016e5a..ab6f666c6 100644 --- a/Sources/Wrappers/AngouriMath.Interactive/Plot.fs +++ b/Sources/Wrappers/AngouriMath.Interactive/Plot.fs @@ -187,7 +187,7 @@ let private castAs<'a, 'b when 'a : not null> (a : 'a) : 'b = let up : obj = a :> obj up :?> 'b -let private withSliderND<'a, 'b> n (chartPlotter : 'a -> obj -> GenericChart.GenericChart) (ranges : 'a) (paramRange : double seq) (param : obj) (func : obj) = +let private withSliderND<'a, 'b> n (chartPlotter : 'a -> obj -> GenericChart) (ranges : 'a) (paramRange : double seq) (param : obj) (func : obj) = let var = symbol param let compiled = match n with @@ -210,7 +210,7 @@ let private withSliderND<'a, 'b> n (chartPlotter : 'a -> obj -> GenericChart.Gen |> Seq.map (fun step -> let newFunc = compiled step chartPlotter ranges newFunc - |> Chart.withTraceName(Visible = if step = Seq.head paramRange then StyleParam.Visible.True else StyleParam.Visible.False) + |> Chart.withTraceInfo(Visible = if step = Seq.head paramRange then StyleParam.Visible.True else StyleParam.Visible.False) ) |> GenericChart.combine let slider = getSlider paramRange @@ -219,10 +219,10 @@ let private withSliderND<'a, 'b> n (chartPlotter : 'a -> obj -> GenericChart.Gen |> Chart.withSlider slider |> withTransparency -let withSlider2D (chartPlotter : double seq -> obj -> GenericChart.GenericChart) (range : double seq) (paramRange : double seq) (param : obj) (func : obj) = +let withSlider2D (chartPlotter : double seq -> obj -> GenericChart) (range : double seq) (paramRange : double seq) (param : obj) (func : obj) = withSliderND 1 chartPlotter range paramRange param func -let withSlider3D (chartPlotter : double seq -> double seq -> obj -> GenericChart.GenericChart) (range1 : double seq) (range2 : double seq) (paramRange : double seq) (param : obj) (func : obj) = +let withSlider3D (chartPlotter : double seq -> double seq -> obj -> GenericChart) (range1 : double seq) (range2 : double seq) (paramRange : double seq) (param : obj) (func : obj) = withSliderND 2 (fun (r1, r2) f -> chartPlotter r1 r2 f) (range1, range2) paramRange param func let linear (range : double seq) (func : obj) =