Skip to content

Commit ad2cb9a

Browse files
authored
Merge branch 'dev' into #266-title-alignment
2 parents 03afc72 + d13c047 commit ad2cb9a

File tree

12 files changed

+1318
-427
lines changed

12 files changed

+1318
-427
lines changed

src/Plotly.NET.ImageExport/Plotly.NET.ImageExport.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</ItemGroup>
3838

3939
<ItemGroup>
40-
<PackageReference Include="DynamicObj" Version="0.2.0" />
40+
<PackageReference Include="DynamicObj" Version="1.0.1" />
4141
<PackageReference Include="PuppeteerSharp" Version="6.0.0" />
4242
</ItemGroup>
4343

src/Plotly.NET/CSharpLayer/GenericChartExtensions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ module GenericChartExtensions =
606606
[<Extension>]
607607
member this.WithLayoutGrid(layoutGrid: LayoutGrid) =
608608
let layout =
609-
GenericChart.getLayout this |> Layout.SetLayoutGrid layoutGrid
609+
GenericChart.getLayout this |> Layout.setLayoutGrid layoutGrid
610610

611611
GenericChart.setLayout layout this
612612

@@ -831,7 +831,7 @@ module GenericChartExtensions =
831831
) in
832832

833833
let updatedLayout =
834-
layout |> Layout.SetLayoutGrid updatedGrid in
834+
layout |> Layout.setLayoutGrid updatedGrid in
835835

836836
GenericChart.setLayout updatedLayout this
837837

src/Plotly.NET/ChartAPI/Chart.fs

Lines changed: 574 additions & 314 deletions
Large diffs are not rendered by default.

src/Plotly.NET/CommonAbstractions/StyleParams.fs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Plotly.NET
22

3-
3+
open System
44
// https://plot.ly/javascript/reference/
55
// https://plot.ly/javascript-graphing-library/reference/
66

@@ -166,6 +166,7 @@ module StyleParam =
166166
type SubPlotId =
167167
| XAxis of int
168168
| YAxis of int
169+
| ZAxis
169170
| ColorAxis of int
170171
| Geo of int
171172
| Mapbox of int
@@ -186,6 +187,7 @@ module StyleParam =
186187
"yaxis"
187188
else
188189
sprintf "yaxis%i" id
190+
| ZAxis -> "zaxis"
189191
| ColorAxis id ->
190192
if id < 2 then
191193
"coloraxis"
@@ -2258,8 +2260,14 @@ module StyleParam =
22582260
/// Defines a Range between min and max value
22592261
[<RequireQualifiedAccess>]
22602262
type Range =
2261-
| MinMax of float * float
2262-
| Values of array<float>
2263+
| MinMax of IConvertible * IConvertible
2264+
| Values of array<IConvertible>
2265+
2266+
static member ofMinMax(min: #IConvertible, max: #IConvertible) =
2267+
MinMax(min :> IConvertible, max :> IConvertible)
2268+
2269+
static member ofValues(values: seq<#IConvertible>) =
2270+
Values(values |> Array.ofSeq |> Array.map (fun x -> x :> IConvertible))
22632271

22642272
static member convert =
22652273
function
@@ -3132,6 +3140,20 @@ module StyleParam =
31323140
override this.ToString() = this |> TraceItemClickOptions.toString
31333141
member this.Convert() = this |> TraceItemClickOptions.convert
31343142

3143+
[<RequireQualifiedAccess>]
3144+
type TraceGroupClickOptions =
3145+
| ToggleItem
3146+
| ToggleGroup
3147+
3148+
static member toString =
3149+
function
3150+
| Toggle -> "toggleitem"
3151+
| ToggleGroup -> "togglegroup"
3152+
3153+
static member convert = TraceGroupClickOptions.toString >> box
3154+
override this.ToString() = this |> TraceGroupClickOptions.toString
3155+
member this.Convert() = this |> TraceGroupClickOptions.convert
3156+
31353157
[<RequireQualifiedAccess>]
31363158
type TickLabelMode =
31373159
| Instant

src/Plotly.NET/Layout/Layout.fs

Lines changed: 319 additions & 31 deletions
Large diffs are not rendered by default.

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)