Skip to content

Commit cfea76e

Browse files
committed
Add Chart.ScatterSmith C# binding
1 parent 104ce55 commit cfea76e

File tree

4 files changed

+140
-3
lines changed

4 files changed

+140
-3
lines changed

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

+30
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ namespace Plotly.NET.CSharp
77
{
88
public static partial class Chart
99
{
10+
/// <summary>
11+
/// Creates a pie chart.
12+
///
13+
/// A pie chart (or a circle chart) is a circular statistical graphic, which is divided into slices to illustrate numerical proportion.
14+
/// In a pie chart, the arc length of each slice (and consequently its central angle and area), is proportional to the quantity it represents.
15+
/// </summary>
16+
/// <param name="values">Sets the values of the sectors</param>
17+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
18+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
19+
/// <param name="Opacity">Sets the opactity of the trace</param>
20+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
21+
/// <param name="Labels">Sets the sector labels. If `labels` entries are duplicated, the associated `values` are summed.</param>
22+
/// <param name="Pull">Sets the fraction of larger radius to pull the sectors out from the center. This can be a constant to pull all slices apart from each other equally or an array to highlight one or more slices.</param>
23+
/// <param name="MultiPull">Sets the fraction of larger radius to pull the sectors out from the center. This can be a constant to pull all slices apart from each other equally or an array to highlight one or more slices.</param>
24+
/// <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>
25+
/// <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>
26+
/// <param name="TextPosition">Sets the positions of the `text` elements with respects to the (x,y) coordinates.</param>
27+
/// <param name="MultiTextPosition">Sets the positions of the `text` elements with respects to the (x,y) coordinates.</param>
28+
/// <param name="SectionColors">Sets the colors associated with each section.</param>
29+
/// <param name="SectionOutlineColor">Sets the color of the section outline.</param>
30+
/// <param name="SectionOutlineWidth">Sets the width of the section outline.</param>
31+
/// <param name="SectionOutlineMultiWidth">Sets the width of each individual section outline.</param>
32+
/// <param name="SectionOutline">Sets the section outline (use this for more finegrained control than the other section outline-associated arguments).</param>
33+
/// <param name="Marker">Sets the marker of this trace.</param>
34+
/// <param name="TextInfo">Determines which trace information appear on the graph.</param>
35+
/// <param name="Direction">Specifies the direction at which succeeding sectors follow one another.</param>
36+
/// <param name="Hole">Sets the fraction of the radius to cut out of the pie. Use this to make a donut chart.</param>
37+
/// <param name="Rotation">Instead of the first slice starting at 12 o'clock, rotate to some other angle.</param>
38+
/// <param name="Sort">Determines whether or not the sectors are reordered from largest to smallest.</param>
39+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
1040
public static GenericChart.GenericChart Pie<ValuesType, LabelsType, TextType>(
1141
IEnumerable<ValuesType> values,
1242
string? Name = null,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
using Plotly.NET;
2+
using Plotly.NET.LayoutObjects;
3+
using Plotly.NET.TraceObjects;
4+
5+
namespace Plotly.NET.CSharp
6+
{
7+
public static partial class Chart
8+
{
9+
/// <summary>
10+
/// Creates a Scatter plot on a smith coordinate system.
11+
///
12+
/// In general, ScatterSmith charts plot complex numbers on a transformed two-dimensional Cartesian complex plane. Complex numbers with positive real parts map inside the circle. Those with negative real parts map outside the circle.
13+
///
14+
/// ScatterSmith charts are the basis of PointSmith, LineSmith, and BubbleSmith Charts, and can be customized as such. We also provide abstractions for those: Chart.LineSmith, Chart.PointSmith, Chart.BubbleSmith
15+
/// </summary>
16+
/// <param name="real">Sets the real component of the data, in units of normalized impedance such that real=1, imag=0 is the center of the chart.</param>
17+
/// <param name="imag">Sets the imaginary component of the data, in units of normalized impedance such that real=1, imag=0 is the center of the chart.</param>
18+
/// <param name="mode">Determines the drawing mode for this scatter trace.</param>
19+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
20+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
21+
/// <param name="Opacity">Sets the opactity of the trace</param>
22+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
23+
/// <param name="Text">Sets a text associated with each datum</param>
24+
/// <param name="MultiText">Sets individual text for each datum</param>
25+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
26+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
27+
/// <param name="MarkerColor">Sets the color of the marker</param>
28+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
29+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
30+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
31+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
32+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
33+
/// <param name="LineColor">Sets the color of the line</param>
34+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
35+
/// <param name="LineWidth">Sets the width of the line</param>
36+
/// <param name="LineDash">sets the drawing style of the line</param>
37+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
38+
/// <param name="Fill">Sets the area to fill with a solid color. Defaults to "none" unless this trace is stacked, then it gets "tonexty" ("tonextx") if `orientation` is "v" ("h") Use with `FillColor` if not "none". "tozerox" and "tozeroy" fill to x=0 and y=0 respectively. "tonextx" and "tonexty" fill between the endpoints of this trace and the endpoints of the trace before it, connecting those endpoints with straight lines (to make a stacked area graph); if there is no trace before it, they behave like "tozerox" and "tozeroy". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. "tonext" fills the space between two traces if one completely encloses the other (eg consecutive contour lines), and behaves like "toself" if there is no trace before it. "tonext" should not be used if one trace does not enclose the other. Traces in a `stackgroup` will only fill to (or be filled to) other traces in the same group. With multiple `stackgroup`s or some traces stacked and some not, if fill-linked traces are not already consecutive, the later ones will be pushed down in the drawing order.</param>
39+
/// <param name="FillColor">ets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.</param>
40+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
41+
public static GenericChart.GenericChart ScatterSmith<RealType, ImagType, TextType>(
42+
IEnumerable<RealType> real,
43+
IEnumerable<ImagType> imag,
44+
StyleParam.Mode mode,
45+
string? Name = null,
46+
bool? ShowLegend = null,
47+
double? Opacity = null,
48+
IEnumerable<double>? MultiOpacity = null,
49+
TextType? Text = null,
50+
IEnumerable<TextType>? MultiText = null,
51+
StyleParam.TextPosition? TextPosition = null,
52+
IEnumerable<StyleParam.TextPosition>? MultiTextPosition = null,
53+
Color? MarkerColor = null,
54+
StyleParam.Colorscale? MarkerColorScale = null,
55+
Line? MarkerOutline = null,
56+
StyleParam.MarkerSymbol? MarkerSymbol = null,
57+
IEnumerable<StyleParam.MarkerSymbol>? MultiMarkerSymbol = null,
58+
Marker? Marker = null,
59+
Color? LineColor = null,
60+
StyleParam.Colorscale? LineColorScale = null,
61+
double? LineWidth = null,
62+
StyleParam.DrawingStyle? LineDash = null,
63+
Line? Line = null,
64+
StyleParam.Fill? Fill = null,
65+
Color? FillColor = null,
66+
bool? UseDefaults = true
67+
)
68+
where RealType : IConvertible
69+
where ImagType : IConvertible
70+
where TextType : class, IConvertible
71+
=>
72+
Plotly.NET.ChartSmith.Chart.ScatterSmith<RealType, ImagType, TextType>(
73+
real: real,
74+
imag: imag,
75+
mode: mode,
76+
Name: Name.ToOption(),
77+
ShowLegend: ShowLegend.ToOptionV(),
78+
Opacity: Opacity.ToOptionV(),
79+
MultiOpacity: MultiOpacity.ToOption(),
80+
Text: Text.ToOption(),
81+
MultiText: MultiText.ToOption(),
82+
TextPosition: TextPosition.ToOption(),
83+
MultiTextPosition: MultiTextPosition.ToOption(),
84+
MarkerColor: MarkerColor.ToOption(),
85+
MarkerColorScale: MarkerColorScale.ToOption(),
86+
MarkerOutline: MarkerOutline.ToOption(),
87+
MarkerSymbol: MarkerSymbol.ToOption(),
88+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
89+
Marker: Marker.ToOption(),
90+
LineColor: LineColor.ToOption(),
91+
LineColorScale: LineColorScale.ToOption(),
92+
LineWidth: LineWidth.ToOptionV(),
93+
LineDash: LineDash.ToOption(),
94+
Line: Line.ToOption(),
95+
Fill: Fill.ToOption(),
96+
FillColor: FillColor.ToOption(),
97+
UseDefaults: UseDefaults.ToOptionV()
98+
);
99+
}
100+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static partial class Chart
4242
/// <param name="LineDash">sets the drawing style of the line</param>
4343
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
4444
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
45-
public static GenericChart.GenericChart Scatterternary<AType, BType, CType, SumType, TextType>(
45+
public static GenericChart.GenericChart ScatterTernary<AType, BType, CType, SumType, TextType>(
4646
IEnumerable<AType>? A = null,
4747
IEnumerable<BType>? B = null,
4848
IEnumerable<CType>? C = null,

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

+9-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: 7,
13+
nRows: 8,
1414
nCols: 3,
1515
gCharts:
1616
new GenericChart []
@@ -50,7 +50,7 @@ static void Main(string[] args)
5050
),
5151
Chart.Invisible(),
5252
Chart.Invisible(),
53-
Chart.Scatterternary<int,int,int,IConvertible,string>(
53+
Chart.ScatterTernary<int,int,int,IConvertible,string>(
5454
A: new int [] { 1, 2 },
5555
B: new int [] { 3, 4 },
5656
C: new int [] { 5, 6 }
@@ -71,6 +71,13 @@ static void Main(string[] args)
7171
),
7272
Chart.Invisible(),
7373
Chart.Invisible(),
74+
Chart.ScatterSmith<double,double,string>(
75+
real: new double [] {1,2,3,4},
76+
imag: new double [] {1,2,3,4},
77+
mode: Mode.Markers
78+
),
79+
Chart.Invisible(),
80+
Chart.Invisible(),
7481
}
7582
)
7683
.WithSize(750,2000)

0 commit comments

Comments
 (0)