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
port layoutobjects to DynamicObj v4
  • Loading branch information
kMutagene committed Oct 14, 2024
commit 9a0713effad2c9840c56faf69b5fb010b369da90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ActiveSelection() =
) =
(fun (activeSelection: ActiveSelection) ->

FillColor |> DynObj.setOptionalProperty activeSelection "fillcolor"
Opacity |> DynObj.setOptionalProperty activeSelection "opacity"

activeSelection)
activeSelection
|> DynObj.withOptionalProperty "fillcolor" FillColor
|> DynObj.withOptionalProperty "opacity" Opacity
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ActiveShape() =
) =
(fun (activeShape: ActiveShape) ->

FillColor |> DynObj.setOptionalProperty activeShape "fillcolor"
Opacity |> DynObj.setOptionalProperty activeShape "opacity"

activeShape)
activeShape
|> DynObj.withOptionalProperty "fillcolor" FillColor
|> DynObj.withOptionalProperty "opacity" Opacity
)
88 changes: 44 additions & 44 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/Annotation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -148,47 +148,47 @@ type Annotation() =
) =
(fun (ann: Annotation) ->

X |> DynObj.setOptionalProperty ann "x"
Y |> DynObj.setOptionalProperty ann "y"
Align |> DynObj.setOptionalPropertyBy ann "align" StyleParam.AnnotationAlignment.convert
ArrowColor |> DynObj.setOptionalProperty ann "arrowcolor"
ArrowHead |> DynObj.setOptionalPropertyBy ann "arrowhead" StyleParam.ArrowHead.convert
ArrowSide |> DynObj.setOptionalPropertyBy ann "arrowside" StyleParam.ArrowSide.convert
ArrowSize |> DynObj.setOptionalProperty ann "arrowsize"
AX |> DynObj.setOptionalProperty ann "ax"
AXRef |> DynObj.setOptionalProperty ann "axref"
AY |> DynObj.setOptionalProperty ann "ay"
AYRef |> DynObj.setOptionalProperty ann "ayref"
BGColor |> DynObj.setOptionalProperty ann "bgcolor"
BorderColor |> DynObj.setOptionalProperty ann "bordercolor"
BorderPad |> DynObj.setOptionalProperty ann "borderpad"
BorderWidth |> DynObj.setOptionalProperty ann "borderwidth"
CaptureEvents |> DynObj.setOptionalProperty ann "captureevents"
ClickToShow |> DynObj.setOptionalPropertyBy ann "clicktoshow" StyleParam.ClickToShow.convert
Font |> DynObj.setOptionalProperty ann "font"
Height |> DynObj.setOptionalProperty ann "height"
HoverLabel |> DynObj.setOptionalProperty ann "hoverlabel"
HoverText |> DynObj.setOptionalProperty ann "hovertext"
Name |> DynObj.setOptionalProperty ann "name"
Opacity |> DynObj.setOptionalProperty ann "opacity"
ShowArrow |> DynObj.setOptionalProperty ann "showarrow"
StandOff |> DynObj.setOptionalProperty ann "standoff"
StartArrowHead |> DynObj.setOptionalProperty ann "startarrowhead"
StartArrowSize |> DynObj.setOptionalProperty ann "startarrowsize"
StartStandOff |> DynObj.setOptionalProperty ann "startstandoff"
TemplateItemName |> DynObj.setOptionalProperty ann "templateitemname"
Text |> DynObj.setOptionalProperty ann "text"
TextAngle |> DynObj.setOptionalProperty ann "textangle"
VAlign |> DynObj.setOptionalPropertyBy ann "valign" StyleParam.VerticalAlign.convert
Visible |> DynObj.setOptionalProperty ann "visible"
Width |> DynObj.setOptionalProperty ann "width"
XAnchor |> DynObj.setOptionalPropertyBy ann "xanchor" StyleParam.XAnchorPosition.convert
XClick |> DynObj.setOptionalProperty ann "xclick"
XRef |> DynObj.setOptionalProperty ann "xref"
XShift |> DynObj.setOptionalProperty ann "xshift"
YAnchor |> DynObj.setOptionalPropertyBy ann "yanchor" StyleParam.YAnchorPosition.convert
YClick |> DynObj.setOptionalProperty ann "yclick"
YRef |> DynObj.setOptionalProperty ann "yref"
YShift |> DynObj.setOptionalProperty ann "yshift"

ann)
ann
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalProperty "y" Y
|> DynObj.withOptionalPropertyBy "align" Align StyleParam.AnnotationAlignment.convert
|> DynObj.withOptionalProperty "arrowcolor" ArrowColor
|> DynObj.withOptionalPropertyBy "arrowhead" ArrowHead StyleParam.ArrowHead.convert
|> DynObj.withOptionalPropertyBy "arrowside" ArrowSide StyleParam.ArrowSide.convert
|> DynObj.withOptionalProperty "arrowsize" ArrowSize
|> DynObj.withOptionalProperty "ax" AX
|> DynObj.withOptionalProperty "axref" AXRef
|> DynObj.withOptionalProperty "ay" AY
|> DynObj.withOptionalProperty "ayref" AYRef
|> DynObj.withOptionalProperty "bgcolor" BGColor
|> DynObj.withOptionalProperty "bordercolor" BorderColor
|> DynObj.withOptionalProperty "borderpad" BorderPad
|> DynObj.withOptionalProperty "borderwidth" BorderWidth
|> DynObj.withOptionalProperty "captureevents" CaptureEvents
|> DynObj.withOptionalPropertyBy "clicktoshow" ClickToShow StyleParam.ClickToShow.convert
|> DynObj.withOptionalProperty "font" Font
|> DynObj.withOptionalProperty "height" Height
|> DynObj.withOptionalProperty "hoverlabel" HoverLabel
|> DynObj.withOptionalProperty "hovertext" HoverText
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalProperty "opacity" Opacity
|> DynObj.withOptionalProperty "showarrow" ShowArrow
|> DynObj.withOptionalProperty "standoff" StandOff
|> DynObj.withOptionalProperty "startarrowhead" StartArrowHead
|> DynObj.withOptionalProperty "startarrowsize" StartArrowSize
|> DynObj.withOptionalProperty "startstandoff" StartStandOff
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName
|> DynObj.withOptionalProperty "text" Text
|> DynObj.withOptionalProperty "textangle" TextAngle
|> DynObj.withOptionalPropertyBy "valign" VAlign StyleParam.VerticalAlign.convert
|> DynObj.withOptionalProperty "visible" Visible
|> DynObj.withOptionalProperty "width" Width
|> DynObj.withOptionalPropertyBy "xanchor" XAnchor StyleParam.XAnchorPosition.convert
|> DynObj.withOptionalProperty "xclick" XClick
|> DynObj.withOptionalProperty "xref" XRef
|> DynObj.withOptionalProperty "xshift" XShift
|> DynObj.withOptionalPropertyBy "yanchor" YAnchor StyleParam.YAnchorPosition.convert
|> DynObj.withOptionalProperty "yclick" YClick
|> DynObj.withOptionalProperty "yref" YRef
|> DynObj.withOptionalProperty "yshift" YShift
)
18 changes: 9 additions & 9 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/Button.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ type Button() =
) =
(fun (button: Button) ->

Visible |> DynObj.setOptionalProperty button "visible"
Step |> DynObj.setOptionalPropertyBy button "step" StyleParam.TimeStep.convert
StepMode |> DynObj.setOptionalPropertyBy button "stepmode" StyleParam.TimeStepMode.convert
Count |> DynObj.setOptionalProperty button "count"
Label |> DynObj.setOptionalProperty button "label"
Name |> DynObj.setOptionalProperty button "name"
TemplateItemName |> DynObj.setOptionalProperty button "templateitemname"

button)
button
|> DynObj.withOptionalProperty "visible" Visible
|> DynObj.withOptionalPropertyBy "step" Step StyleParam.TimeStep.convert
|> DynObj.withOptionalPropertyBy "stepmode" StepMode StyleParam.TimeStepMode.convert
|> DynObj.withOptionalProperty "count" Count
|> DynObj.withOptionalProperty "label" Label
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName
)
20 changes: 10 additions & 10 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/ColorAxis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ type ColorAxis() =
) =
fun (ca: ColorAxis) ->

AutoColorScale |> DynObj.setOptionalProperty ca "autocolorscale"
CAuto |> DynObj.setOptionalProperty ca "cauto"
CMin |> DynObj.setOptionalProperty ca "cmin"
CMid |> DynObj.setOptionalProperty ca "cmid"
CMax |> DynObj.setOptionalProperty ca "cmax"
ColorBar |> DynObj.setOptionalProperty ca "colorbar"
ColorScale |> DynObj.setOptionalPropertyBy ca "colorscale" StyleParam.Colorscale.convert
ShowScale |> DynObj.setOptionalProperty ca "showscale"
ReverseScale |> DynObj.setOptionalProperty ca "reversescale"

ca
|> DynObj.withOptionalProperty "autocolorscale" AutoColorScale
|> DynObj.withOptionalProperty "cauto" CAuto
|> DynObj.withOptionalProperty "cmin" CMin
|> DynObj.withOptionalProperty "cmid" CMid
|> DynObj.withOptionalProperty "cmax" CMax
|> DynObj.withOptionalProperty "colorbar" ColorBar
|> DynObj.withOptionalPropertyBy "colorscale" ColorScale StyleParam.Colorscale.convert
|> DynObj.withOptionalProperty "showscale" ShowScale
|> DynObj.withOptionalProperty "reversescale" ReverseScale

Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type DefaultColorScales() =
) =
(fun (defaultColorScales: DefaultColorScales) ->

Diverging |> DynObj.setOptionalPropertyBy defaultColorScales "diverging" StyleParam.Colorscale.convert
Sequential |> DynObj.setOptionalPropertyBy defaultColorScales "sequential" StyleParam.Colorscale.convert
SequentialMinus |> DynObj.setOptionalPropertyBy defaultColorScales "sequentialminus" StyleParam.Colorscale.convert

defaultColorScales)
defaultColorScales
|> DynObj.withOptionalPropertyBy "diverging" Diverging StyleParam.Colorscale.convert
|> DynObj.withOptionalPropertyBy "sequential" Sequential StyleParam.Colorscale.convert
|> DynObj.withOptionalPropertyBy "sequentialminus" SequentialMinus StyleParam.Colorscale.convert
)
12 changes: 6 additions & 6 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/Domain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ type Domain() =
[<Optional; DefaultParameterValue(null)>] ?Column: int
) =
(fun (dom: Domain) ->
X |> DynObj.setOptionalPropertyBy dom "x" StyleParam.Range.convert
Y |> DynObj.setOptionalPropertyBy dom "y" StyleParam.Range.convert
Row |> DynObj.setOptionalProperty dom "row"
Column |> DynObj.setOptionalProperty dom "column"

// out ->
dom)
dom
|> DynObj.withOptionalPropertyBy "x" X StyleParam.Range.convert
|> DynObj.withOptionalPropertyBy "y" Y StyleParam.Range.convert
|> DynObj.withOptionalProperty "row" Row
|> DynObj.withOptionalProperty "column" Column
)
15 changes: 8 additions & 7 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/Hoverlabel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ type Hoverlabel() =
[<Optional; DefaultParameterValue(null)>] ?Namelength: int
) =
(fun (label: Hoverlabel) ->
BgColor |> DynObj.setOptionalProperty label "bgcolor"
BorderColor |> DynObj.setOptionalProperty label "bordercolor"
Font |> DynObj.setOptionalProperty label "font"
GroupTitleFont |> DynObj.setOptionalProperty label "grouptitlefont"
Align |> DynObj.setOptionalPropertyBy label "align" StyleParam.Align.convert
Namelength |> DynObj.setOptionalProperty label "namelength"

label)
label
|> DynObj.withOptionalProperty "bgcolor" BgColor
|> DynObj.withOptionalProperty "bordercolor" BorderColor
|> DynObj.withOptionalProperty "font" Font
|> DynObj.withOptionalProperty "grouptitlefont" GroupTitleFont
|> DynObj.withOptionalPropertyBy "align" Align StyleParam.Align.convert
|> DynObj.withOptionalProperty "namelength" Namelength
)
37 changes: 17 additions & 20 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/LayoutGrid.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,22 @@ type LayoutGrid() =
[<Optional; DefaultParameterValue(null)>] ?YSide: StyleParam.LayoutGridYSide
) =
(fun (layoutGrid: LayoutGrid) ->
SubPlots
|> DynObj.setOptionalPropertyBy
layoutGrid
"subplots"
(Array.map (
layoutGrid
|> DynObj.withOptionalPropertyBy "subplots" SubPlots (
Array.map (
Array.map (fun (x, y) ->
$"{StyleParam.LinearAxisId.toString x}{StyleParam.LinearAxisId.toString y}")
))

XAxes |> DynObj.setOptionalPropertyBy layoutGrid "xaxes" (Array.map StyleParam.LinearAxisId.toString)
YAxes |> DynObj.setOptionalPropertyBy layoutGrid "yaxes" (Array.map StyleParam.LinearAxisId.toString)
Rows |> DynObj.setOptionalProperty layoutGrid "rows"
Columns |> DynObj.setOptionalProperty layoutGrid "columns"
RowOrder |> DynObj.setOptionalPropertyBy layoutGrid "roworder" StyleParam.LayoutGridRowOrder.toString
Pattern |> DynObj.setOptionalPropertyBy layoutGrid "pattern" StyleParam.LayoutGridPattern.toString
XGap |> DynObj.setOptionalProperty layoutGrid "xgap"
YGap |> DynObj.setOptionalProperty layoutGrid "ygap"
Domain |> DynObj.setOptionalProperty layoutGrid "domain"
XSide |> DynObj.setOptionalPropertyBy layoutGrid "xside" StyleParam.LayoutGridXSide.toString
YSide |> DynObj.setOptionalPropertyBy layoutGrid "yside" StyleParam.LayoutGridYSide.toString

layoutGrid)
)
)
|> DynObj.withOptionalPropertyBy "xaxes" XAxes (Array.map StyleParam.LinearAxisId.toString)
|> DynObj.withOptionalPropertyBy "yaxes" YAxes (Array.map StyleParam.LinearAxisId.toString)
|> DynObj.withOptionalProperty "rows" Rows
|> DynObj.withOptionalProperty "columns" Columns
|> DynObj.withOptionalPropertyBy "roworder" RowOrder StyleParam.LayoutGridRowOrder.toString
|> DynObj.withOptionalPropertyBy "pattern" Pattern StyleParam.LayoutGridPattern.toString
|> DynObj.withOptionalProperty "xgap" XGap
|> DynObj.withOptionalProperty "ygap" YGap
|> DynObj.withOptionalProperty "domain" Domain
|> DynObj.withOptionalPropertyBy "xside" XSide StyleParam.LayoutGridXSide.toString
|> DynObj.withOptionalPropertyBy "yside" YSide StyleParam.LayoutGridYSide.toString
)
35 changes: 17 additions & 18 deletions src/Plotly.NET/Layout/ObjectAbstractions/Common/LayoutImage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,20 @@ type LayoutImage() =
[<Optional; DefaultParameterValue(null)>] ?YRef: string
) =
(fun (layoutImage: LayoutImage) ->

Layer |> DynObj.setOptionalPropertyBy layoutImage "layer" StyleParam.Layer.convert
Name |> DynObj.setOptionalProperty layoutImage "name"
Opacity |> DynObj.setOptionalProperty layoutImage "opacity"
SizeX |> DynObj.setOptionalProperty layoutImage "sizex"
SizeY |> DynObj.setOptionalProperty layoutImage "sizey"
Sizing |> DynObj.setOptionalPropertyBy layoutImage "sizing" StyleParam.LayoutImageSizing.convert
Source |> DynObj.setOptionalProperty layoutImage "source"
TemplateItemname |> DynObj.setOptionalProperty layoutImage "templateitemname"
Visible |> DynObj.setOptionalProperty layoutImage "visible"
X |> DynObj.setOptionalProperty layoutImage "x"
XAnchor |> DynObj.setOptionalPropertyBy layoutImage "xanchor" StyleParam.XAnchorPosition.convert
XRef |> DynObj.setOptionalProperty layoutImage "xref"
Y |> DynObj.setOptionalProperty layoutImage "y"
YAnchor |> DynObj.setOptionalPropertyBy layoutImage "yanchor" StyleParam.YAnchorPosition.convert
YRef |> DynObj.setOptionalProperty layoutImage "yref"

layoutImage)
layoutImage
|> DynObj.withOptionalPropertyBy "layer" Layer StyleParam.Layer.convert
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalProperty "opacity" Opacity
|> DynObj.withOptionalProperty "sizex" SizeX
|> DynObj.withOptionalProperty "sizey" SizeY
|> DynObj.withOptionalPropertyBy "sizing" Sizing StyleParam.LayoutImageSizing.convert
|> DynObj.withOptionalProperty "source" Source
|> DynObj.withOptionalProperty "templateitemname" TemplateItemname
|> DynObj.withOptionalProperty "visible" Visible
|> DynObj.withOptionalProperty "x" X
|> DynObj.withOptionalPropertyBy "xanchor" XAnchor StyleParam.XAnchorPosition.convert
|> DynObj.withOptionalProperty "xref" XRef
|> DynObj.withOptionalProperty "y" Y
|> DynObj.withOptionalPropertyBy "yanchor" YAnchor StyleParam.YAnchorPosition.convert
|> DynObj.withOptionalProperty "yref" YRef
)
Loading
Loading