Skip to content

Commit bda17d2

Browse files
committed
Fix traceselection inner objects, plotlyjs v2.13: Add unselected.line.color and unselected.line.opacity options to parcoords trace (plotly/plotly.js#6216)
1 parent 87e2cdd commit bda17d2

File tree

2 files changed

+136
-35
lines changed

2 files changed

+136
-35
lines changed

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

+133-35
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,117 @@ open DynamicObj
66
open System
77
open System.Runtime.InteropServices
88

9+
/// <summary>Controls the style of selected markers in supported traces</summary>
10+
type MarkerSelectionStyle() =
11+
inherit DynamicObj()
12+
13+
/// <summary>
14+
/// Returns a new MarkerSelectionStyle object with the given styles
15+
/// </summary>
16+
/// <param name="Opacity">Sets the opacity of the selected/unselected markers</param>
17+
/// <param name="Color">Sets the color of the selected/unselected markers</param>
18+
/// <param name="Size">Sets the size of the selected/unselected markers</param>
19+
static member init
20+
(
21+
[<Optional; DefaultParameterValue(null)>] ?Opacity: float,
22+
[<Optional; DefaultParameterValue(null)>] ?Color: Color,
23+
[<Optional; DefaultParameterValue(null)>] ?Size: int
24+
) =
25+
MarkerSelectionStyle()
26+
|> MarkerSelectionStyle.style(
27+
?Opacity = Opacity,
28+
?Color = Color,
29+
?Size = Size
30+
)
31+
32+
/// <summary>
33+
/// Returns a function that applies the given styles to a MarkerSelectionStyle object
34+
/// </summary>
35+
/// <param name="Opacity">Sets the opacity of the selected/unselected markers</param>
36+
/// <param name="Color">Sets the color of the selected/unselected markers</param>
37+
/// <param name="Size">Sets the size of the selected/unselected markers</param>
38+
static member style
39+
(
40+
[<Optional; DefaultParameterValue(null)>] ?Opacity: float,
41+
[<Optional; DefaultParameterValue(null)>] ?Color: Color,
42+
[<Optional; DefaultParameterValue(null)>] ?Size: int
43+
) =
44+
(fun (markerSelectionStyle: MarkerSelectionStyle) ->
45+
46+
Opacity |> DynObj.setValueOpt markerSelectionStyle "opacity"
47+
Color |> DynObj.setValueOpt markerSelectionStyle "color"
48+
Size |> DynObj.setValueOpt markerSelectionStyle "size"
49+
50+
markerSelectionStyle)
51+
52+
/// <summary>Controls the style of selected lines in supported traces</summary>
53+
type LineSelectionStyle() =
54+
inherit DynamicObj()
55+
56+
/// <summary>
57+
/// Returns a new LineSelectionStyle object with the given styles
58+
/// </summary>
59+
/// <param name="Opacity">Sets the opacity of the selected/unselected lines</param>
60+
/// <param name="Color">Sets the color of the selected/unselected lines</param>
61+
static member init
62+
(
63+
[<Optional; DefaultParameterValue(null)>] ?Opacity: float,
64+
[<Optional; DefaultParameterValue(null)>] ?Color: Color
65+
) =
66+
LineSelectionStyle()
67+
|> LineSelectionStyle.style(
68+
?Opacity = Opacity,
69+
?Color = Color
70+
)
71+
72+
/// <summary>
73+
/// Returns a function that applies the given styles to a LineSelectionStyle object
74+
/// </summary>
75+
/// <param name="Opacity">Sets the opacity of the selected/unselected lines</param>
76+
/// <param name="Color">Sets the color of the selected/unselected lines</param>
77+
static member style
78+
(
79+
[<Optional; DefaultParameterValue(null)>] ?Opacity: float,
80+
[<Optional; DefaultParameterValue(null)>] ?Color: Color
81+
) =
82+
(fun (lineSelectionStyle: LineSelectionStyle) ->
83+
84+
Opacity |> DynObj.setValueOpt lineSelectionStyle "opacity"
85+
Color |> DynObj.setValueOpt lineSelectionStyle "color"
86+
87+
lineSelectionStyle)
88+
89+
/// <summary>Controls the style of selected text in supported traces</summary>
90+
type FontSelectionStyle() =
91+
inherit DynamicObj()
92+
93+
/// <summary>
94+
/// Returns a new FontSelectionStyle object with the given styles
95+
/// </summary>
96+
/// <param name="Color">Sets the color of the selected/unselected text</param>
97+
static member init
98+
(
99+
[<Optional; DefaultParameterValue(null)>] ?Color: Color
100+
) =
101+
FontSelectionStyle()
102+
|> FontSelectionStyle.style(
103+
?Color = Color
104+
)
105+
106+
/// <summary>
107+
/// Returns a function that applies the given styles to a FontSelectionStyle object
108+
/// </summary>
109+
/// <param name="Color">Sets the color of the selected/unselected text</param>
110+
static member style
111+
(
112+
[<Optional; DefaultParameterValue(null)>] ?Color: Color
113+
) =
114+
(fun (fontSelectionStyle: FontSelectionStyle) ->
115+
116+
Color |> DynObj.setValueOpt fontSelectionStyle "color"
117+
118+
fontSelectionStyle)
119+
9120
/// <summary>
10121
/// Used to control selected/unselected trace item styles in supported traces.
11122
/// </summary>
@@ -15,51 +126,38 @@ type TraceSelection() =
15126
/// <summary>
16127
/// Returns a new TraceSelection object with the given styles
17128
/// </summary>
18-
/// <param name="MarkerOpacity">Sets the opacity of the selected/unselected trace items</param>
19-
/// <param name="MarkerColor">Sets the color of the selected/unselected trace items</param>
20-
/// <param name="MarkerSize">Sets the size of the selected/unselected trace items</param>
21-
/// <param name="FontColor">Sets the opfont of the selected/unselected trace items</param>
129+
/// <param name="MarkerSelectionStyle">Sets the styles of the selected/unselected markers</param>
130+
/// <param name="LineSelectionStyle">Sets the styles of the selected/unselected lines</param>
131+
/// <param name="FontSelectionStyle">Sets the styles of the selected/unselected texts</param>
22132
static member init
23133
(
24-
[<Optional; DefaultParameterValue(null)>] ?MarkerOpacity: float,
25-
[<Optional; DefaultParameterValue(null)>] ?MarkerColor: Color,
26-
[<Optional; DefaultParameterValue(null)>] ?MarkerSize: int,
27-
[<Optional; DefaultParameterValue(null)>] ?FontColor: Color
134+
[<Optional; DefaultParameterValue(null)>] ?MarkerSelectionStyle: MarkerSelectionStyle,
135+
[<Optional; DefaultParameterValue(null)>] ?LineSelectionStyle: LineSelectionStyle,
136+
[<Optional; DefaultParameterValue(null)>] ?FontSelectionStyle: FontSelectionStyle
28137
) =
29-
TraceSelection()
30-
|> TraceSelection.style(
31-
?MarkerOpacity = MarkerOpacity,
32-
?MarkerColor = MarkerColor,
33-
?MarkerSize = MarkerSize,
34-
?FontColor = FontColor
35-
)
138+
TraceSelection()
139+
|> TraceSelection.style(
140+
?MarkerSelectionStyle = MarkerSelectionStyle,
141+
?LineSelectionStyle = LineSelectionStyle,
142+
?FontSelectionStyle = FontSelectionStyle
143+
)
36144

37145
/// <summary>
38146
/// Returns a function that applies the given styles to a TraceSelection object
39147
/// </summary>
40-
/// <param name="MarkerOpacity">Sets the opacity of the selected/unselected trace items</param>
41-
/// <param name="MarkerColor">Sets the color of the selected/unselected trace items</param>
42-
/// <param name="MarkerSize">Sets the size of the selected/unselected trace items</param>
43-
/// <param name="FontColor">Sets the opfont of the selected/unselected trace items</param>
148+
/// <param name="MarkerSelectionStyle">Sets the styles of the selected/unselected markers</param>
149+
/// <param name="LineSelectionStyle">Sets the styles of the selected/unselected lines</param>
150+
/// <param name="FontSelectionStyle">Sets the styles of the selected/unselected texts</param>
44151
static member style
45152
(
46-
[<Optional; DefaultParameterValue(null)>] ?MarkerOpacity: float,
47-
[<Optional; DefaultParameterValue(null)>] ?MarkerColor: Color,
48-
[<Optional; DefaultParameterValue(null)>] ?MarkerSize: int,
49-
[<Optional; DefaultParameterValue(null)>] ?FontColor: Color
50-
) =
153+
[<Optional; DefaultParameterValue(null)>] ?MarkerSelectionStyle: MarkerSelectionStyle,
154+
[<Optional; DefaultParameterValue(null)>] ?LineSelectionStyle: LineSelectionStyle,
155+
[<Optional; DefaultParameterValue(null)>] ?FontSelectionStyle: FontSelectionStyle
156+
) =
51157
(fun (traceSelection: TraceSelection) ->
52158

53-
let markerSelectionStyle =
54-
Marker.init(
55-
?Opacity = MarkerOpacity,
56-
?Color = MarkerColor,
57-
?Size = MarkerSize
58-
)
59-
60-
let fontSelectionStyle = Font.init(?Color = FontColor)
61-
62-
markerSelectionStyle |> DynObj.setValue traceSelection "marker"
63-
fontSelectionStyle |> DynObj.setValue traceSelection "textfont"
159+
MarkerSelectionStyle |> DynObj.setValueOpt traceSelection "marker"
160+
LineSelectionStyle |> DynObj.setValueOpt traceSelection "line"
161+
FontSelectionStyle |> DynObj.setValueOpt traceSelection "font"
64162

65163
traceSelection)

src/Plotly.NET/Traces/TraceDomain.fs

+3
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ type TraceDomainStyle() =
579579
/// <param name="CustomData">Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, "scatter" traces also appends customdata items in the markers DOM elements</param>
580580
/// <param name="Domain">Sets the domain of this trace.</param>
581581
/// <param name="Line">Sets the line of this trace.</param>
582+
/// <param name="Line">Sets the styles of unselected lines in this trace.</param>
582583
/// <param name="LabelAngle">Sets the angle of the labels with respect to the horizontal. For example, a `tickangle` of -90 draws the labels vertically. Tilted labels with "labelangle" may be positioned better inside margins when `labelposition` is set to "bottom".</param>
583584
/// <param name="LabelFont">Sets the label font of this trace.</param>
584585
/// <param name="LabelSide">Specifies the location of the `label`. "top" positions labels above, next to the title "bottom" positions labels below the graph Tilted labels with "labelangle" may be positioned better inside margins when `labelposition` is set to "bottom".</param>
@@ -598,6 +599,7 @@ type TraceDomainStyle() =
598599
[<Optional; DefaultParameterValue(null)>] ?CustomData: seq<#IConvertible>,
599600
[<Optional; DefaultParameterValue(null)>] ?Domain: Domain,
600601
[<Optional; DefaultParameterValue(null)>] ?Line: Line,
602+
[<Optional; DefaultParameterValue(null)>] ?Unselected: TraceSelection,
601603
[<Optional; DefaultParameterValue(null)>] ?LabelAngle: int,
602604
[<Optional; DefaultParameterValue(null)>] ?LabelFont: Font,
603605
[<Optional; DefaultParameterValue(null)>] ?LabelSide: StyleParam.Side,
@@ -618,6 +620,7 @@ type TraceDomainStyle() =
618620
CustomData |> DynObj.setValueOpt trace "customdata"
619621
Domain |> DynObj.setValueOpt trace "domain"
620622
Line |> DynObj.setValueOpt trace "line"
623+
Unselected |> DynObj.setValueOpt trace "unselected"
621624
LabelAngle |> DynObj.setValueOpt trace "labelangle"
622625
LabelFont |> DynObj.setValueOpt trace "labelfont"
623626
LabelSide |> DynObj.setValueOpt trace "labelside"

0 commit comments

Comments
 (0)