Skip to content

Commit c5f6fbb

Browse files
authored
Merge pull request #193 from plotly/multi-values
2 parents ac9664e + 916b125 commit c5f6fbb

File tree

24 files changed

+1363
-520
lines changed

24 files changed

+1363
-520
lines changed

Diff for: docs/02_0_line-scatter-plots.fsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ let line1 =
5252
x,y,
5353
Name="line",
5454
ShowMarkers=true,
55-
MarkerSymbol=StyleParam.Symbol.Square)
55+
MarkerSymbol=StyleParam.MarkerSymbol.Square)
5656
|> Chart.withLineStyle(Width=2.,Dash=StyleParam.DrawingStyle.Dot)
5757

5858
(*** condition: ipynb ***)

Diff for: docs/index.fsx

+60-38
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,28 @@ One of the main design points of Plotly.NET it is to provide support for multipl
219219
### Fluent interface style in C#:
220220
221221
```
222-
static void Main(string[] args)
222+
using System;
223+
using Plotly.NET;
224+
using Microsoft.FSharp.Core; // use this for less verbose and more helpful intellisense
225+
226+
namespace Plotly.NET.Tests.CSharp
223227
{
224-
double[] x = new double[] { 1, 2 };
225-
double[] y = new double[] { 5, 10 };
226-
GenericChart.GenericChart chart = Chart.Point(x: x, y: y);
227-
chart
228-
.WithTraceName("Hello from C#", true)
229-
.withXAxisStyle(title: "xAxis", Showgrid: false, Showline: true)
230-
.withYAxisStyle(title: "yAxis", Showgrid: false, Showline: true)
231-
.Show();
228+
class Program
229+
{
230+
static void Main(string[] args)
231+
{
232+
double[] x = new double[] { 1, 2 };
233+
double[] y = new double[] { 5, 10 };
234+
GenericChart.GenericChart chart = Chart2D.Chart.Point<double, double, string>(x: x, y: y);
235+
chart
236+
.WithTraceName("Hello from C#", true)
237+
.WithXAxisStyle(title: Title.init("xAxis"), ShowGrid: false, ShowLine: true)
238+
.WithYAxisStyle(title: Title.init("yAxis"), ShowGrid: false, ShowLine: true)
239+
.Show();
240+
}
241+
}
232242
}
243+
233244
```
234245
235246
### Declarative style in F# using the underlying `DynamicObj`:
@@ -273,36 +284,47 @@ GenericChart.ofTraceObject(trace)
273284
### Declarative style in C# using the underlying `DynamicObj`:
274285
275286
```
276-
static void Main(string[] args)
287+
using System;
288+
using Plotly.NET;
289+
using Microsoft.FSharp.Core; // use this for less verbose and more helpful intellisense
290+
using Plotly.NET.LayoutObjects;
291+
292+
namespace Plotly.NET.Tests.CSharp
277293
{
278-
double[] x = new double[] { 1, 2 };
279-
double[] y = new double[] { 5, 10 };
280-
281-
Axis.LinearAxis xAxis = new Axis.LinearAxis();
282-
xAxis.SetValue("title", "xAxis");
283-
xAxis.SetValue("showgrid", false);
284-
xAxis.SetValue("showline", true);
285-
286-
Axis.LinearAxis yAxis = new Axis.LinearAxis();
287-
yAxis.SetValue("title", "yAxis");
288-
yAxis.SetValue("showgrid", false);
289-
yAxis.SetValue("showline", true);
290-
291-
Layout layout = new Layout();
292-
layout.SetValue("xaxis", xAxis);
293-
layout.SetValue("yaxis", yAxis);
294-
layout.SetValue("showlegend", true);
295-
296-
Trace trace = new Trace("scatter");
297-
trace.SetValue("x", x);
298-
trace.SetValue("y", y);
299-
trace.SetValue("mode", "markers");
300-
trace.SetValue("name", "Hello from C#");
301-
302-
GenericChart
303-
.ofTraceObject(trace)
304-
.WithLayout(layout)
305-
.Show();
294+
class Program
295+
{
296+
static void Main(string[] args)
297+
{
298+
double[] x = new double[] { 1, 2 };
299+
double[] y = new double[] { 5, 10 };
300+
301+
LinearAxis xAxis = new LinearAxis();
302+
xAxis.SetValue("title", "xAxis");
303+
xAxis.SetValue("showgrid", false);
304+
xAxis.SetValue("showline", true);
305+
306+
LinearAxis yAxis = new LinearAxis();
307+
yAxis.SetValue("title", "yAxis");
308+
yAxis.SetValue("showgrid", false);
309+
yAxis.SetValue("showline", true);
310+
311+
Layout layout = new Layout();
312+
layout.SetValue("xaxis", xAxis);
313+
layout.SetValue("yaxis", yAxis);
314+
layout.SetValue("showlegend", true);
315+
316+
Trace trace = new Trace("scatter");
317+
trace.SetValue("x", x);
318+
trace.SetValue("y", y);
319+
trace.SetValue("mode", "markers");
320+
trace.SetValue("name", "Hello from C#");
321+
322+
GenericChart
323+
.ofTraceObject(trace)
324+
.WithLayout(layout)
325+
.Show();
326+
}
327+
}
306328
}
307329
```
308330

Diff for: src/Plotly.NET.ImageExport/Plotly.NET.ImageExport.fsproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</ItemGroup>
3838

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

Diff for: src/Plotly.NET/CSharpLayer/GenericChartExtensions.fs

+52-8
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.

Diff for: src/Plotly.NET/ChartAPI/Chart.fs

+69-11
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)