Skip to content

Commit 1aa1025

Browse files
committed
Add getters/setters for axes on scene objects
1 parent fe9ef2e commit 1aa1025

File tree

1 file changed

+61
-0
lines changed
  • src/Plotly.NET/Layout/ObjectAbstractions/3D

1 file changed

+61
-0
lines changed

src/Plotly.NET/Layout/ObjectAbstractions/3D/Scene.fs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,64 @@ type Scene() =
102102
ZAxis |> DynObj.setValueOpt scene "zaxis"
103103

104104
scene)
105+
106+
/// <summary>
107+
/// Returns Some(dynamic member value) of the trace object's underlying DynamicObj when a dynamic member eith the given name exists, and None otherwise.
108+
/// </summary>
109+
/// <param name="propName">The name of the dynamic member to get the value of</param>
110+
/// <param name="scene">The trace to get the dynamic member value from</param>
111+
static member tryGetTypedMember<'T> (propName: string) (scene: Scene) = scene.TryGetTypedValue<'T>(propName)
112+
113+
/// <summary>
114+
/// Returns the x axis object of the given trace.
115+
///
116+
/// If there is no x axis set, returns an empty LinearAxis object.
117+
/// </summary>
118+
/// <param name="scene">The scene to get the marker from</param>
119+
static member getXAxis(scene: Scene) =
120+
scene |> Scene.tryGetTypedMember<LinearAxis> "xaxis" |> Option.defaultValue (LinearAxis.init ())
121+
122+
/// <summary>
123+
/// Returns a function that sets the x axis object of the given trace.
124+
/// </summary>
125+
/// <param name="xAxis">The new x axis object</param>
126+
static member setXAxis(xAxis: LinearAxis) =
127+
(fun (scene: Scene) ->
128+
scene.SetValue("xaxis", xAxis)
129+
scene)
130+
131+
/// <summary>
132+
/// Returns the y axis object of the given trace.
133+
///
134+
/// If there is no y axis set, returns an empty LinearAxis object.
135+
/// </summary>
136+
/// <param name="scene">The scene to get the marker from</param>
137+
static member getYAxis(scene: Scene) =
138+
scene |> Scene.tryGetTypedMember<LinearAxis> "yaxis" |> Option.defaultValue (LinearAxis.init ())
139+
140+
/// <summary>
141+
/// Returns a function that sets the y axis object of the given trace.
142+
/// </summary>
143+
/// <param name="yAxis">The new y axis object</param>
144+
static member setYAxis(yAxis: LinearAxis) =
145+
(fun (scene: Scene) ->
146+
scene.SetValue("yaxis", yAxis)
147+
scene)
148+
149+
/// <summary>
150+
/// Returns the z axis object of the given trace.
151+
///
152+
/// If there is no z axis set, returns an empty LinearAxis object.
153+
/// </summary>
154+
/// <param name="scene">The scene to get the marker from</param>
155+
static member getZAxis(scene: Scene) =
156+
scene |> Scene.tryGetTypedMember<LinearAxis> "zaxis" |> Option.defaultValue (LinearAxis.init ())
157+
158+
/// <summary>
159+
/// Returns a function that sets the z axis object of the given trace.
160+
/// </summary>
161+
/// <param name="zAxis">The new z axis object</param>
162+
static member setZAxis(zAxis: LinearAxis) =
163+
(fun (scene: Scene) ->
164+
scene.SetValue("zaxis", zAxis)
165+
scene)

0 commit comments

Comments
 (0)