Skip to content

Commit 300eab3

Browse files
committed
port tracegeo to dynobj v4
1 parent 21b25a3 commit 300eab3

File tree

1 file changed

+77
-86
lines changed

1 file changed

+77
-86
lines changed

src/Plotly.NET/Traces/TraceGeo.fs

Lines changed: 77 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ type TraceGeo(traceTypeName) =
3939
type TraceGeoStyle() =
4040

4141
static member SetGeo([<Optional; DefaultParameterValue(null)>] ?GeoId: StyleParam.SubPlotId) =
42-
(fun (trace: TraceGeo) ->
42+
fun (trace: TraceGeo) ->
43+
trace |> DynObj.withOptionalPropertyBy "geo" GeoId StyleParam.SubPlotId.toString
4344

44-
GeoId |> DynObj.setOptionalPropertyBy trace "geo" StyleParam.SubPlotId.toString
45-
46-
trace)
4745

4846
/// <summary>
4947
/// Creates a function that applies the styles of a choropleth map to a Trace object
@@ -129,46 +127,45 @@ type TraceGeoStyle() =
129127
[<Optional; DefaultParameterValue(null)>] ?LocationMode: StyleParam.LocationFormat,
130128
[<Optional; DefaultParameterValue(null)>] ?UIRevision: string
131129
) =
132-
(fun (trace: #Trace) ->
133-
134-
Name |> DynObj.setOptionalProperty trace "name"
135-
Visible |> DynObj.setOptionalPropertyBy trace "visible" StyleParam.Visible.convert
136-
ShowLegend |> DynObj.setOptionalProperty trace "showlegend"
137-
Legend |> DynObj.setOptionalPropertyBy trace "legend" StyleParam.SubPlotId.convert
138-
LegendRank |> DynObj.setOptionalProperty trace "legendrank"
139-
LegendGroup |> DynObj.setOptionalProperty trace "legendgroup"
140-
LegendGroupTitle |> DynObj.setOptionalProperty trace "legendgrouptitle"
141-
Ids |> DynObj.setOptionalProperty trace "ids"
142-
Z |> DynObj.setOptionalProperty trace "z"
143-
GeoJson |> DynObj.setOptionalProperty trace "geojson"
144-
FeatureIdKey |> DynObj.setOptionalProperty trace "featureidkey"
145-
Locations |> DynObj.setOptionalProperty trace "locations"
146-
(Text, MultiText) |> DynObj.setOptionalSingleOrMultiProperty trace "text"
147-
(HoverText, MultiHoverText) |> DynObj.setOptionalSingleOrMultiProperty trace "hovertext"
148-
HoverInfo |> DynObj.setOptionalPropertyBy trace "hoverinfo" StyleParam.HoverInfo.convert
149-
(HoverTemplate, MultiHoverTemplate) |> DynObj.setOptionalSingleOrMultiProperty trace "hovertemplate"
150-
Meta |> DynObj.setOptionalProperty trace "meta"
151-
CustomData |> DynObj.setOptionalProperty trace "customdata"
152-
Geo |> DynObj.setOptionalPropertyBy trace "geo" StyleParam.SubPlotId.convert
153-
ColorAxis |> DynObj.setOptionalPropertyBy trace "coloraxis" StyleParam.SubPlotId.convert
154-
Marker |> DynObj.setOptionalProperty trace "marker"
155-
ColorBar |> DynObj.setOptionalProperty trace "colorbar"
156-
AutoColorScale |> DynObj.setOptionalProperty trace "autocolorscale"
157-
ColorScale |> DynObj.setOptionalPropertyBy trace "colorscale" StyleParam.Colorscale.convert
158-
ShowScale |> DynObj.setOptionalProperty trace "showscale"
159-
ReverseScale |> DynObj.setOptionalProperty trace "reversescale"
160-
ZAuto |> DynObj.setOptionalProperty trace "zauto"
161-
Zmin |> DynObj.setOptionalProperty trace "zmin"
162-
Zmid |> DynObj.setOptionalProperty trace "zmid"
163-
Zmax |> DynObj.setOptionalProperty trace "zmax"
164-
SelectedPoints |> DynObj.setOptionalProperty trace "selectedpoints"
165-
Selected |> DynObj.setOptionalProperty trace "selected"
166-
Unselected |> DynObj.setOptionalProperty trace "unselected"
167-
HoverLabel |> DynObj.setOptionalProperty trace "hoverlabel"
168-
LocationMode |> DynObj.setOptionalPropertyBy trace "locationmode" StyleParam.LocationFormat.convert
169-
UIRevision |> DynObj.setOptionalProperty trace "uirevision"
130+
fun (trace: #Trace) ->
170131

171-
trace)
132+
trace
133+
|> DynObj.withOptionalProperty "name" Name
134+
|> DynObj.withOptionalPropertyBy "visible" Visible StyleParam.Visible.convert
135+
|> DynObj.withOptionalProperty "showlegend" ShowLegend
136+
|> DynObj.withOptionalPropertyBy "legend" Legend StyleParam.SubPlotId.convert
137+
|> DynObj.withOptionalProperty "legendrank" LegendRank
138+
|> DynObj.withOptionalProperty "legendgroup" LegendGroup
139+
|> DynObj.withOptionalProperty "legendgrouptitle"LegendGroupTitle
140+
|> DynObj.withOptionalProperty "ids" Ids
141+
|> DynObj.withOptionalProperty "z" Z
142+
|> DynObj.withOptionalProperty "geojson" GeoJson
143+
|> DynObj.withOptionalProperty "featureidkey" FeatureIdKey
144+
|> DynObj.withOptionalProperty "locations" Locations
145+
|> DynObj.withOptionalSingleOrMultiProperty "text" (Text, MultiText)
146+
|> DynObj.withOptionalSingleOrMultiProperty "hovertext" (HoverText, MultiHoverText)
147+
|> DynObj.withOptionalPropertyBy "hoverinfo" HoverInfo StyleParam.HoverInfo.convert
148+
|> DynObj.withOptionalSingleOrMultiProperty "hovertemplate" (HoverTemplate, MultiHoverTemplate)
149+
|> DynObj.withOptionalProperty "meta" Meta
150+
|> DynObj.withOptionalProperty "customdata" CustomData
151+
|> DynObj.withOptionalPropertyBy "geo" Geo StyleParam.SubPlotId.convert
152+
|> DynObj.withOptionalPropertyBy "coloraxis" ColorAxis StyleParam.SubPlotId.convert
153+
|> DynObj.withOptionalProperty "marker" Marker
154+
|> DynObj.withOptionalProperty "colorbar" ColorBar
155+
|> DynObj.withOptionalProperty "autocolorscale" AutoColorScale
156+
|> DynObj.withOptionalPropertyBy "colorscale" ColorScale StyleParam.Colorscale.convert
157+
|> DynObj.withOptionalProperty "showscale" ShowScale
158+
|> DynObj.withOptionalProperty "reversescale" ReverseScale
159+
|> DynObj.withOptionalProperty "zauto" ZAuto
160+
|> DynObj.withOptionalProperty "zmin" Zmin
161+
|> DynObj.withOptionalProperty "zmid" Zmid
162+
|> DynObj.withOptionalProperty "zmax" Zmax
163+
|> DynObj.withOptionalProperty "selectedpoints" SelectedPoints
164+
|> DynObj.withOptionalProperty "selected" Selected
165+
|> DynObj.withOptionalProperty "unselected" Unselected
166+
|> DynObj.withOptionalProperty "hoverlabel" HoverLabel
167+
|> DynObj.withOptionalPropertyBy "locationmode" LocationMode StyleParam.LocationFormat.convert
168+
|> DynObj.withOptionalProperty "uirevision" UIRevision
172169

173170
/// <summary>
174171
/// Creates a function that applies the styles of a scattergeo plot to a Trace object
@@ -258,48 +255,42 @@ type TraceGeoStyle() =
258255
[<Optional; DefaultParameterValue(null)>] ?LocationMode: StyleParam.LocationFormat,
259256
[<Optional; DefaultParameterValue(null)>] ?UIRevision: string
260257
) =
261-
(fun (trace: #Trace) ->
262-
263-
Name |> DynObj.setOptionalProperty trace "name"
264-
Visible |> DynObj.setOptionalPropertyBy trace "visible" StyleParam.Visible.convert
265-
ShowLegend |> DynObj.setOptionalProperty trace "showlegend"
266-
Legend |> DynObj.setOptionalPropertyBy trace "legend" StyleParam.SubPlotId.convert
267-
LegendRank |> DynObj.setOptionalProperty trace "legendrank"
268-
LegendGroup |> DynObj.setOptionalProperty trace "legendgroup"
269-
LegendGroupTitle |> DynObj.setOptionalProperty trace "legendgrouptitle"
270-
Opacity |> DynObj.setOptionalProperty trace "opacity"
271-
Mode |> DynObj.setOptionalPropertyBy trace "mode" StyleParam.Mode.convert
272-
Ids |> DynObj.setOptionalProperty trace "ids"
273-
Lat |> DynObj.setOptionalProperty trace "lat"
274-
GeoJson |> DynObj.setOptionalProperty trace "geojson"
275-
FeatureIdKey |> DynObj.setOptionalProperty trace "featureidkey"
276-
Locations |> DynObj.setOptionalProperty trace "locations"
277-
Lon |> DynObj.setOptionalProperty trace "lon"
278-
(Text, MultiText) |> DynObj.setOptionalSingleOrMultiProperty trace "text"
279-
280-
(TextPosition, MultiTextPosition)
281-
|> DynObj.setOptionalSingleOrMultiPropertyBy trace "textposition" StyleParam.TextPosition.convert
282-
283-
(TextTemplate, MultiTextTemplate) |> DynObj.setOptionalSingleOrMultiProperty trace "texttemplate"
284-
(HoverText, MultiHoverText) |> DynObj.setOptionalSingleOrMultiProperty trace "hovertext"
285-
HoverInfo |> DynObj.setOptionalPropertyBy trace "hoverinfo" StyleParam.HoverInfo.convert
286-
(HoverTemplate, MultiHoverTemplate) |> DynObj.setOptionalSingleOrMultiProperty trace "hovertemplate"
287-
Meta |> DynObj.setOptionalProperty trace "meta"
288-
CustomData |> DynObj.setOptionalProperty trace "customdata"
289-
Geo |> DynObj.setOptionalPropertyBy trace "geo" StyleParam.SubPlotId.convert
290-
Marker |> DynObj.setOptionalProperty trace "marker"
291-
Line |> DynObj.setOptionalProperty trace "line"
292-
TextFont |> DynObj.setOptionalProperty trace "textfont"
293-
SelectedPoints |> DynObj.setOptionalProperty trace "selectedpoints"
294-
Selected |> DynObj.setOptionalProperty trace "selected"
295-
Unselected |> DynObj.setOptionalProperty trace "unselected"
296-
ConnectGaps |> DynObj.setOptionalProperty trace "connectgaps"
297-
Fill |> DynObj.setOptionalPropertyBy trace "fill" StyleParam.Fill.convert
298-
FillColor |> DynObj.setOptionalProperty trace "fillcolor"
299-
HoverLabel |> DynObj.setOptionalProperty trace "hoverlabel"
300-
LocationMode |> DynObj.setOptionalPropertyBy trace "locationmode" StyleParam.LocationFormat.convert
301-
UIRevision |> DynObj.setOptionalProperty trace "uirevision"
258+
fun (trace: #Trace) ->
302259

303260
trace
304-
305-
)
261+
|> DynObj.withOptionalProperty "name" Name
262+
|> DynObj.withOptionalPropertyBy "visible" Visible StyleParam.Visible.convert
263+
|> DynObj.withOptionalProperty "showlegend" ShowLegend
264+
|> DynObj.withOptionalPropertyBy "legend" Legend StyleParam.SubPlotId.convert
265+
|> DynObj.withOptionalProperty "legendrank" LegendRank
266+
|> DynObj.withOptionalProperty "legendgroup" LegendGroup
267+
|> DynObj.withOptionalProperty "legendgrouptitle" LegendGroupTitle
268+
|> DynObj.withOptionalProperty "opacity" Opacity
269+
|> DynObj.withOptionalPropertyBy "mode" Mode StyleParam.Mode.convert
270+
|> DynObj.withOptionalProperty "ids" Ids
271+
|> DynObj.withOptionalProperty "lat" Lat
272+
|> DynObj.withOptionalProperty "geojson" GeoJson
273+
|> DynObj.withOptionalProperty "featureidkey" FeatureIdKey
274+
|> DynObj.withOptionalProperty "locations" Locations
275+
|> DynObj.withOptionalProperty "lon" Lon
276+
|> DynObj.withOptionalSingleOrMultiProperty "text" (Text, MultiText)
277+
|> DynObj.withOptionalSingleOrMultiPropertyBy "textposition" (TextPosition, MultiTextPosition) StyleParam.TextPosition.convert
278+
|> DynObj.withOptionalSingleOrMultiProperty "texttemplate" (TextTemplate, MultiTextTemplate)
279+
|> DynObj.withOptionalSingleOrMultiProperty "hovertext" (HoverText, MultiHoverText)
280+
|> DynObj.withOptionalPropertyBy "hoverinfo" HoverInfo StyleParam.HoverInfo.convert
281+
|> DynObj.withOptionalSingleOrMultiProperty "hovertemplate" (HoverTemplate, MultiHoverTemplate)
282+
|> DynObj.withOptionalProperty "meta" Meta
283+
|> DynObj.withOptionalProperty "customdata" CustomData
284+
|> DynObj.withOptionalPropertyBy "geo" Geo StyleParam.SubPlotId.convert
285+
|> DynObj.withOptionalProperty "marker" Marker
286+
|> DynObj.withOptionalProperty "line" Line
287+
|> DynObj.withOptionalProperty "textfont" TextFont
288+
|> DynObj.withOptionalProperty "selectedpoints" SelectedPoints
289+
|> DynObj.withOptionalProperty "selected" Selected
290+
|> DynObj.withOptionalProperty "unselected" Unselected
291+
|> DynObj.withOptionalProperty "connectgaps" ConnectGaps
292+
|> DynObj.withOptionalPropertyBy "fill" Fill StyleParam.Fill.convert
293+
|> DynObj.withOptionalProperty "fillcolor" FillColor
294+
|> DynObj.withOptionalProperty "hoverlabel" HoverLabel
295+
|> DynObj.withOptionalPropertyBy "locationmode" LocationMode StyleParam.LocationFormat.convert
296+
|> DynObj.withOptionalProperty "uirevision" UIRevision

0 commit comments

Comments
 (0)