Skip to content

Commit db36958

Browse files
committed
Further rework Marker, add multi support for Bar Charts, fix Chart.withMarkerStyle overriding exisitng markers
1 parent f226e95 commit db36958

File tree

13 files changed

+515
-131
lines changed

13 files changed

+515
-131
lines changed

src/Plotly.NET/CSharpLayer/GenericChartExtensions.fs

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,61 @@ module GenericChartExtensions =
4848
[<Extension>]
4949
member this.WithMarkerStyle
5050
(
51-
[<Optional;DefaultParameterValue(null)>] ?Size,
52-
[<Optional;DefaultParameterValue(null)>] ?Color,
53-
[<Optional;DefaultParameterValue(null)>] ?Symbol,
54-
[<Optional;DefaultParameterValue(null)>] ?Opacity
51+
[<Optional;DefaultParameterValue(null)>] ?AutoColorScale : bool,
52+
[<Optional;DefaultParameterValue(null)>] ?CAuto : bool,
53+
[<Optional;DefaultParameterValue(null)>] ?CMax : float,
54+
[<Optional;DefaultParameterValue(null)>] ?CMid : float,
55+
[<Optional;DefaultParameterValue(null)>] ?CMin : float,
56+
[<Optional;DefaultParameterValue(null)>] ?Color : Color,
57+
[<Optional;DefaultParameterValue(null)>] ?Colors : seq<Color>,
58+
[<Optional;DefaultParameterValue(null)>] ?ColorAxis : StyleParam.SubPlotId,
59+
[<Optional;DefaultParameterValue(null)>] ?ColorBar : ColorBar,
60+
[<Optional;DefaultParameterValue(null)>] ?Colorscale : StyleParam.Colorscale,
61+
[<Optional;DefaultParameterValue(null)>] ?Gradient : Gradient,
62+
[<Optional;DefaultParameterValue(null)>] ?Outline : Line,
63+
[<Optional;DefaultParameterValue(null)>] ?Size : int,
64+
[<Optional;DefaultParameterValue(null)>] ?MultiSize : seq<int>,
65+
[<Optional;DefaultParameterValue(null)>] ?Opacity : float,
66+
[<Optional;DefaultParameterValue(null)>] ?MultiOpacity : seq<float>,
67+
[<Optional;DefaultParameterValue(null)>] ?Pattern : Pattern,
68+
[<Optional;DefaultParameterValue(null)>] ?Symbol : StyleParam.MarkerSymbol,
69+
[<Optional;DefaultParameterValue(null)>] ?MultiSymbols : seq<StyleParam.MarkerSymbol>,
70+
[<Optional;DefaultParameterValue(null)>] ?OutlierColor : Color,
71+
[<Optional;DefaultParameterValue(null)>] ?Maxdisplayed : int,
72+
[<Optional;DefaultParameterValue(null)>] ?ReverseScale : bool,
73+
[<Optional;DefaultParameterValue(null)>] ?ShowScale : bool,
74+
[<Optional;DefaultParameterValue(null)>] ?SizeMin : int,
75+
[<Optional;DefaultParameterValue(null)>] ?SizeMode : StyleParam.MarkerSizeMode,
76+
[<Optional;DefaultParameterValue(null)>] ?SizeRef : int
5577
) =
5678
this
5779
|> Chart.withMarkerStyle(
58-
?Size=Size,
59-
?Color=Color,
60-
?Symbol=Symbol,
61-
?Opacity=Opacity
80+
?AutoColorScale = AutoColorScale ,
81+
?CAuto = CAuto ,
82+
?CMax = CMax ,
83+
?CMid = CMid ,
84+
?CMin = CMin ,
85+
?Color = Color ,
86+
?Colors = Colors ,
87+
?ColorAxis = ColorAxis ,
88+
?ColorBar = ColorBar ,
89+
?Colorscale = Colorscale ,
90+
?Gradient = Gradient ,
91+
?Outline = Outline ,
92+
?Size = Size ,
93+
?MultiSize = MultiSize ,
94+
?Opacity = Opacity ,
95+
?MultiOpacity = MultiOpacity ,
96+
?Pattern = Pattern ,
97+
?Symbol = Symbol ,
98+
?MultiSymbols = MultiSymbols ,
99+
?OutlierColor = OutlierColor ,
100+
?Maxdisplayed = Maxdisplayed ,
101+
?ReverseScale = ReverseScale ,
102+
?ShowScale = ShowScale ,
103+
?SizeMin = SizeMin ,
104+
?SizeMode = SizeMode ,
105+
?SizeRef = SizeRef
62106
)
63107

64108
/// Apply styling to the Line(s) of the chart as Object.

src/Plotly.NET/ChartAPI/Chart.fs

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,65 @@ type Chart =
121121
[<CompiledName("WithMarkerStyle")>]
122122
static member withMarkerStyle
123123
(
124-
[<Optional;DefaultParameterValue(null)>] ?Size,
125-
[<Optional;DefaultParameterValue(null)>] ?Color,
126-
[<Optional;DefaultParameterValue(null)>] ?Symbol,
127-
[<Optional;DefaultParameterValue(null)>] ?Opacity
124+
[<Optional;DefaultParameterValue(null)>] ?AutoColorScale : bool,
125+
[<Optional;DefaultParameterValue(null)>] ?CAuto : bool,
126+
[<Optional;DefaultParameterValue(null)>] ?CMax : float,
127+
[<Optional;DefaultParameterValue(null)>] ?CMid : float,
128+
[<Optional;DefaultParameterValue(null)>] ?CMin : float,
129+
[<Optional;DefaultParameterValue(null)>] ?Color : Color,
130+
[<Optional;DefaultParameterValue(null)>] ?Colors : seq<Color>,
131+
[<Optional;DefaultParameterValue(null)>] ?ColorAxis : StyleParam.SubPlotId,
132+
[<Optional;DefaultParameterValue(null)>] ?ColorBar : ColorBar,
133+
[<Optional;DefaultParameterValue(null)>] ?Colorscale : StyleParam.Colorscale,
134+
[<Optional;DefaultParameterValue(null)>] ?Gradient : Gradient,
135+
[<Optional;DefaultParameterValue(null)>] ?Outline : Line,
136+
[<Optional;DefaultParameterValue(null)>] ?Size : int,
137+
[<Optional;DefaultParameterValue(null)>] ?MultiSize : seq<int>,
138+
[<Optional;DefaultParameterValue(null)>] ?Opacity : float,
139+
[<Optional;DefaultParameterValue(null)>] ?MultiOpacity : seq<float>,
140+
[<Optional;DefaultParameterValue(null)>] ?Pattern : Pattern,
141+
[<Optional;DefaultParameterValue(null)>] ?Symbol : StyleParam.MarkerSymbol,
142+
[<Optional;DefaultParameterValue(null)>] ?MultiSymbols : seq<StyleParam.MarkerSymbol>,
143+
[<Optional;DefaultParameterValue(null)>] ?OutlierColor : Color,
144+
[<Optional;DefaultParameterValue(null)>] ?Maxdisplayed : int,
145+
[<Optional;DefaultParameterValue(null)>] ?ReverseScale : bool,
146+
[<Optional;DefaultParameterValue(null)>] ?ShowScale : bool,
147+
[<Optional;DefaultParameterValue(null)>] ?SizeMin : int,
148+
[<Optional;DefaultParameterValue(null)>] ?SizeMode : StyleParam.MarkerSizeMode,
149+
[<Optional;DefaultParameterValue(null)>] ?SizeRef : int
128150
) =
129-
let marker =
130-
Marker.init (
131-
?Size=Size,?Color=Color,?Symbol=Symbol,?Opacity=Opacity
151+
fun (ch:GenericChart) ->
152+
ch
153+
|> mapTrace (
154+
TraceStyle.Marker(
155+
?AutoColorScale = AutoColorScale,
156+
?CAuto = CAuto ,
157+
?CMax = CMax ,
158+
?CMid = CMid ,
159+
?CMin = CMin ,
160+
?Color = Color ,
161+
?Colors = Colors ,
162+
?ColorAxis = ColorAxis ,
163+
?ColorBar = ColorBar ,
164+
?Colorscale = Colorscale ,
165+
?Gradient = Gradient ,
166+
?Outline = Outline ,
167+
?Size = Size ,
168+
?MultiSize = MultiSize ,
169+
?Opacity = Opacity ,
170+
?MultiOpacity = MultiOpacity,
171+
?Pattern = Pattern,
172+
?Symbol = Symbol ,
173+
?MultiSymbols = MultiSymbols ,
174+
?OutlierColor = OutlierColor ,
175+
?Maxdisplayed = Maxdisplayed ,
176+
?ReverseScale = ReverseScale ,
177+
?ShowScale = ShowScale ,
178+
?SizeMin = SizeMin ,
179+
?SizeMode = SizeMode ,
180+
?SizeRef = SizeRef
132181
)
133-
Chart.withMarker(marker)
182+
)
134183

135184
/// Apply styling to the Line(s) of the chart as Object.
136185
[<CompiledName("WithLine")>]
@@ -148,12 +197,21 @@ type Chart =
148197
[<Optional;DefaultParameterValue(null)>] ?Shape,
149198
[<Optional;DefaultParameterValue(null)>] ?Dash,
150199
[<Optional;DefaultParameterValue(null)>] ?Smoothing,
151-
[<Optional;DefaultParameterValue(null)>] ?Colorscale
200+
[<Optional;DefaultParameterValue(null)>] ?Colorscale,
201+
[<Optional;DefaultParameterValue(null)>] ?OutlierColor,
202+
[<Optional;DefaultParameterValue(null)>] ?OutlierWidth
152203
) =
153204
let line =
154205
Line.init (
155-
?Width=Width,?Color=Color,?Shape=Shape,?Dash=Dash,?Smoothing=Smoothing,?Colorscale=Colorscale)
156-
206+
?Width = Width,
207+
?Color = Color,
208+
?Shape = Shape,
209+
?Dash = Dash,
210+
?Smoothing = Smoothing,
211+
?Colorscale = Colorscale,
212+
?OutlierColor = OutlierColor,
213+
?OutlierWidth = OutlierWidth
214+
)
157215
Chart.withLine(line)
158216

159217
/// Apply styling to the xError(s) of the chart as Object

0 commit comments

Comments
 (0)