Skip to content

Commit 8865d4d

Browse files
committed
Add ScatterTernary C# binding
1 parent f84c2b1 commit 8865d4d

File tree

3 files changed

+100
-3
lines changed

3 files changed

+100
-3
lines changed

src/Plotly.NET.CSharp/ChartAPI/ChartMap.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Plotly.NET.CSharp
1111
{
12-
public static partial class ChartMap
12+
public static partial class Chart
1313
{
1414
/// <summary>
1515
/// Creates a ScatterGeo chart, where data is visualized using plotly's base geo map.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Plotly.NET.LayoutObjects;
7+
using Plotly.NET.TraceObjects;
8+
9+
namespace Plotly.NET.CSharp
10+
{
11+
public static partial class Chart
12+
{
13+
public static GenericChart.GenericChart Scatterternary<AType, BType, CType, SumType, TextType>(
14+
IEnumerable<AType>? A = null,
15+
IEnumerable<BType>? B = null,
16+
IEnumerable<CType>? C = null,
17+
SumType? Sum = null,
18+
StyleParam.Mode? Mode = null,
19+
string? Name = null,
20+
bool? ShowLegend = null,
21+
double? Opacity = null,
22+
IEnumerable<double>? MultiOpacity = null,
23+
TextType? Text = null,
24+
IEnumerable<TextType>? MultiText = null,
25+
StyleParam.TextPosition? TextPosition = null,
26+
IEnumerable<StyleParam.TextPosition>? MultiTextPosition = null,
27+
Color? MarkerColor = null,
28+
StyleParam.Colorscale? MarkerColorScale = null,
29+
Line? MarkerOutline = null,
30+
StyleParam.MarkerSymbol? MarkerSymbol = null,
31+
IEnumerable<StyleParam.MarkerSymbol>? MultiMarkerSymbol = null,
32+
Marker? Marker = null,
33+
Color? LineColor = null,
34+
StyleParam.Colorscale? LineColorScale = null,
35+
double? LineWidth = null,
36+
StyleParam.DrawingStyle? LineDash = null,
37+
Line? Line = null,
38+
bool? UseDefaults = null
39+
)
40+
where AType : IConvertible
41+
where BType : IConvertible
42+
where CType : IConvertible
43+
where SumType : class, IConvertible
44+
where TextType : class, IConvertible
45+
=>
46+
Plotly.NET.ChartTernary.Chart.ScatterTernary<AType, BType, CType, SumType, TextType>(
47+
A: A.ToOption(),
48+
B: B.ToOption(),
49+
C: C.ToOption(),
50+
Sum: Sum.ToOption(),
51+
Mode: Mode.ToOption(),
52+
Name: Name.ToOption(),
53+
ShowLegend: ShowLegend.ToOptionV(),
54+
Opacity: Opacity.ToOptionV(),
55+
MultiOpacity: MultiOpacity.ToOption(),
56+
Text: Text.ToOption(),
57+
MultiText: MultiText.ToOption(),
58+
TextPosition: TextPosition.ToOption(),
59+
MultiTextPosition: MultiTextPosition.ToOption(),
60+
MarkerColor: MarkerColor.ToOption(),
61+
MarkerColorScale: MarkerColorScale.ToOption(),
62+
MarkerOutline: MarkerOutline.ToOption(),
63+
MarkerSymbol: MarkerSymbol.ToOption(),
64+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
65+
Marker: Marker.ToOption(),
66+
LineColor: LineColor.ToOption(),
67+
LineColorScale: LineColorScale.ToOption(),
68+
LineWidth: LineWidth.ToOptionV(),
69+
LineDash: LineDash.ToOption(),
70+
Line: Line.ToOption(),
71+
UseDefaults: UseDefaults.ToOptionV()
72+
);
73+
}
74+
}

tests/Plotly.NET.Tests.CSharpConsole/Program.cs

+25-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Program
1010
static void Main(string[] args)
1111
{
1212
Chart.Grid(
13-
nRows: 2,
13+
nRows: 5,
1414
nCols: 3,
1515
gCharts:
1616
new GenericChart []
@@ -33,7 +33,30 @@ static void Main(string[] args)
3333
y: new int [] { 13, 14 },
3434
z: new int [] { 14, 15 },
3535
mode: Mode.Markers
36-
)
36+
),
37+
Chart.Invisible(),
38+
Chart.Invisible(),
39+
Chart.ScatterPolar<int,int,string>(
40+
theta: new int [] { 1, 2 },
41+
r: new int [] { 3, 4 },
42+
mode: Mode.Markers
43+
),
44+
Chart.Invisible(),
45+
Chart.Invisible(),
46+
Chart.ScatterGeo<int,int,string>(
47+
longitudes: new int [] { 1, 2 },
48+
latitudes: new int [] { 3, 4 },
49+
mode: Mode.Markers
50+
),
51+
Chart.Invisible(),
52+
Chart.Invisible(),
53+
Chart.Scatterternary<int,int,int,IConvertible,string>(
54+
A: new int [] { 1, 2 },
55+
B: new int [] { 3, 4 },
56+
C: new int [] { 5, 6 }
57+
),
58+
Chart.Invisible(),
59+
Chart.Invisible(),
3760
}
3861
).Show();
3962
}

0 commit comments

Comments
 (0)