Skip to content

Commit 8d7281c

Browse files
committed
Add C# binding for Chart.BubbleSmith
1 parent ed3cfec commit 8d7281c

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

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

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,5 +251,87 @@ public static GenericChart.GenericChart LineSmith<RealType, ImagType, TextType>(
251251
FillColor: FillColor.ToOption(),
252252
UseDefaults: UseDefaults.ToOption()
253253
);
254+
/// <summary>
255+
/// Creates a Bubble plot on a smith coordinate system. A bubble chart is a variation of the Point chart, where the data points get an additional scale by being rendered as bubbles of different sizes.
256+
///
257+
/// In general, BubbleSmith charts plot complex numbers on a transformed two-dimensional Cartesian complex plane as points of varying sizes. Complex numbers with positive real parts map inside the circle. Those with negative real parts map outside the circle.
258+
/// </summary>
259+
/// <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>
260+
/// <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>
261+
/// <param name="sizes">Sets the size of the points</param>
262+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
263+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
264+
/// <param name="Opacity">Sets the opactity of the trace</param>
265+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
266+
/// <param name="Text">Sets a text associated with each datum</param>
267+
/// <param name="MultiText">Sets individual text for each datum</param>
268+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
269+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
270+
/// <param name="MarkerColor">Sets the color of the marker</param>
271+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
272+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
273+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
274+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
275+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
276+
/// <param name="LineColor">Sets the color of the line</param>
277+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
278+
/// <param name="LineWidth">Sets the width of the line</param>
279+
/// <param name="LineDash">sets the drawing style of the line</param>
280+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
281+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
282+
public static GenericChart.GenericChart BubbleSmith<RealType, ImagType, TextType>(
283+
IEnumerable<RealType> real,
284+
IEnumerable<ImagType> imag,
285+
IEnumerable<int> sizes,
286+
Optional<string> Name = default,
287+
Optional<bool> ShowLegend = default,
288+
Optional<double> Opacity = default,
289+
Optional<IEnumerable<double>> MultiOpacity = default,
290+
Optional<TextType> Text = default,
291+
Optional<IEnumerable<TextType>> MultiText = default,
292+
Optional<StyleParam.TextPosition> TextPosition = default,
293+
Optional<IEnumerable<StyleParam.TextPosition>> MultiTextPosition = default,
294+
Optional<Color> MarkerColor = default,
295+
Optional<StyleParam.Colorscale> MarkerColorScale = default,
296+
Optional<Line> MarkerOutline = default,
297+
Optional<StyleParam.MarkerSymbol> MarkerSymbol = default,
298+
Optional<IEnumerable<StyleParam.MarkerSymbol>> MultiMarkerSymbol = default,
299+
Optional<Marker> Marker = default,
300+
Optional<Color> LineColor = default,
301+
Optional<StyleParam.Colorscale> LineColorScale = default,
302+
Optional<double> LineWidth = default,
303+
Optional<StyleParam.DrawingStyle> LineDash = default,
304+
Optional<Line> Line = default,
305+
Optional<bool> UseDefaults = default
306+
)
307+
where RealType : IConvertible
308+
where ImagType : IConvertible
309+
where TextType : IConvertible
310+
=>
311+
Plotly.NET.ChartSmith.Chart.BubbleSmith<RealType, ImagType, TextType>(
312+
real: real,
313+
imag: imag,
314+
sizes: sizes,
315+
Name: Name.ToOption(),
316+
ShowLegend: ShowLegend.ToOption(),
317+
Opacity: Opacity.ToOption(),
318+
MultiOpacity: MultiOpacity.ToOption(),
319+
Text: Text.ToOption(),
320+
MultiText: MultiText.ToOption(),
321+
TextPosition: TextPosition.ToOption(),
322+
MultiTextPosition: MultiTextPosition.ToOption(),
323+
MarkerColor: MarkerColor.ToOption(),
324+
MarkerColorScale: MarkerColorScale.ToOption(),
325+
MarkerOutline: MarkerOutline.ToOption(),
326+
MarkerSymbol: MarkerSymbol.ToOption(),
327+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
328+
Marker: Marker.ToOption(),
329+
LineColor: LineColor.ToOption(),
330+
LineColorScale: LineColorScale.ToOption(),
331+
LineWidth: LineWidth.ToOption(),
332+
LineDash: LineDash.ToOption(),
333+
Line: Line.ToOption(),
334+
UseDefaults: UseDefaults.ToOption()
335+
);
254336
}
255337
}

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,18 +775,35 @@ static void Main(string[] args)
775775
imag: new double [] {1,2,3,4},
776776
mode: Mode.Markers,
777777
Name: "scattersmith"
778+
).WithTraceInfo(
779+
LegendGroup: "scattersmith-derived",
780+
LegendGroupTitle: Plotly.NET.Title.init("scattersmith derived traces", Font: Plotly.NET.Font.init(Size: 20))
778781
),
779782
Chart.PointSmith<double,double,string>(
780783
real: new double [] {1,2,3,4},
781784
imag: new double [] {1,2,3,4},
782785
Name: "pointsmith"
786+
).WithTraceInfo(
787+
LegendGroup: "scattersmith-derived",
788+
LegendGroupTitle: Plotly.NET.Title.init("scattersmith derived traces", Font: Plotly.NET.Font.init(Size: 20))
783789
),
784790
Chart.LineSmith<double,double,string>(
785791
real: new double [] {1,2,3,4},
786792
imag: new double [] {1,2,3,4},
787793
Name: "linesmith"
794+
).WithTraceInfo(
795+
LegendGroup: "scattersmith-derived",
796+
LegendGroupTitle: Plotly.NET.Title.init("scattersmith derived traces", Font: Plotly.NET.Font.init(Size: 20))
797+
),
798+
Chart.BubbleSmith<double,double,string>(
799+
sizes: new int [] {10, 20, 30, 40},
800+
real: new double [] {1,2,3,4},
801+
imag: new double [] {1,2,3,4},
802+
Name: "bubblesmith"
803+
).WithTraceInfo(
804+
LegendGroup: "scattersmith-derived",
805+
LegendGroupTitle: Plotly.NET.Title.init("scattersmith derived traces", Font: Plotly.NET.Font.init(Size: 20))
788806
),
789-
Chart.Invisible(),
790807
Chart.Invisible(),
791808
Chart.Invisible(),
792809
Chart.Invisible()

0 commit comments

Comments
 (0)