Skip to content

Commit 31e74b8

Browse files
committed
Fix tests and some xml docs
1 parent 58124c6 commit 31e74b8

File tree

3 files changed

+56
-26
lines changed

3 files changed

+56
-26
lines changed

src/Plotly.NET/ChartAPI/Chart2D.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,8 +3160,8 @@ module Chart2D =
31603160
/// <param name="MarkerColor">Sets the color of the histogram's bars.</param>
31613161
/// <param name="Marker">Sets the marker for the histogram's bars (use this for more finegrained control than the other marker-associated arguments).</param>
31623162
/// <param name="Line">Sets the outline of the histogram's bars.</param>
3163-
/// <param name="ErrorX">Sets the x error of this trace.</param>
3164-
/// <param name="ErrorY">Sets the y error of this trace.</param>
3163+
/// <param name="XError">Sets the x error of this trace.</param>
3164+
/// <param name="YError">Sets the y error of this trace.</param>
31653165
/// <param name="Cumulative">Sets wether and how the cumulative distribution is displayed</param>
31663166
/// <param name="HoverLabel">Sets the style of the hoverlabels of this trace.</param>
31673167
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>

src/Plotly.NET/Traces/Trace.fs

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Trace(traceTypeName: string) =
2525
///
2626
/// If there is no marker set, returns an empty marker object.
2727
/// </summary>
28-
/// <param name="marker">The new marker object</param>
28+
/// <param name="trace">The trace to get the marker from</param>
2929
static member getMarker(trace: #Trace) =
3030
trace |> Trace.tryGetTypedMember<Marker> "marker" |> Option.defaultValue (Marker.init ())
3131

@@ -43,7 +43,7 @@ type Trace(traceTypeName: string) =
4343
///
4444
/// If there is no line set, returns an empty line object.
4545
/// </summary>
46-
/// <param name="marker">The new line object</param>
46+
/// <param name="trace">The trace to get the line from</param>
4747
static member getLine(trace: #Trace) =
4848
trace |> Trace.tryGetTypedMember<Line> "line" |> Option.defaultValue (Line.init ())
4949

@@ -59,7 +59,7 @@ type Trace(traceTypeName: string) =
5959
/// <summary>
6060
/// Returns a function that sets the Error object for the x dimension of the given trace.
6161
/// </summary>
62-
/// <param name="error">The new error object</param>
62+
/// <param name="trace">The trace to get the x error from</param>
6363
static member GetXError(trace: #Trace) =
6464
trace |> Trace.tryGetTypedMember<Error> "error_x" |> Option.defaultValue (Error.init ())
6565

@@ -75,7 +75,7 @@ type Trace(traceTypeName: string) =
7575
/// <summary>
7676
/// Returns a function that sets the Error object for the y dimension of the given trace.
7777
/// </summary>
78-
/// <param name="error">The new error object</param>
78+
/// <param name="trace">The trace to get the y error from</param>
7979
static member GetYError(trace: #Trace) =
8080
trace |> Trace.tryGetTypedMember<Error> "error_y" |> Option.defaultValue (Error.init ())
8181

@@ -91,7 +91,7 @@ type Trace(traceTypeName: string) =
9191
/// <summary>
9292
/// Returns a function that sets the Error object for the z dimension of the given trace.
9393
/// </summary>
94-
/// <param name="error">The new error object</param>
94+
/// <param name="trace">The trace to get the z error from</param>
9595
static member GetZError(trace: #Trace) =
9696
trace |> Trace.tryGetTypedMember<Error> "error_z" |> Option.defaultValue (Error.init ())
9797

@@ -480,8 +480,13 @@ type TraceStyle() =
480480

481481
trace |> Trace.SetZError(xerror))
482482

483-
/// Sets selection of data points on a Trace object.
484-
static member SetSelection
483+
/// <summary>
484+
///
485+
/// </summary>
486+
/// <param name="Selectedpoints"></param>
487+
/// <param name="Selected"></param>
488+
/// <param name="UnSelected"></param>
489+
static member Selection
485490
(
486491
[<Optional; DefaultParameterValue(null)>] ?Selectedpoints,
487492
[<Optional; DefaultParameterValue(null)>] ?Selected,
@@ -495,24 +500,49 @@ type TraceStyle() =
495500

496501
trace)
497502

498-
499-
/// Sets the given text label styles on a Trace object.
503+
/// <summary>
504+
///
505+
/// </summary>
506+
/// <param name="Text">Sets text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels.</param>
507+
/// <param name="MultiText">Sets text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels.</param>
508+
/// <param name="TextPosition">Sets the positions of the `text` elements with respects to the (x,y) coordinates.</param>
509+
/// <param name="MultiTextPosition">Sets the positions of the `text` elements with respects to the (x,y) coordinates.</param>
510+
/// <param name="TextTemplate">Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.</param>
511+
/// <param name="MultiTextTemplate">Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.</param>
512+
/// <param name="HoverText">Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. To be seen, trace `hoverinfo` must contain a "text" flag.</param>
513+
/// <param name="MultiHoverText">Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. To be seen, trace `hoverinfo` must contain a "text" flag.</param>
514+
/// <param name="HoverInfo">Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.</param>
515+
/// <param name="HoverTemplate">Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `&lt;extra&gt;` is displayed in the secondary box, for example "&lt;extra&gt;{fullData.name}&lt;/extra&gt;". To hide the secondary box completely, use an empty tag `&lt;extra&gt;&lt;/extra&gt;`.</param>
516+
/// <param name="MultiHoverTemplate">Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `&lt;extra&gt;` is displayed in the secondary box, for example "&lt;extra&gt;{fullData.name}&lt;/extra&gt;". To hide the secondary box completely, use an empty tag `&lt;extra&gt;&lt;/extra&gt;`.</param>
517+
/// <param name="TextFont">Sets the text font of this trace.</param>
500518
static member TextLabel
501519
(
502-
[<Optional; DefaultParameterValue(null)>] ?Text: seq<#IConvertible>,
503-
[<Optional; DefaultParameterValue(null)>] ?Textposition: StyleParam.TextPosition,
504-
[<Optional; DefaultParameterValue(null)>] ?Textfont: Font,
505-
[<Optional; DefaultParameterValue(null)>] ?Textsrc: string,
506-
[<Optional; DefaultParameterValue(null)>] ?Textpositionsrc: string
520+
[<Optional; DefaultParameterValue(null)>] ?Text: #IConvertible,
521+
[<Optional; DefaultParameterValue(null)>] ?MultiText: seq<#IConvertible>,
522+
[<Optional; DefaultParameterValue(null)>] ?TextPosition: StyleParam.TextPosition,
523+
[<Optional; DefaultParameterValue(null)>] ?MultiTextPosition: seq<StyleParam.TextPosition>,
524+
[<Optional; DefaultParameterValue(null)>] ?TextTemplate: string,
525+
[<Optional; DefaultParameterValue(null)>] ?MultiTextTemplate: seq<string>,
526+
[<Optional; DefaultParameterValue(null)>] ?HoverText: string,
527+
[<Optional; DefaultParameterValue(null)>] ?MultiHoverText: seq<string>,
528+
[<Optional; DefaultParameterValue(null)>] ?HoverInfo: StyleParam.HoverInfo,
529+
[<Optional; DefaultParameterValue(null)>] ?HoverTemplate: string,
530+
[<Optional; DefaultParameterValue(null)>] ?MultiHoverTemplate: seq<string>,
531+
[<Optional; DefaultParameterValue(null)>] ?TextFont: Font
507532
) =
508533
(fun (trace: ('T :> Trace)) ->
509-
Text |> DynObj.setValueOpt trace "text"
510-
Textposition |> DynObj.setValueOptBy trace "textposition" StyleParam.TextPosition.toString
511-
Textsrc |> DynObj.setValueOpt trace "textsrc"
512-
Textpositionsrc |> DynObj.setValueOpt trace "textpositionsrc"
513-
Textfont |> DynObj.setValueOpt trace "textfont"
534+
(Text, MultiText) |> DynObj.setSingleOrMultiOpt trace "text"
535+
536+
(TextPosition, MultiTextPosition)
537+
|> DynObj.setSingleOrMultiOptBy trace "textposition" StyleParam.TextPosition.convert
538+
539+
(TextTemplate, MultiTextTemplate) |> DynObj.setSingleOrMultiOpt trace "texttemplate"
540+
(HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt trace "hovertext"
541+
HoverInfo |> DynObj.setValueOptBy trace "hoverinfo" StyleParam.HoverInfo.convert
542+
(HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt trace "hovertemplate"
543+
544+
TextFont |> DynObj.setValueOpt trace "textfont"
514545

515-
// out ->
516546
trace)
517547

518548
/// Sets the given color axis anchor on a Trace object. (determines which colorscale it uses)

tests/Plotly.NET.Tests/Traces/TraceStaticMembers.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ let ``TraceStyle tests`` =
4545
"TraceStyle.GetLine did not return the correct line object"
4646
)
4747

48-
let error = Error.init(Value = 2, Symmetric = true)
48+
let error = Error.init(Value = 2., Symmetric = true)
4949
let xErrorTrace = Trace3D.initScatter3D(Trace3DStyle.Scatter3D(XError = error))
5050
let yErrorTrace = Trace3D.initScatter3D(Trace3DStyle.Scatter3D(YError = error))
5151
let zErrorTrace = Trace3D.initScatter3D(Trace3DStyle.Scatter3D(ZError = error))
5252

5353
testCase "SetXError" (fun _ ->
5454
Expect.equal
55-
(createEmpty3DTrace() |> Trace.SetXError(Error.init(Value = 2, Symmetric = true)))
55+
(createEmpty3DTrace() |> Trace.SetXError(Error.init(Value = 2., Symmetric = true)))
5656
xErrorTrace
5757
"TraceStyle.SetXError did not produce the correct trace object"
5858
)
@@ -64,7 +64,7 @@ let ``TraceStyle tests`` =
6464
)
6565
testCase "SetYError" (fun _ ->
6666
Expect.equal
67-
(createEmpty3DTrace() |> Trace.SetYError(Error.init(Value = 2, Symmetric = true)))
67+
(createEmpty3DTrace() |> Trace.SetYError(Error.init(Value = 2., Symmetric = true)))
6868
yErrorTrace
6969
"TraceStyle.SetYError did not produce the correct trace object"
7070
)
@@ -76,7 +76,7 @@ let ``TraceStyle tests`` =
7676
)
7777
testCase "SetZError" (fun _ ->
7878
Expect.equal
79-
(createEmpty3DTrace() |> Trace.SetZError(Error.init(Value = 2, Symmetric = true)))
79+
(createEmpty3DTrace() |> Trace.SetZError(Error.init(Value = 2., Symmetric = true)))
8080
zErrorTrace
8181
"TraceStyle.SetZError did not produce the correct trace object"
8282
)

0 commit comments

Comments
 (0)