Skip to content

Commit cdacd3b

Browse files
committed
wip replace obsolete DynObj functions
1 parent f16b6ae commit cdacd3b

File tree

104 files changed

+3117
-3117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3117
-3117
lines changed

src/Plotly.NET/CSharpLayer/GenericChartExtensions.fs

+3-3
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ module GenericChartExtensions =
426426
member this.withColorBar(colorbar: ColorBar) =
427427
this
428428
|> GenericChart.mapTrace (fun t ->
429-
colorbar |> DynObj.setValue t "colorbar"
429+
colorbar |> DynObj.withProperty t "colorbar"
430430
t)
431431

432432
[<CompiledName("WithColorbar")>]
@@ -805,7 +805,7 @@ module GenericChartExtensions =
805805

806806
let updatedGrid =
807807
let currentGrid =
808-
match layout.TryGetTypedValue<LayoutGrid> "grid" with
808+
match layout.TryGetTypedPropertyValue<LayoutGrid> "grid" with
809809
| Some grid -> grid
810810
| None -> LayoutGrid()
811811

@@ -913,7 +913,7 @@ module GenericChartExtensions =
913913
member this.WithTemplate(template: Template) =
914914
this
915915
|> GenericChart.mapLayout (fun l ->
916-
template |> DynObj.setValue l "template"
916+
template |> DynObj.withProperty l "template"
917917
l)
918918

919919
// TODO: Include withLegend & withLegendStyle

src/Plotly.NET/ChartAPI/Chart.fs

+13-13
Original file line numberDiff line numberDiff line change
@@ -2746,7 +2746,7 @@ type Chart =
27462746

27472747
let layout = GenericChart.getLayout ch
27482748

2749-
layout.TryGetTypedValue<seq<Annotation>>("annotations")
2749+
layout.TryGetTypedPropertyValue<seq<Annotation>>("annotations")
27502750
|> Option.defaultValue Seq.empty
27512751
|> Seq.append annotations
27522752

@@ -2857,7 +2857,7 @@ type Chart =
28572857

28582858
let layout = GenericChart.getLayout ch
28592859

2860-
layout.TryGetTypedValue<seq<Shape>>("shapes") |> Option.defaultValue Seq.empty |> Seq.append shapes
2860+
layout.TryGetTypedPropertyValue<seq<Shape>>("shapes") |> Option.defaultValue Seq.empty |> Seq.append shapes
28612861

28622862
else
28632863
shapes
@@ -2885,7 +2885,7 @@ type Chart =
28852885

28862886
let layout = GenericChart.getLayout ch
28872887

2888-
layout.TryGetTypedValue<seq<Selection>>("selections")
2888+
layout.TryGetTypedPropertyValue<seq<Selection>>("selections")
28892889
|> Option.defaultValue Seq.empty
28902890
|> Seq.append selections
28912891

@@ -3219,10 +3219,10 @@ type Chart =
32193219
| TraceID.Carpet ->
32203220

32213221
let xAxis =
3222-
layout.TryGetTypedValue<LinearAxis> "xaxis" |> Option.defaultValue (LinearAxis.init ())
3222+
layout.TryGetTypedPropertyValue<LinearAxis> "xaxis" |> Option.defaultValue (LinearAxis.init ())
32233223

32243224
let yAxis =
3225-
layout.TryGetTypedValue<LinearAxis> "yaxis" |> Option.defaultValue (LinearAxis.init ())
3225+
layout.TryGetTypedPropertyValue<LinearAxis> "yaxis" |> Option.defaultValue (LinearAxis.init ())
32263226

32273227
let allXAxes = Layout.getXAxes layout |> Seq.map fst
32283228
let allYAxes = Layout.getYAxes layout |> Seq.map fst
@@ -3245,7 +3245,7 @@ type Chart =
32453245
| TraceID.Cartesian3D ->
32463246

32473247
let scene =
3248-
layout.TryGetTypedValue<Scene> "scene"
3248+
layout.TryGetTypedPropertyValue<Scene> "scene"
32493249
|> Option.defaultValue (Scene.init ())
32503250
|> Scene.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
32513251

@@ -3263,7 +3263,7 @@ type Chart =
32633263
| TraceID.Polar ->
32643264

32653265
let polar =
3266-
layout.TryGetTypedValue<Polar> "polar"
3266+
layout.TryGetTypedPropertyValue<Polar> "polar"
32673267
|> Option.defaultValue (Polar.init ())
32683268
|> Polar.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
32693269

@@ -3283,7 +3283,7 @@ type Chart =
32833283
| TraceID.Smith ->
32843284

32853285
let smith =
3286-
layout.TryGetTypedValue<Smith> "smith"
3286+
layout.TryGetTypedPropertyValue<Smith> "smith"
32873287
|> Option.defaultValue (Smith.init ())
32883288
|> Smith.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
32893289

@@ -3302,7 +3302,7 @@ type Chart =
33023302

33033303
| TraceID.Geo ->
33043304
let geo =
3305-
layout.TryGetTypedValue<Geo> "geo"
3305+
layout.TryGetTypedPropertyValue<Geo> "geo"
33063306
|> Option.defaultValue (Geo.init ())
33073307
|> Geo.style (Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1))
33083308

@@ -3320,7 +3320,7 @@ type Chart =
33203320

33213321
| TraceID.Mapbox ->
33223322
let mapbox =
3323-
layout.TryGetTypedValue<Mapbox> "mapbox"
3323+
layout.TryGetTypedPropertyValue<Mapbox> "mapbox"
33243324
|> Option.defaultValue (Mapbox.init ())
33253325
|> Mapbox.style (
33263326
Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1)
@@ -3345,7 +3345,7 @@ type Chart =
33453345
| TraceID.Ternary ->
33463346

33473347
let ternary =
3348-
layout.TryGetTypedValue<Ternary> "ternary"
3348+
layout.TryGetTypedPropertyValue<Ternary> "ternary"
33493349
|> Option.defaultValue (Ternary.init ())
33503350
|> Ternary.style (
33513351
Domain = LayoutObjects.Domain.init (Row = rowIndex - 1, Column = colIndex - 1)
@@ -3612,7 +3612,7 @@ type Chart =
36123612

36133613
let layout = GenericChart.getLayout ch
36143614

3615-
layout.TryGetTypedValue<seq<LayoutImage>>("images")
3615+
layout.TryGetTypedPropertyValue<seq<LayoutImage>>("images")
36163616
|> Option.defaultValue Seq.empty
36173617
|> Seq.append images
36183618

@@ -3647,7 +3647,7 @@ type Chart =
36473647

36483648
let layout = GenericChart.getLayout ch
36493649

3650-
layout.TryGetTypedValue<seq<UpdateMenu>>("updatemenus")
3650+
layout.TryGetTypedPropertyValue<seq<UpdateMenu>>("updatemenus")
36513651
|> Option.defaultValue Seq.empty
36523652
|> Seq.append updateMenus
36533653

src/Plotly.NET/ChartAPI/GenericChart.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ type GenericChart =
162162
/// <param name="gChart">the input GenericChart to get the layout size from</param>
163163
static member tryGetLayoutSize gChart =
164164
let layout = GenericChart.getLayout gChart
165-
layout.TryGetTypedValue<int> "width", layout.TryGetTypedValue<int> "height"
165+
layout.TryGetTypedPropertyValue<int> "width", layout.TryGetTypedPropertyValue<int> "height"
166166

167167
/// <summary>
168168
/// Returns the config of a given GenericChart.

src/Plotly.NET/CommonAbstractions/AutoRangeOptions.fs

+7-7
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ type AutoRangeOptions() =
5252
) =
5353
(fun (autoRangeOptions: AutoRangeOptions) ->
5454

55-
ClipMax |> DynObj.setValueOpt autoRangeOptions "clipmax"
56-
ClipMin |> DynObj.setValueOpt autoRangeOptions "clipmin"
57-
Include |> DynObj.setValueOpt autoRangeOptions "include"
58-
MaxAllowed |> DynObj.setValueOpt autoRangeOptions "maxallowed"
59-
MinAllowed |> DynObj.setValueOpt autoRangeOptions "minallowed"
60-
61-
autoRangeOptions)
55+
autoRangeOptions
56+
|> DynObj.withOptionalProperty "clipmax" ClipMax
57+
|> DynObj.withOptionalProperty "clipmin" ClipMin
58+
|> DynObj.withOptionalProperty "include" Include
59+
|> DynObj.withOptionalProperty "maxallowed" MaxAllowed
60+
|> DynObj.withOptionalProperty "minallowed" MinAllowed
61+
)

src/Plotly.NET/CommonAbstractions/ColorBar.fs

+48-48
Original file line numberDiff line numberDiff line change
@@ -254,52 +254,52 @@ type ColorBar() =
254254
) =
255255

256256
(fun (colorBar: ColorBar) ->
257+
colorBar
258+
|> DynObj.withOptionalProperty "bgcolor" BGColor
259+
|> DynObj.withOptionalProperty "bordercolor" BorderColor
260+
|> DynObj.withOptionalProperty "borderwidth" BorderWidth
261+
|> DynObj.withOptionalProperty "dtick" DTick
262+
|> DynObj.withOptionalPropertyBy "exponentformat" ExponentFormat StyleParam.ExponentFormat.convert
263+
|> DynObj.withOptionalProperty "labelalias" LabelAlias
264+
|> DynObj.withOptionalProperty "len" Len
265+
|> DynObj.withOptionalPropertyBy "lenmode" LenMode StyleParam.UnitMode.convert
266+
|> DynObj.withOptionalProperty "min3xponent" MinExponent
267+
|> DynObj.withOptionalProperty "nticks" NTicks
268+
|> DynObj.withOptionalPropertyBy "orientation" Orientation StyleParam.Orientation.convert
269+
|> DynObj.withOptionalProperty "outlinecolor" OutlineColor
270+
|> DynObj.withOptionalProperty "outlinewidth" OutlineWidth
271+
|> DynObj.withOptionalProperty "separatethousands" SeparateThousands
272+
|> DynObj.withOptionalPropertyBy "showexponent" ShowExponent StyleParam.ShowExponent.convert
273+
|> DynObj.withOptionalProperty "showticklabels" ShowTickLabels
274+
|> DynObj.withOptionalPropertyBy "showtickprefix" ShowTickPrefix StyleParam.ShowTickOption.convert
275+
|> DynObj.withOptionalPropertyBy "showticksuffix" ShowTickSuffix StyleParam.ShowTickOption.convert
276+
|> DynObj.withOptionalProperty "thickness" Thickness
277+
|> DynObj.withOptionalPropertyBy "thicknessmode" ThicknessMode StyleParam.UnitMode.convert
278+
|> DynObj.withOptionalProperty "tick0" Tick0
279+
|> DynObj.withOptionalProperty "tickangle" TickAngle
280+
|> DynObj.withOptionalProperty "tickcolor" TickColor
281+
|> DynObj.withOptionalProperty "tickfont" TickFont
282+
|> DynObj.withOptionalProperty "tickformat" TickFormat
283+
|> DynObj.withOptionalProperty "tickformatstops" TickFormatStops
284+
|> DynObj.withOptionalPropertyBy "ticklabeloverflow" TickLabelOverflow StyleParam.TickLabelOverflow.convert
285+
|> DynObj.withOptionalPropertyBy "ticklabelposition" TickLabelPosition StyleParam.TickLabelPosition.convert
286+
|> DynObj.withOptionalProperty "ticklabelstep" TickLabelStep
287+
|> DynObj.withOptionalProperty "ticklen" TickLen
288+
|> DynObj.withOptionalPropertyBy "tickmode" TickMode StyleParam.TickMode.convert
289+
|> DynObj.withOptionalProperty "tickprefix" TickPrefix
290+
|> DynObj.withOptionalPropertyBy "ticks" Ticks StyleParam.TickOptions.convert
291+
|> DynObj.withOptionalProperty "ticksuffix" TickSuffix
292+
|> DynObj.withOptionalProperty "ticktext" TickText
293+
|> DynObj.withOptionalProperty "tickvals" TickVals
294+
|> DynObj.withOptionalProperty "tickwidth" TickWidth
295+
|> DynObj.withOptionalProperty "title" Title
296+
|> DynObj.withOptionalProperty "x" X
297+
|> DynObj.withOptionalPropertyBy "xanchor" XAnchor StyleParam.HorizontalAlign.convert
298+
|> DynObj.withOptionalProperty "xpad" XPad
299+
|> DynObj.withOptionalProperty "xref" XRef
300+
|> DynObj.withOptionalProperty "y" Y
301+
|> DynObj.withOptionalPropertyBy "yanchor" YAnchor StyleParam.VerticalAlign.convert
302+
|> DynObj.withOptionalProperty "ypad" YPad
303+
|> DynObj.withOptionalProperty "yref" YRef
257304

258-
BGColor |> DynObj.setValueOpt colorBar "bgcolor"
259-
BorderColor |> DynObj.setValueOpt colorBar "bordercolor"
260-
BorderWidth |> DynObj.setValueOpt colorBar "borderwidth"
261-
DTick |> DynObj.setValueOpt colorBar "dtick"
262-
ExponentFormat |> DynObj.setValueOptBy colorBar "exponentformat" StyleParam.ExponentFormat.convert
263-
LabelAlias |> DynObj.setValueOpt colorBar "labelalias"
264-
Len |> DynObj.setValueOpt colorBar "len"
265-
LenMode |> DynObj.setValueOptBy colorBar "lenmode" StyleParam.UnitMode.convert
266-
MinExponent |> DynObj.setValueOpt colorBar "min3xponent"
267-
NTicks |> DynObj.setValueOpt colorBar "nticks"
268-
Orientation |> DynObj.setValueOptBy colorBar "orientation" StyleParam.Orientation.convert
269-
OutlineColor |> DynObj.setValueOpt colorBar "outlinecolor"
270-
OutlineWidth |> DynObj.setValueOpt colorBar "outlinewidth"
271-
SeparateThousands |> DynObj.setValueOpt colorBar "separatethousands"
272-
ShowExponent |> DynObj.setValueOptBy colorBar "showexponent" StyleParam.ShowExponent.convert
273-
ShowTickLabels |> DynObj.setValueOpt colorBar "showticklabels"
274-
ShowTickPrefix |> DynObj.setValueOptBy colorBar "showtickprefix" StyleParam.ShowTickOption.convert
275-
ShowTickSuffix |> DynObj.setValueOptBy colorBar "showticksuffix" StyleParam.ShowTickOption.convert
276-
Thickness |> DynObj.setValueOpt colorBar "thickness"
277-
ThicknessMode |> DynObj.setValueOptBy colorBar "thicknessmode" StyleParam.UnitMode.convert
278-
Tick0 |> DynObj.setValueOpt colorBar "tick0"
279-
TickAngle |> DynObj.setValueOpt colorBar "tickangle"
280-
TickColor |> DynObj.setValueOpt colorBar "tickcolor"
281-
TickFont |> DynObj.setValueOpt colorBar "tickfont"
282-
TickFormat |> DynObj.setValueOpt colorBar "tickformat"
283-
TickFormatStops |> DynObj.setValueOpt colorBar "tickformatstops"
284-
TickLabelOverflow |> DynObj.setValueOptBy colorBar "ticklabeloverflow" StyleParam.TickLabelOverflow.convert
285-
TickLabelPosition |> DynObj.setValueOptBy colorBar "ticklabelposition" StyleParam.TickLabelPosition.convert
286-
TickLabelStep |> DynObj.setValueOpt colorBar "ticklabelstep"
287-
TickLen |> DynObj.setValueOpt colorBar "ticklen"
288-
TickMode |> DynObj.setValueOptBy colorBar "tickmode" StyleParam.TickMode.convert
289-
TickPrefix |> DynObj.setValueOpt colorBar "tickprefix"
290-
Ticks |> DynObj.setValueOptBy colorBar "ticks" StyleParam.TickOptions.convert
291-
TickSuffix |> DynObj.setValueOpt colorBar "ticksuffix"
292-
TickText |> DynObj.setValueOpt colorBar "ticktext"
293-
TickVals |> DynObj.setValueOpt colorBar "tickvals"
294-
TickWidth |> DynObj.setValueOpt colorBar "tickwidth"
295-
Title |> DynObj.setValueOpt colorBar "title"
296-
X |> DynObj.setValueOpt colorBar "x"
297-
XAnchor |> DynObj.setValueOptBy colorBar "xanchor" StyleParam.HorizontalAlign.convert
298-
XPad |> DynObj.setValueOpt colorBar "xpad"
299-
XRef |> DynObj.setValueOpt colorBar "xref"
300-
Y |> DynObj.setValueOpt colorBar "y"
301-
YAnchor |> DynObj.setValueOptBy colorBar "yanchor" StyleParam.VerticalAlign.convert
302-
YPad |> DynObj.setValueOpt colorBar "ypad"
303-
YRef |> DynObj.setValueOpt colorBar "yref"
304-
305-
colorBar)
305+
)

src/Plotly.NET/CommonAbstractions/Font.fs

+5-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ type Font() =
2626
[<Optional; DefaultParameterValue(null)>] ?Color: Color
2727
) =
2828
(fun (font: Font) ->
29-
30-
Family |> DynObj.setValueOptBy font "family" StyleParam.FontFamily.toString
31-
Size |> DynObj.setValueOpt font "size"
32-
Color |> DynObj.setValueOpt font "color"
33-
34-
font)
29+
font
30+
|> DynObj.withOptionalPropertyBy "family" Family StyleParam.FontFamily.toString
31+
|> DynObj.withOptionalProperty "size" Size
32+
|> DynObj.withOptionalProperty "color" Color
33+
)

src/Plotly.NET/CommonAbstractions/Line.fs

+22-21
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,26 @@ type Line() =
125125
[<Optional; DefaultParameterValue(null)>] ?OutlierWidth: float
126126
) =
127127
(fun (line: Line) ->
128-
BackOff |> DynObj.setValueOptBy line "backoff" StyleParam.BackOff.convert
129-
Color |> DynObj.setValueOpt line "color"
130-
(Width, MultiWidth) |> DynObj.setSingleOrMultiOpt line "width"
131-
Shape |> DynObj.setValueOptBy line "shape" StyleParam.Shape.convert
132-
Smoothing |> DynObj.setValueOpt line "smoothing"
133-
Dash |> DynObj.setValueOptBy line "dash" StyleParam.DrawingStyle.convert
134-
OutlierColor |> DynObj.setValueOpt line "outliercolor"
135-
OutlierWidth |> DynObj.setValueOpt line "outlierwidth"
136-
AutoColorScale |> DynObj.setValueOpt line "autocolorscale"
137-
CAuto |> DynObj.setValueOpt line "cauto"
138-
CMax |> DynObj.setValueOpt line "cmax"
139-
CMid |> DynObj.setValueOpt line "cmid"
140-
CMin |> DynObj.setValueOpt line "cmin"
141-
Color |> DynObj.setValueOpt line "color"
142-
ColorAxis |> DynObj.setValueOptBy line "coloraxis" StyleParam.SubPlotId.convert
143-
Colorscale |> DynObj.setValueOptBy line "colorscale" StyleParam.Colorscale.convert
144-
ReverseScale |> DynObj.setValueOpt line "reversescale"
145-
ShowScale |> DynObj.setValueOpt line "showscale"
146-
ColorBar |> DynObj.setValueOpt line "colorbar"
147-
Simplify |> DynObj.setValueOpt line "simplify"
128+
line
129+
|> DynObj.withOptionalPropertyBy "backoff" BackOff StyleParam.BackOff.convert
130+
|> DynObj.withOptionalProperty "color" Color
131+
|> DynObj.withOptionalSingleOrMultiProperty "width" (Width, MultiWidth)
132+
|> DynObj.withOptionalPropertyBy "shape" Shape StyleParam.Shape.convert
133+
|> DynObj.withOptionalProperty "smoothing" Smoothing
134+
|> DynObj.withOptionalPropertyBy "dash" Dash StyleParam.DrawingStyle.convert
135+
|> DynObj.withOptionalProperty "outliercolor" OutlierColor
136+
|> DynObj.withOptionalProperty "outlierwidth" OutlierWidth
137+
|> DynObj.withOptionalProperty "autocolorscale" AutoColorScale
138+
|> DynObj.withOptionalProperty "cauto" CAuto
139+
|> DynObj.withOptionalProperty "cmax" CMax
140+
|> DynObj.withOptionalProperty "cmid" CMid
141+
|> DynObj.withOptionalProperty "cmin" CMin
142+
|> DynObj.withOptionalProperty "color" Color
143+
|> DynObj.withOptionalPropertyBy "coloraxis" ColorAxis StyleParam.SubPlotId.convert
144+
|> DynObj.withOptionalPropertyBy "colorscale" Colorscale StyleParam.Colorscale.convert
145+
|> DynObj.withOptionalProperty "reversescale" ReverseScale
146+
|> DynObj.withOptionalProperty "showscale" ShowScale
147+
|> DynObj.withOptionalProperty "colorbar" ColorBar
148+
|> DynObj.withOptionalProperty "simplify" Simplify
148149

149-
line)
150+
)

0 commit comments

Comments
 (0)