From 738c9de3136b4c5a94f815d7bb4ab28f25e4a1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=20=E8=BE=9B?= Date: Thu, 21 Dec 2023 17:29:50 +0800 Subject: [PATCH 1/3] fix: issue620 Updated referenced versions --- .../AngouriMath.Interactive.fsproj | 9 ++++--- .../AngouriMath.Interactive.sln | 25 +++++++++++++++++++ .../Wrappers/AngouriMath.Interactive/Plot.fs | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.sln diff --git a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj index 6eeda4799..721a132d6 100644 --- a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj +++ b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj @@ -24,6 +24,7 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb true + $(AssemblyName) @@ -42,9 +43,9 @@ - - - + + + @@ -55,7 +56,7 @@ - + diff --git a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.sln b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.sln new file mode 100644 index 000000000..ff8ae8b81 --- /dev/null +++ b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "AngouriMath.Interactive", "AngouriMath.Interactive.fsproj", "{F6F9CE60-FDB9-484F-8700-5FD2162CE6C4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6F9CE60-FDB9-484F-8700-5FD2162CE6C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6F9CE60-FDB9-484F-8700-5FD2162CE6C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6F9CE60-FDB9-484F-8700-5FD2162CE6C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6F9CE60-FDB9-484F-8700-5FD2162CE6C4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {984A729C-5ACD-41B4-8704-78CAFBB4FE65} + EndGlobalSection +EndGlobal diff --git a/Sources/Wrappers/AngouriMath.Interactive/Plot.fs b/Sources/Wrappers/AngouriMath.Interactive/Plot.fs index 8cab7b14d..5ebafbb70 100644 --- a/Sources/Wrappers/AngouriMath.Interactive/Plot.fs +++ b/Sources/Wrappers/AngouriMath.Interactive/Plot.fs @@ -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 From 66ce7f83eb2f77f4cd3370f72740a5f5b1dd5edb Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Fri, 2 Jan 2026 22:12:49 +0800 Subject: [PATCH 2/3] Update to Plotly v6 --- .../AngouriMath.Interactive/AngouriMath.Interactive.fsproj | 2 +- Sources/Wrappers/AngouriMath.Interactive/KernelExtension.fs | 4 +--- Sources/Wrappers/AngouriMath.Interactive/Plot.fs | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj index 1c6e13707..0400c7495 100644 --- a/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj +++ b/Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj @@ -42,7 +42,7 @@ - + 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 d55660515..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 @@ -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) = From 10ffdfb9acbee6c0acbf621b67aba1c4370a5226 Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Fri, 2 Jan 2026 22:24:03 +0800 Subject: [PATCH 3/3] Fix in Terminal Lib too --- .../AngouriMath.Terminal.Lib/FSharpInteractive.fs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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