Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to DynamicObj v4 #472

Merged
merged 18 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use DynObj module with inlined functions
  • Loading branch information
kMutagene committed Oct 15, 2024
commit 36781a36d45785aa00b812851d66f4c63ecd2a88
8 changes: 4 additions & 4 deletions src/Plotly.NET/InternalUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module DynObj =
else
dyn |> DynObj.setOptionalProperty propName single

let withOptionalSingleOrMultiProperty (propName: string) (single: 'A option, multi: seq<'A> option) (dyn: #DynamicObj) =
let inline withOptionalSingleOrMultiProperty (propName: string) (single: 'A option, multi: seq<'A> option) (dyn: #DynamicObj) =
dyn |> setOptionalSingleOrMultiProperty propName (single,multi)
dyn

Expand All @@ -54,7 +54,7 @@ module DynObj =
else
dyn |> DynObj.setOptionalPropertyBy propName single f

let withOptionalSingleOrMultiPropertyBy
let inline withOptionalSingleOrMultiPropertyBy
(propName: string)
(single: 'A option, multi: seq<'A> option)
(f: 'A -> 'B)
Expand All @@ -69,7 +69,7 @@ module DynObj =
else
dyn |> DynObj.setOptionalProperty propName single

let withOptionalSingleOrAnyProperty (propName: string) (single: 'A option, any: 'B option) (dyn: #DynamicObj) =
let inline withOptionalSingleOrAnyProperty (propName: string) (single: 'A option, any: 'B option) (dyn: #DynamicObj) =
dyn |> setOptionalSingleOrAnyProperty propName (single, any)
dyn

Expand All @@ -85,7 +85,7 @@ module DynObj =
else
dyn |> DynObj.setOptionalPropertyBy propName single singleF

let withOptionalSingleOrAnyPropertyBy
let inline withOptionalSingleOrAnyPropertyBy
(propName: string)
(single: 'A option, any: 'B option)
(singleF: 'A -> 'C)
Expand Down
22 changes: 11 additions & 11 deletions src/Plotly.NET/Layout/Layout.fs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ type Layout() =
| StyleParam.SubPlotId.YAxis _ ->
let axis' =
match Layout.tryGetLinearAxisById id layout with
| Some a -> (DynObj.combine a axis) :?> LinearAxis
| Some a -> DynObj.combine a axis
| None -> axis
layout
|> DynObj.withProperty (StyleParam.SubPlotId.toString id) axis'
Expand Down Expand Up @@ -639,7 +639,7 @@ type Layout() =
(fun (layout: Layout) ->
let scene' =
match Layout.tryGetSceneById id layout with
| Some a -> (DynObj.combine a scene) :?> Scene
| Some a -> DynObj.combine a scene
| None -> scene
layout
|> DynObj.withProperty (StyleParam.SubPlotId.toString id) scene'
Expand Down Expand Up @@ -695,7 +695,7 @@ type Layout() =
(fun (layout: Layout) ->
let geo' =
match Layout.tryGetGeoById id layout with
| Some a -> (DynObj.combine a geo) :?> Geo
| Some a -> DynObj.combine a geo
| None -> geo

layout|> DynObj.withProperty (StyleParam.SubPlotId.toString id) geo'
Expand Down Expand Up @@ -750,7 +750,7 @@ type Layout() =
(fun (layout: Layout) ->
let mapbox' =
match Layout.tryGetMapboxById id layout with
| Some a -> (DynObj.combine a mapbox) :?> Mapbox
| Some a -> DynObj.combine a mapbox
| None -> mapbox

layout |> DynObj.withProperty (StyleParam.SubPlotId.toString id) mapbox'
Expand Down Expand Up @@ -806,7 +806,7 @@ type Layout() =

let polar' =
match layout |> Layout.tryGetPolarById (id) with
| Some a -> (DynObj.combine a polar) :?> Polar
| Some a -> DynObj.combine a polar
| None -> polar

layout |> DynObj.withProperty (StyleParam.SubPlotId.toString id) polar'
Expand Down Expand Up @@ -861,8 +861,8 @@ type Layout() =
(fun (layout: Layout) ->

let smith' =
match layout |> Layout.tryGetPolarById (id) with
| Some a -> (DynObj.combine a smith) :?> Smith
match layout |> Layout.tryGetSmithById (id) with
| Some a -> DynObj.combine a smith
| None -> smith

layout |> DynObj.withProperty (StyleParam.SubPlotId.toString id) smith'
Expand Down Expand Up @@ -918,7 +918,7 @@ type Layout() =

let colorAxis' =
match layout |> Layout.tryGetColorAxisById (id) with
| Some a -> (DynObj.combine a colorAxis) :?> ColorAxis
| Some a -> DynObj.combine a colorAxis
| None -> colorAxis

layout |> DynObj.withProperty (StyleParam.SubPlotId.toString id) colorAxis'
Expand Down Expand Up @@ -974,7 +974,7 @@ type Layout() =

let ternary' =
match layout |> Layout.tryGetTernaryById (id) with
| Some a -> (DynObj.combine a ternary) :?> Ternary
| Some a -> DynObj.combine a ternary
| None -> ternary

layout |> DynObj.withProperty (StyleParam.SubPlotId.toString id) ternary'
Expand Down Expand Up @@ -1038,7 +1038,7 @@ type Layout() =
static member updateLayoutGrid(layoutGrid: LayoutGrid) =
(fun (layout: Layout) ->
let combined =
(DynObj.combine (layout |> Layout.getLayoutGrid) layoutGrid) :?> LayoutGrid
DynObj.combine (layout |> Layout.getLayoutGrid) layoutGrid

layout |> Layout.setLayoutGrid combined)

Expand Down Expand Up @@ -1076,7 +1076,7 @@ type Layout() =

let legend' =
match Layout.tryGetLegendById id layout with
| Some l -> (DynObj.combine l legend) :?> Legend
| Some l -> DynObj.combine l legend
| None -> legend

layout |> DynObj.withProperty (StyleParam.SubPlotId.toString id) legend'
Expand Down
2 changes: 1 addition & 1 deletion src/Plotly.NET/Plotly.NET.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="DynamicObj" Version="[4.0.0, 5.0.0)" />
<PackageReference Include="DynamicObj" Version="[4.0.1, 5.0.0)" />
<PackageReference Include="Giraffe.ViewEngine.StrongName" Version="2.0.0-alpha1" />
</ItemGroup>
</Project>