Skip to content

Commit 1d10820

Browse files
committed
Fix some properties on Error and ColorAxis
1 parent 13a3b95 commit 1d10820

File tree

3 files changed

+39
-13
lines changed

3 files changed

+39
-13
lines changed

src/Plotly.NET/CommonAbstractions/StyleParams.fs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,22 @@ module StyleParam =
715715
// #E#
716716
//--------------------------
717717

718+
[<RequireQualifiedAccess>]
719+
type ErrorType =
720+
| Percent | Constant| Sqrt | Data
721+
722+
static member toString = function
723+
| Percent -> "percent"
724+
| Constant -> "constant"
725+
| Sqrt -> "sqrt"
726+
| Data -> "data"
727+
728+
729+
static member convert = ErrorType.toString >> box
730+
override this.ToString() = this |> ErrorType.toString
731+
member this.Convert() = this |> ErrorType.convert
732+
733+
718734
/// Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9.
719735
/// If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B.
720736
[<RequireQualifiedAccess>]

src/Plotly.NET/Layout/ObjectAbstractions/Common/ColorAxis.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ type ColorAxis() =
7878
CMid |> DynObj.setValueOpt ca "cmid"
7979
CMax |> DynObj.setValueOpt ca "cmax"
8080
ColorBar |> DynObj.setValueOpt ca "colorbar"
81-
ColorScale |> DynObj.setValueOpt ca "colorscale"
82-
ShowScale |> DynObj.setValueOpt ca "showscale"
81+
ColorScale |> DynObj.setValueOptBy ca "colorscale" StyleParam.Colorscale.convert
82+
ShowScale |> DynObj.setValueOpt ca "showscale"
8383
ReverseScale |> DynObj.setValueOpt ca "reversescale"
8484

8585
ca

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ type Error () =
1111
inherit DynamicObj ()
1212

1313
/// <summary>Init Error type</summary>
14+
/// <param name ="Visible">Determines whether or not this set of error bars is visible.</param>
15+
/// <param name ="Type">Determines the rule used to generate the error bars. If "constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "sqrt", the bar lengths correspond to the square of the underlying data. If "data", the bar lengths are set with data set `array`.</param>
1416
/// <param name ="Symmetric">Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars.</param>
1517
/// <param name ="Array">Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.</param>
1618
/// <param name ="Arrayminus">Sets the data corresponding the length of each error bar in the bottom (left) direction for vertical (horizontal) bars Values are plotted relative to the underlying data.</param>
@@ -24,6 +26,8 @@ type Error () =
2426
/// <param name ="Width">Sets the width (in px) of the cross-bar at both ends of the error bars.</param>
2527
static member init
2628
(
29+
[<Optional;DefaultParameterValue(null)>] ?Visible: bool,
30+
[<Optional;DefaultParameterValue(null)>] ?Type: StyleParam.ErrorType,
2731
[<Optional;DefaultParameterValue(null)>] ?Symmetric: bool,
2832
[<Optional;DefaultParameterValue(null)>] ?Array: seq<#IConvertible>,
2933
[<Optional;DefaultParameterValue(null)>] ?Arrayminus: seq<#IConvertible>,
@@ -53,6 +57,8 @@ type Error () =
5357
)
5458

5559
/// <summary>Creates a function that applies the given style parameters to an Error object</summary>
60+
/// <param name ="Visible">Determines whether or not this set of error bars is visible.</param>
61+
/// <param name ="Type">Determines the rule used to generate the error bars. If "constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "sqrt", the bar lengths correspond to the square of the underlying data. If "data", the bar lengths are set with data set `array`.</param>
5662
/// <param name ="Symmetric">Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars.</param>
5763
/// <param name ="Array">Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.</param>
5864
/// <param name ="Arrayminus">Sets the data corresponding the length of each error bar in the bottom (left) direction for vertical (horizontal) bars Values are plotted relative to the underlying data.</param>
@@ -66,6 +72,8 @@ type Error () =
6672
/// <param name ="Width">Sets the width (in px) of the cross-bar at both ends of the error bars.</param>
6773
static member style
6874
(
75+
[<Optional;DefaultParameterValue(null)>] ?Visible: bool,
76+
[<Optional;DefaultParameterValue(null)>] ?Type: StyleParam.ErrorType,
6977
[<Optional;DefaultParameterValue(null)>] ?Symmetric: bool,
7078
[<Optional;DefaultParameterValue(null)>] ?Array: seq<#IConvertible>,
7179
[<Optional;DefaultParameterValue(null)>] ?Arrayminus: seq<#IConvertible>,
@@ -80,17 +88,19 @@ type Error () =
8088

8189
) =
8290
(fun (error:Error) ->
83-
Symmetric |> DynObj.setValueOpt error "symmetric"
84-
Array |> DynObj.setValueOpt error "array"
85-
Arrayminus |> DynObj.setValueOpt error "arrayminus"
86-
Value |> DynObj.setValueOpt error "value"
87-
Valueminus |> DynObj.setValueOpt error "valueminus"
88-
Traceref |> DynObj.setValueOpt error "traceref"
89-
Tracerefminus |> DynObj.setValueOpt error "tracerefminus"
90-
Copy_ystyle |> DynObj.setValueOpt error "copy_ystyle"
91-
Color |> DynObj.setValueOpt error "color"
92-
Thickness |> DynObj.setValueOpt error "thickness"
93-
Width |> DynObj.setValueOpt error "width"
91+
Visible |> DynObj.setValueOpt error "visible"
92+
Type |> DynObj.setValueOptBy error "type" StyleParam.ErrorType.convert
93+
Symmetric |> DynObj.setValueOpt error "symmetric"
94+
Array |> DynObj.setValueOpt error "array"
95+
Arrayminus |> DynObj.setValueOpt error "arrayminus"
96+
Value |> DynObj.setValueOpt error "value"
97+
Valueminus |> DynObj.setValueOpt error "valueminus"
98+
Traceref |> DynObj.setValueOpt error "traceref"
99+
Tracerefminus |> DynObj.setValueOpt error "tracerefminus"
100+
Copy_ystyle |> DynObj.setValueOpt error "copy_ystyle"
101+
Color |> DynObj.setValueOpt error "color"
102+
Thickness |> DynObj.setValueOpt error "thickness"
103+
Width |> DynObj.setValueOpt error "width"
94104

95105
// out ->
96106
error

0 commit comments

Comments
 (0)