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
wip port traceobjects to dynObj v4
  • Loading branch information
kMutagene committed Oct 14, 2024
commit 730240f0b503297e9800d5969674c1507850d650
10 changes: 5 additions & 5 deletions src/Plotly.NET/Traces/ObjectAbstractions/Bins.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ type Bins() =
[<Optional; DefaultParameterValue(null)>] ?Size: float
) =

(fun (bins: Bins) ->
Start |> DynObj.setOptionalProperty bins "start"
End |> DynObj.setOptionalProperty bins "end"
Size |> DynObj.setOptionalProperty bins "size"
fun (bins: Bins) ->

bins)
bins
|> DynObj.withOptionalProperty "start" Start
|> DynObj.withOptionalProperty "end" End
|> DynObj.withOptionalProperty "size" Size
14 changes: 6 additions & 8 deletions src/Plotly.NET/Traces/ObjectAbstractions/Box.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ type Box() =
[<Optional; DefaultParameterValue(null)>] ?LineColor: Color,
[<Optional; DefaultParameterValue(null)>] ?LineWidth: float
) =
(fun (box: Box) ->
fun (box: Box) ->

let line =
if LineColor.IsSome || LineWidth.IsSome then
Some(Line.init (?Color = LineColor, ?Width = LineWidth))
else
None

Visible |> DynObj.setOptionalProperty box "visible"
Width |> DynObj.setOptionalProperty box "width"
FillColor |> DynObj.setOptionalProperty box "fillcolor"
line |> DynObj.setOptionalProperty box "line"

// out ->
box)
box
|> DynObj.withOptionalProperty "visible" Visible
|> DynObj.withOptionalProperty "width" Width
|> DynObj.withOptionalProperty "fillcolor" FillColor
|> DynObj.withOptionalProperty "line" line
12 changes: 5 additions & 7 deletions src/Plotly.NET/Traces/ObjectAbstractions/Caps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ type CapFill() =

fun (capFill: CapFill) ->

Fill |> DynObj.setOptionalProperty capFill "fill"
Show |> DynObj.setOptionalProperty capFill "show"

capFill
|> DynObj.withOptionalProperty "fill" Fill
|> DynObj.withOptionalProperty "show" Show


type Caps() =
Expand All @@ -50,8 +49,7 @@ type Caps() =
) =
fun (caps: Caps) ->

X |> DynObj.setOptionalProperty caps "x"
Y |> DynObj.setOptionalProperty caps "y"
Z |> DynObj.setOptionalProperty caps "z"

caps
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalProperty "y" Y
|> DynObj.withOptionalProperty "z" Z
71 changes: 34 additions & 37 deletions src/Plotly.NET/Traces/ObjectAbstractions/Contours.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ type ContourProject() =

fun (contourProject: ContourProject) ->

X |> DynObj.setOptionalProperty contourProject "x"
Y |> DynObj.setOptionalProperty contourProject "y"
Z |> DynObj.setOptionalProperty contourProject "z"

contourProject
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalProperty "y" Y
|> DynObj.withOptionalProperty "z" Z

/// Contour object inherits from dynamic object
type Contour() =
Expand Down Expand Up @@ -86,21 +85,19 @@ type Contour() =
[<Optional; DefaultParameterValue(null)>] ?Width: float
) =

(fun (contour: Contour) ->
Color |> DynObj.setOptionalProperty contour "color"
End |> DynObj.setOptionalProperty contour "end"
Highlight |> DynObj.setOptionalProperty contour "highlight"
HighlightColor |> DynObj.setOptionalProperty contour "highlightcolor"
HighlightWidth |> DynObj.setOptionalProperty contour "highlightwidth"
Project |> DynObj.setOptionalProperty contour "project"
Show |> DynObj.setOptionalProperty contour "show"
Size |> DynObj.setOptionalProperty contour "size"
Start |> DynObj.setOptionalProperty contour "start"
UseColorMap |> DynObj.setOptionalProperty contour "usecolormap"
Width |> DynObj.setOptionalProperty contour "width"


contour)
fun (contour: Contour) ->
contour
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "end" End
|> DynObj.withOptionalProperty "highlight" Highlight
|> DynObj.withOptionalProperty "highlightcolor" HighlightColor
|> DynObj.withOptionalProperty "highlightwidth" HighlightWidth
|> DynObj.withOptionalProperty "project" Project
|> DynObj.withOptionalProperty "show" Show
|> DynObj.withOptionalProperty "size" Size
|> DynObj.withOptionalProperty "start" Start
|> DynObj.withOptionalProperty "usecolormap" UseColorMap
|> DynObj.withOptionalProperty "width" Width

/// Contours type inherits from dynamic object
type Contours() =
Expand Down Expand Up @@ -167,24 +164,24 @@ type Contours() =
[<Optional; DefaultParameterValue(null)>] ?Value: #IConvertible
) =

(fun (contours: Contours) ->
X |> DynObj.setOptionalProperty contours "x"
Y |> DynObj.setOptionalProperty contours "y"
Z |> DynObj.setOptionalProperty contours "z"
Coloring |> DynObj.setOptionalPropertyBy contours "coloring" StyleParam.ContourColoring.convert
End |> DynObj.setOptionalProperty contours "end"
LabelFont |> DynObj.setOptionalProperty contours "labelfont"
LabelFormat |> DynObj.setOptionalProperty contours "labelformat"
Operation |> DynObj.setOptionalPropertyBy contours "operation" StyleParam.ConstraintOperation.convert
ShowLabels |> DynObj.setOptionalProperty contours "showlabels"
ShowLines |> DynObj.setOptionalProperty contours "showlines"
Size |> DynObj.setOptionalProperty contours "size"
Start |> DynObj.setOptionalProperty contours "start"
Type |> DynObj.setOptionalPropertyBy contours "type" StyleParam.ContourType.convert
Value |> DynObj.setOptionalProperty contours "value"


contours)
fun (contours: Contours) ->

contours
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalProperty "y" Y
|> DynObj.withOptionalProperty "z" Z
|> DynObj.withOptionalPropertyBy "coloring" Coloring StyleParam.ContourColoring.convert
|> DynObj.withOptionalProperty "end" End
|> DynObj.withOptionalProperty "labelfont" LabelFont
|> DynObj.withOptionalProperty "labelformat" LabelFormat
|> DynObj.withOptionalPropertyBy "operation" Operation StyleParam.ConstraintOperation.convert
|> DynObj.withOptionalProperty "showlabels" ShowLabels
|> DynObj.withOptionalProperty "showlines" ShowLines
|> DynObj.withOptionalProperty "size" Size
|> DynObj.withOptionalProperty "start" Start
|> DynObj.withOptionalPropertyBy "type" Type StyleParam.ContourType.convert
|> DynObj.withOptionalProperty "value" Value



// Initialized x-y-z-Contours with the same properties
Expand Down
10 changes: 5 additions & 5 deletions src/Plotly.NET/Traces/ObjectAbstractions/Cumulative.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type Cumulative() =
[<Optional; DefaultParameterValue(null)>] ?Currentbin: StyleParam.Currentbin
) =

(fun (cumulative: Cumulative) ->
Enabled |> DynObj.setOptionalProperty cumulative "enabled"
Direction |> DynObj.setOptionalPropertyBy cumulative "direction" StyleParam.CumulativeDirection.convert
Currentbin |> DynObj.setOptionalPropertyBy cumulative "currentbin" StyleParam.Currentbin.convert
fun (cumulative: Cumulative) ->

cumulative)
cumulative
|> DynObj.withOptionalProperty "enabled" Enabled
|> DynObj.withOptionalPropertyBy "direction" Direction StyleParam.CumulativeDirection.convert
|> DynObj.withOptionalPropertyBy "currentbin" Currentbin StyleParam.Currentbin.convert
32 changes: 15 additions & 17 deletions src/Plotly.NET/Traces/ObjectAbstractions/Dimensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,22 @@ type Dimension() =
[<Optional; DefaultParameterValue(null)>] ?AxisMatches: bool,
[<Optional; DefaultParameterValue(null)>] ?AxisType: StyleParam.AxisType
) =
(fun (dims: Dimension) ->
fun (dims: Dimension) ->

let axis =
LinearAxis.init (?AxisType = AxisType)
|> DynObj.setOptionalProperty "matches" AxisMatches

AxisMatches |> DynObj.setOptionalProperty axis "matches"

Label |> DynObj.setOptionalProperty dims "label"
Name |> DynObj.setOptionalProperty dims "name"
TemplateItemName |> DynObj.setOptionalProperty dims "templateitemname"
Values |> DynObj.setOptionalProperty dims "values"
Visible |> DynObj.setOptionalProperty dims "visible"
ConstraintRange |> DynObj.setOptionalPropertyBy dims "constraintrange" StyleParam.Range.convert
MultiSelect |> DynObj.setOptionalProperty dims "multiselect"
Range |> DynObj.setOptionalPropertyBy dims "range" StyleParam.Range.convert
TickFormat |> DynObj.setOptionalPropertyBy dims "tickformat" StyleParam.TickMode.convert
TickText |> DynObj.setOptionalProperty dims "ticktext"
Tickvals |> DynObj.setOptionalProperty dims "tickvals"
axis |> DynObj.withProperty dims "axis"

dims)
dims
|> DynObj.withOptionalProperty "label" Label
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName
|> DynObj.withOptionalProperty "values" Values
|> DynObj.withOptionalProperty "visible" Visible
|> DynObj.withOptionalPropertyBy "constraintrange" ConstraintRange StyleParam.Range.convert
|> DynObj.withOptionalProperty "multiselect" MultiSelect
|> DynObj.withOptionalPropertyBy "range" Range StyleParam.Range.convert
|> DynObj.withOptionalPropertyBy "tickformat" TickFormat StyleParam.TickMode.convert
|> DynObj.withOptionalProperty "ticktext" TickText
|> DynObj.withOptionalProperty "tickvals" Tickvals
|> DynObj.withProperty "axis" axis
31 changes: 15 additions & 16 deletions src/Plotly.NET/Traces/ObjectAbstractions/Error.fs
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,19 @@ type Error() =
[<Optional; DefaultParameterValue(null)>] ?Thickness: float,
[<Optional; DefaultParameterValue(null)>] ?Width: float
) =
(fun (error: Error) ->
Visible |> DynObj.setOptionalProperty error "visible"
Type |> DynObj.setOptionalPropertyBy error "type" StyleParam.ErrorType.convert
Symmetric |> DynObj.setOptionalProperty error "symmetric"
Array |> DynObj.setOptionalProperty error "array"
Arrayminus |> DynObj.setOptionalProperty error "arrayminus"
Value |> DynObj.setOptionalProperty error "value"
Valueminus |> DynObj.setOptionalProperty error "valueminus"
Traceref |> DynObj.setOptionalProperty error "traceref"
Tracerefminus |> DynObj.setOptionalProperty error "tracerefminus"
Copy_ystyle |> DynObj.setOptionalProperty error "copy_ystyle"
Color |> DynObj.setOptionalProperty error "color"
Thickness |> DynObj.setOptionalProperty error "thickness"
Width |> DynObj.setOptionalProperty error "width"
fun (error: Error) ->

// out ->
error)
error
|> DynObj.withOptionalProperty "visible" Visible
|> DynObj.withOptionalPropertyBy "type" Type StyleParam.ErrorType.convert
|> DynObj.withOptionalProperty "symmetric" Symmetric
|> DynObj.withOptionalProperty "array" Array
|> DynObj.withOptionalProperty "arrayminus" Arrayminus
|> DynObj.withOptionalProperty "value" Value
|> DynObj.withOptionalProperty "valueminus" Valueminus
|> DynObj.withOptionalProperty "traceref" Traceref
|> DynObj.withOptionalProperty "tracerefminus" Tracerefminus
|> DynObj.withOptionalProperty "copy_ystyle" Copy_ystyle
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "thickness" Thickness
|> DynObj.withOptionalProperty "width" Width
11 changes: 5 additions & 6 deletions src/Plotly.NET/Traces/ObjectAbstractions/FunnelConnector.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ type FunnelConnector() =
[<Optional; DefaultParameterValue(null)>] ?Line: Line,
[<Optional; DefaultParameterValue(null)>] ?Visible: bool
) =
(fun (connector: FunnelConnector) ->
fun (connector: FunnelConnector) ->

FillColor |> DynObj.setOptionalProperty connector "fillcolor"
Line |> DynObj.setOptionalProperty connector "line"
Visible |> DynObj.setOptionalProperty connector "visible"

connector)
connector
|> DynObj.withOptionalProperty "fillcolor" FillColor
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "visible" Visible
6 changes: 2 additions & 4 deletions src/Plotly.NET/Traces/ObjectAbstractions/Gradient.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ type Gradient() =

fun (gradient: Gradient) ->

(Type, MultiTypes) |> DynObj.setOptionalSingleOrMultiProperty gradient "type"

Color |> DynObj.setOptionalProperty gradient "color"

gradient
|> DynObj.withOptionalSingleOrMultiProperty "type" (Type, MultiTypes)
|> DynObj.setOptionalProperty "color" Color
47 changes: 22 additions & 25 deletions src/Plotly.NET/Traces/ObjectAbstractions/Indicator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ type IndicatorSymbol() =
[<Optional; DefaultParameterValue(null)>] ?Color: Color,
[<Optional; DefaultParameterValue(null)>] ?Symbol: string
) =
(fun (indicatorDirection: IndicatorSymbol) ->
fun (indicatorDirection: IndicatorSymbol) ->

Color |> DynObj.setOptionalProperty indicatorDirection "color"
Symbol |> DynObj.setOptionalProperty indicatorDirection "symbol"

indicatorDirection)
indicatorDirection
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "symbol" Symbol

type IndicatorDelta() =
inherit DynamicObj()
Expand Down Expand Up @@ -93,19 +92,18 @@ type IndicatorDelta() =
[<Optional; DefaultParameterValue(null)>] ?Suffix: string,
[<Optional; DefaultParameterValue(null)>] ?ValueFormat: string
) =
(fun (indicatorDelta: IndicatorDelta) ->

Decreasing |> DynObj.setOptionalProperty indicatorDelta "decreasing"
Font |> DynObj.setOptionalProperty indicatorDelta "font"
Increasing |> DynObj.setOptionalProperty indicatorDelta "increasing"
Position |> DynObj.setOptionalPropertyBy indicatorDelta "position" StyleParam.IndicatorDeltaPosition.convert
Prefix |> DynObj.setOptionalProperty indicatorDelta "prefix"
Reference |> DynObj.setOptionalProperty indicatorDelta "reference"
Relative |> DynObj.setOptionalProperty indicatorDelta "relative"
Suffix |> DynObj.setOptionalProperty indicatorDelta "suffix"
ValueFormat |> DynObj.setOptionalProperty indicatorDelta "valueformat"

indicatorDelta)
fun (indicatorDelta: IndicatorDelta) ->

indicatorDelta
|> DynObj.withOptionalProperty "decreasing" Decreasing
|> DynObj.withOptionalProperty "font" Font
|> DynObj.withOptionalProperty "increasing" Increasing
|> DynObj.withOptionalPropertyBy "position" Position StyleParam.IndicatorDeltaPosition.convert
|> DynObj.withOptionalProperty "prefix" Prefix
|> DynObj.withOptionalProperty "reference" Reference
|> DynObj.withOptionalProperty "relative" Relative
|> DynObj.withOptionalProperty "suffix" Suffix
|> DynObj.withOptionalProperty "valueformat" ValueFormat

type IndicatorNumber() =
inherit DynamicObj()
Expand All @@ -127,14 +125,13 @@ type IndicatorNumber() =
[<Optional; DefaultParameterValue(null)>] ?Suffix: string,
[<Optional; DefaultParameterValue(null)>] ?ValueFormat: string
) =
(fun (indicatorNumber: IndicatorNumber) ->

Font |> DynObj.setOptionalProperty indicatorNumber "font"
Prefix |> DynObj.setOptionalProperty indicatorNumber "prefix"
Suffix |> DynObj.setOptionalProperty indicatorNumber "suffix"
ValueFormat |> DynObj.setOptionalProperty indicatorNumber "valueformat"
fun (indicatorNumber: IndicatorNumber) ->

indicatorNumber)
indicatorNumber
|> DynObj.withOptionalProperty "font" Font
|> DynObj.withOptionalProperty "prefix" Prefix
|> DynObj.withOptionalProperty "suffix" Suffix
|> DynObj.withOptionalProperty "valueformat" ValueFormat


type IndicatorBar() =
Expand Down
22 changes: 10 additions & 12 deletions src/Plotly.NET/Traces/ObjectAbstractions/Lighting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ type Lighting() =
) =
fun (l: Lighting) ->

Ambient |> DynObj.setOptionalProperty l "ambient"
Diffuse |> DynObj.setOptionalProperty l "diffuse"
FaceNormalEpsilon |> DynObj.setOptionalProperty l "facenormalepsilon"
Fresnel |> DynObj.setOptionalProperty l "fresnel"
Roughness |> DynObj.setOptionalProperty l "roughness"
Specular |> DynObj.setOptionalProperty l "specular"
VertexNormalEpsilon |> DynObj.setOptionalProperty l "vertexnormalepsilon"

l
|> DynObj.withOptionalProperty "ambient" Ambient
|> DynObj.withOptionalProperty "diffuse" Diffuse
|> DynObj.withOptionalProperty "facenormalepsilon" FaceNormalEpsilon
|> DynObj.withOptionalProperty "fresnel" Fresnel
|> DynObj.withOptionalProperty "roughness" Roughness
|> DynObj.withOptionalProperty "specular" Specular
|> DynObj.withOptionalProperty "vertexnormalepsilon" VertexNormalEpsilon

type LightPosition() =
inherit DynamicObj()
Expand Down Expand Up @@ -104,8 +103,7 @@ type LightPosition() =
) =
fun (lp: LightPosition) ->

X |> DynObj.setOptionalProperty lp "x"
Y |> DynObj.setOptionalProperty lp "y"
Z |> DynObj.setOptionalProperty lp "z"

lp
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalProperty "y" Y
|> DynObj.withOptionalProperty "z" Z
Loading
Loading