Skip to content

Commit 730240f

Browse files
committed
wip port traceobjects to dynObj v4
1 parent 9a0713e commit 730240f

25 files changed

+250
-290
lines changed

src/Plotly.NET/Traces/ObjectAbstractions/Bins.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type Bins() =
2828
[<Optional; DefaultParameterValue(null)>] ?Size: float
2929
) =
3030

31-
(fun (bins: Bins) ->
32-
Start |> DynObj.setOptionalProperty bins "start"
33-
End |> DynObj.setOptionalProperty bins "end"
34-
Size |> DynObj.setOptionalProperty bins "size"
31+
fun (bins: Bins) ->
3532

36-
bins)
33+
bins
34+
|> DynObj.withOptionalProperty "start" Start
35+
|> DynObj.withOptionalProperty "end" End
36+
|> DynObj.withOptionalProperty "size" Size

src/Plotly.NET/Traces/ObjectAbstractions/Box.fs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,16 @@ type Box() =
3838
[<Optional; DefaultParameterValue(null)>] ?LineColor: Color,
3939
[<Optional; DefaultParameterValue(null)>] ?LineWidth: float
4040
) =
41-
(fun (box: Box) ->
41+
fun (box: Box) ->
4242

4343
let line =
4444
if LineColor.IsSome || LineWidth.IsSome then
4545
Some(Line.init (?Color = LineColor, ?Width = LineWidth))
4646
else
4747
None
4848

49-
Visible |> DynObj.setOptionalProperty box "visible"
50-
Width |> DynObj.setOptionalProperty box "width"
51-
FillColor |> DynObj.setOptionalProperty box "fillcolor"
52-
line |> DynObj.setOptionalProperty box "line"
53-
54-
// out ->
55-
box)
49+
box
50+
|> DynObj.withOptionalProperty "visible" Visible
51+
|> DynObj.withOptionalProperty "width" Width
52+
|> DynObj.withOptionalProperty "fillcolor" FillColor
53+
|> DynObj.withOptionalProperty "line" line

src/Plotly.NET/Traces/ObjectAbstractions/Caps.fs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ type CapFill() =
2424

2525
fun (capFill: CapFill) ->
2626

27-
Fill |> DynObj.setOptionalProperty capFill "fill"
28-
Show |> DynObj.setOptionalProperty capFill "show"
29-
3027
capFill
28+
|> DynObj.withOptionalProperty "fill" Fill
29+
|> DynObj.withOptionalProperty "show" Show
3130

3231

3332
type Caps() =
@@ -50,8 +49,7 @@ type Caps() =
5049
) =
5150
fun (caps: Caps) ->
5251

53-
X |> DynObj.setOptionalProperty caps "x"
54-
Y |> DynObj.setOptionalProperty caps "y"
55-
Z |> DynObj.setOptionalProperty caps "z"
56-
5752
caps
53+
|> DynObj.withOptionalProperty "x" X
54+
|> DynObj.withOptionalProperty "y" Y
55+
|> DynObj.withOptionalProperty "z" Z

src/Plotly.NET/Traces/ObjectAbstractions/Contours.fs

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ type ContourProject() =
2727

2828
fun (contourProject: ContourProject) ->
2929

30-
X |> DynObj.setOptionalProperty contourProject "x"
31-
Y |> DynObj.setOptionalProperty contourProject "y"
32-
Z |> DynObj.setOptionalProperty contourProject "z"
33-
3430
contourProject
31+
|> DynObj.withOptionalProperty "x" X
32+
|> DynObj.withOptionalProperty "y" Y
33+
|> DynObj.withOptionalProperty "z" Z
3534

3635
/// Contour object inherits from dynamic object
3736
type Contour() =
@@ -86,21 +85,19 @@ type Contour() =
8685
[<Optional; DefaultParameterValue(null)>] ?Width: float
8786
) =
8887

89-
(fun (contour: Contour) ->
90-
Color |> DynObj.setOptionalProperty contour "color"
91-
End |> DynObj.setOptionalProperty contour "end"
92-
Highlight |> DynObj.setOptionalProperty contour "highlight"
93-
HighlightColor |> DynObj.setOptionalProperty contour "highlightcolor"
94-
HighlightWidth |> DynObj.setOptionalProperty contour "highlightwidth"
95-
Project |> DynObj.setOptionalProperty contour "project"
96-
Show |> DynObj.setOptionalProperty contour "show"
97-
Size |> DynObj.setOptionalProperty contour "size"
98-
Start |> DynObj.setOptionalProperty contour "start"
99-
UseColorMap |> DynObj.setOptionalProperty contour "usecolormap"
100-
Width |> DynObj.setOptionalProperty contour "width"
101-
102-
103-
contour)
88+
fun (contour: Contour) ->
89+
contour
90+
|> DynObj.withOptionalProperty "color" Color
91+
|> DynObj.withOptionalProperty "end" End
92+
|> DynObj.withOptionalProperty "highlight" Highlight
93+
|> DynObj.withOptionalProperty "highlightcolor" HighlightColor
94+
|> DynObj.withOptionalProperty "highlightwidth" HighlightWidth
95+
|> DynObj.withOptionalProperty "project" Project
96+
|> DynObj.withOptionalProperty "show" Show
97+
|> DynObj.withOptionalProperty "size" Size
98+
|> DynObj.withOptionalProperty "start" Start
99+
|> DynObj.withOptionalProperty "usecolormap" UseColorMap
100+
|> DynObj.withOptionalProperty "width" Width
104101

105102
/// Contours type inherits from dynamic object
106103
type Contours() =
@@ -167,24 +164,24 @@ type Contours() =
167164
[<Optional; DefaultParameterValue(null)>] ?Value: #IConvertible
168165
) =
169166

170-
(fun (contours: Contours) ->
171-
X |> DynObj.setOptionalProperty contours "x"
172-
Y |> DynObj.setOptionalProperty contours "y"
173-
Z |> DynObj.setOptionalProperty contours "z"
174-
Coloring |> DynObj.setOptionalPropertyBy contours "coloring" StyleParam.ContourColoring.convert
175-
End |> DynObj.setOptionalProperty contours "end"
176-
LabelFont |> DynObj.setOptionalProperty contours "labelfont"
177-
LabelFormat |> DynObj.setOptionalProperty contours "labelformat"
178-
Operation |> DynObj.setOptionalPropertyBy contours "operation" StyleParam.ConstraintOperation.convert
179-
ShowLabels |> DynObj.setOptionalProperty contours "showlabels"
180-
ShowLines |> DynObj.setOptionalProperty contours "showlines"
181-
Size |> DynObj.setOptionalProperty contours "size"
182-
Start |> DynObj.setOptionalProperty contours "start"
183-
Type |> DynObj.setOptionalPropertyBy contours "type" StyleParam.ContourType.convert
184-
Value |> DynObj.setOptionalProperty contours "value"
185-
186-
187-
contours)
167+
fun (contours: Contours) ->
168+
169+
contours
170+
|> DynObj.withOptionalProperty "x" X
171+
|> DynObj.withOptionalProperty "y" Y
172+
|> DynObj.withOptionalProperty "z" Z
173+
|> DynObj.withOptionalPropertyBy "coloring" Coloring StyleParam.ContourColoring.convert
174+
|> DynObj.withOptionalProperty "end" End
175+
|> DynObj.withOptionalProperty "labelfont" LabelFont
176+
|> DynObj.withOptionalProperty "labelformat" LabelFormat
177+
|> DynObj.withOptionalPropertyBy "operation" Operation StyleParam.ConstraintOperation.convert
178+
|> DynObj.withOptionalProperty "showlabels" ShowLabels
179+
|> DynObj.withOptionalProperty "showlines" ShowLines
180+
|> DynObj.withOptionalProperty "size" Size
181+
|> DynObj.withOptionalProperty "start" Start
182+
|> DynObj.withOptionalPropertyBy "type" Type StyleParam.ContourType.convert
183+
|> DynObj.withOptionalProperty "value" Value
184+
188185

189186

190187
// Initialized x-y-z-Contours with the same properties

src/Plotly.NET/Traces/ObjectAbstractions/Cumulative.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ type Cumulative() =
3838
[<Optional; DefaultParameterValue(null)>] ?Currentbin: StyleParam.Currentbin
3939
) =
4040

41-
(fun (cumulative: Cumulative) ->
42-
Enabled |> DynObj.setOptionalProperty cumulative "enabled"
43-
Direction |> DynObj.setOptionalPropertyBy cumulative "direction" StyleParam.CumulativeDirection.convert
44-
Currentbin |> DynObj.setOptionalPropertyBy cumulative "currentbin" StyleParam.Currentbin.convert
41+
fun (cumulative: Cumulative) ->
4542

46-
cumulative)
43+
cumulative
44+
|> DynObj.withOptionalProperty "enabled" Enabled
45+
|> DynObj.withOptionalPropertyBy "direction" Direction StyleParam.CumulativeDirection.convert
46+
|> DynObj.withOptionalPropertyBy "currentbin" Currentbin StyleParam.Currentbin.convert

src/Plotly.NET/Traces/ObjectAbstractions/Dimensions.fs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,22 @@ type Dimension() =
8383
[<Optional; DefaultParameterValue(null)>] ?AxisMatches: bool,
8484
[<Optional; DefaultParameterValue(null)>] ?AxisType: StyleParam.AxisType
8585
) =
86-
(fun (dims: Dimension) ->
86+
fun (dims: Dimension) ->
8787

8888
let axis =
8989
LinearAxis.init (?AxisType = AxisType)
90+
|> DynObj.setOptionalProperty "matches" AxisMatches
9091

91-
AxisMatches |> DynObj.setOptionalProperty axis "matches"
92-
93-
Label |> DynObj.setOptionalProperty dims "label"
94-
Name |> DynObj.setOptionalProperty dims "name"
95-
TemplateItemName |> DynObj.setOptionalProperty dims "templateitemname"
96-
Values |> DynObj.setOptionalProperty dims "values"
97-
Visible |> DynObj.setOptionalProperty dims "visible"
98-
ConstraintRange |> DynObj.setOptionalPropertyBy dims "constraintrange" StyleParam.Range.convert
99-
MultiSelect |> DynObj.setOptionalProperty dims "multiselect"
100-
Range |> DynObj.setOptionalPropertyBy dims "range" StyleParam.Range.convert
101-
TickFormat |> DynObj.setOptionalPropertyBy dims "tickformat" StyleParam.TickMode.convert
102-
TickText |> DynObj.setOptionalProperty dims "ticktext"
103-
Tickvals |> DynObj.setOptionalProperty dims "tickvals"
104-
axis |> DynObj.withProperty dims "axis"
105-
106-
dims)
92+
dims
93+
|> DynObj.withOptionalProperty "label" Label
94+
|> DynObj.withOptionalProperty "name" Name
95+
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName
96+
|> DynObj.withOptionalProperty "values" Values
97+
|> DynObj.withOptionalProperty "visible" Visible
98+
|> DynObj.withOptionalPropertyBy "constraintrange" ConstraintRange StyleParam.Range.convert
99+
|> DynObj.withOptionalProperty "multiselect" MultiSelect
100+
|> DynObj.withOptionalPropertyBy "range" Range StyleParam.Range.convert
101+
|> DynObj.withOptionalPropertyBy "tickformat" TickFormat StyleParam.TickMode.convert
102+
|> DynObj.withOptionalProperty "ticktext" TickText
103+
|> DynObj.withOptionalProperty "tickvals" Tickvals
104+
|> DynObj.withProperty "axis" axis

src/Plotly.NET/Traces/ObjectAbstractions/Error.fs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,19 @@ type Error() =
9191
[<Optional; DefaultParameterValue(null)>] ?Thickness: float,
9292
[<Optional; DefaultParameterValue(null)>] ?Width: float
9393
) =
94-
(fun (error: Error) ->
95-
Visible |> DynObj.setOptionalProperty error "visible"
96-
Type |> DynObj.setOptionalPropertyBy error "type" StyleParam.ErrorType.convert
97-
Symmetric |> DynObj.setOptionalProperty error "symmetric"
98-
Array |> DynObj.setOptionalProperty error "array"
99-
Arrayminus |> DynObj.setOptionalProperty error "arrayminus"
100-
Value |> DynObj.setOptionalProperty error "value"
101-
Valueminus |> DynObj.setOptionalProperty error "valueminus"
102-
Traceref |> DynObj.setOptionalProperty error "traceref"
103-
Tracerefminus |> DynObj.setOptionalProperty error "tracerefminus"
104-
Copy_ystyle |> DynObj.setOptionalProperty error "copy_ystyle"
105-
Color |> DynObj.setOptionalProperty error "color"
106-
Thickness |> DynObj.setOptionalProperty error "thickness"
107-
Width |> DynObj.setOptionalProperty error "width"
94+
fun (error: Error) ->
10895

109-
// out ->
110-
error)
96+
error
97+
|> DynObj.withOptionalProperty "visible" Visible
98+
|> DynObj.withOptionalPropertyBy "type" Type StyleParam.ErrorType.convert
99+
|> DynObj.withOptionalProperty "symmetric" Symmetric
100+
|> DynObj.withOptionalProperty "array" Array
101+
|> DynObj.withOptionalProperty "arrayminus" Arrayminus
102+
|> DynObj.withOptionalProperty "value" Value
103+
|> DynObj.withOptionalProperty "valueminus" Valueminus
104+
|> DynObj.withOptionalProperty "traceref" Traceref
105+
|> DynObj.withOptionalProperty "tracerefminus" Tracerefminus
106+
|> DynObj.withOptionalProperty "copy_ystyle" Copy_ystyle
107+
|> DynObj.withOptionalProperty "color" Color
108+
|> DynObj.withOptionalProperty "thickness" Thickness
109+
|> DynObj.withOptionalProperty "width" Width

src/Plotly.NET/Traces/ObjectAbstractions/FunnelConnector.fs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ type FunnelConnector() =
3333
[<Optional; DefaultParameterValue(null)>] ?Line: Line,
3434
[<Optional; DefaultParameterValue(null)>] ?Visible: bool
3535
) =
36-
(fun (connector: FunnelConnector) ->
36+
fun (connector: FunnelConnector) ->
3737

38-
FillColor |> DynObj.setOptionalProperty connector "fillcolor"
39-
Line |> DynObj.setOptionalProperty connector "line"
40-
Visible |> DynObj.setOptionalProperty connector "visible"
41-
42-
connector)
38+
connector
39+
|> DynObj.withOptionalProperty "fillcolor" FillColor
40+
|> DynObj.withOptionalProperty "line" Line
41+
|> DynObj.withOptionalProperty "visible" Visible

src/Plotly.NET/Traces/ObjectAbstractions/Gradient.fs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ type Gradient() =
2626

2727
fun (gradient: Gradient) ->
2828

29-
(Type, MultiTypes) |> DynObj.setOptionalSingleOrMultiProperty gradient "type"
30-
31-
Color |> DynObj.setOptionalProperty gradient "color"
32-
3329
gradient
30+
|> DynObj.withOptionalSingleOrMultiProperty "type" (Type, MultiTypes)
31+
|> DynObj.setOptionalProperty "color" Color

src/Plotly.NET/Traces/ObjectAbstractions/Indicator.fs

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ type IndicatorSymbol() =
2222
[<Optional; DefaultParameterValue(null)>] ?Color: Color,
2323
[<Optional; DefaultParameterValue(null)>] ?Symbol: string
2424
) =
25-
(fun (indicatorDirection: IndicatorSymbol) ->
25+
fun (indicatorDirection: IndicatorSymbol) ->
2626

27-
Color |> DynObj.setOptionalProperty indicatorDirection "color"
28-
Symbol |> DynObj.setOptionalProperty indicatorDirection "symbol"
29-
30-
indicatorDirection)
27+
indicatorDirection
28+
|> DynObj.withOptionalProperty "color" Color
29+
|> DynObj.withOptionalProperty "symbol" Symbol
3130

3231
type IndicatorDelta() =
3332
inherit DynamicObj()
@@ -93,19 +92,18 @@ type IndicatorDelta() =
9392
[<Optional; DefaultParameterValue(null)>] ?Suffix: string,
9493
[<Optional; DefaultParameterValue(null)>] ?ValueFormat: string
9594
) =
96-
(fun (indicatorDelta: IndicatorDelta) ->
97-
98-
Decreasing |> DynObj.setOptionalProperty indicatorDelta "decreasing"
99-
Font |> DynObj.setOptionalProperty indicatorDelta "font"
100-
Increasing |> DynObj.setOptionalProperty indicatorDelta "increasing"
101-
Position |> DynObj.setOptionalPropertyBy indicatorDelta "position" StyleParam.IndicatorDeltaPosition.convert
102-
Prefix |> DynObj.setOptionalProperty indicatorDelta "prefix"
103-
Reference |> DynObj.setOptionalProperty indicatorDelta "reference"
104-
Relative |> DynObj.setOptionalProperty indicatorDelta "relative"
105-
Suffix |> DynObj.setOptionalProperty indicatorDelta "suffix"
106-
ValueFormat |> DynObj.setOptionalProperty indicatorDelta "valueformat"
107-
108-
indicatorDelta)
95+
fun (indicatorDelta: IndicatorDelta) ->
96+
97+
indicatorDelta
98+
|> DynObj.withOptionalProperty "decreasing" Decreasing
99+
|> DynObj.withOptionalProperty "font" Font
100+
|> DynObj.withOptionalProperty "increasing" Increasing
101+
|> DynObj.withOptionalPropertyBy "position" Position StyleParam.IndicatorDeltaPosition.convert
102+
|> DynObj.withOptionalProperty "prefix" Prefix
103+
|> DynObj.withOptionalProperty "reference" Reference
104+
|> DynObj.withOptionalProperty "relative" Relative
105+
|> DynObj.withOptionalProperty "suffix" Suffix
106+
|> DynObj.withOptionalProperty "valueformat" ValueFormat
109107

110108
type IndicatorNumber() =
111109
inherit DynamicObj()
@@ -127,14 +125,13 @@ type IndicatorNumber() =
127125
[<Optional; DefaultParameterValue(null)>] ?Suffix: string,
128126
[<Optional; DefaultParameterValue(null)>] ?ValueFormat: string
129127
) =
130-
(fun (indicatorNumber: IndicatorNumber) ->
131-
132-
Font |> DynObj.setOptionalProperty indicatorNumber "font"
133-
Prefix |> DynObj.setOptionalProperty indicatorNumber "prefix"
134-
Suffix |> DynObj.setOptionalProperty indicatorNumber "suffix"
135-
ValueFormat |> DynObj.setOptionalProperty indicatorNumber "valueformat"
128+
fun (indicatorNumber: IndicatorNumber) ->
136129

137-
indicatorNumber)
130+
indicatorNumber
131+
|> DynObj.withOptionalProperty "font" Font
132+
|> DynObj.withOptionalProperty "prefix" Prefix
133+
|> DynObj.withOptionalProperty "suffix" Suffix
134+
|> DynObj.withOptionalProperty "valueformat" ValueFormat
138135

139136

140137
type IndicatorBar() =

0 commit comments

Comments
 (0)