Skip to content

Commit b673d0f

Browse files
authored
Merge pull request #347 from plotly/csharp-layer
[C#] add C# bindings for the missing ternary and carpet charts
2 parents 925aa31 + 8691ad1 commit b673d0f

File tree

2 files changed

+334
-18
lines changed

2 files changed

+334
-18
lines changed

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

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,263 @@ public static GenericChart.GenericChart ScatterTernary<AType, BType, CType, SumT
103103
Line: Line.ToOption(),
104104
UseDefaults: UseDefaults.ToOption()
105105
);
106+
107+
/// <summary>
108+
/// Creates a point plot on a ternary coordinate system
109+
///
110+
/// In general, PointTernary creates a barycentric point plot on three variables which sum to a constant, graphically depicting the ratios of the three variables as positions in an equilateral triangle.
111+
/// </summary>
112+
/// <param name="A">Sets the quantity of component `a` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
113+
/// <param name="B">Sets the quantity of component `b` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
114+
/// <param name="C">Sets the quantity of component `c` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
115+
/// <param name="Sum">The number each triplet should sum to, if only two of `a`, `b`, and `c` are provided. This overrides `ternary&lt;i&gt;.sum` to normalize this specific trace, but does not affect the values displayed on the axes. 0 (or missing) means to use `ternary&lt;i&gt;.sum`</param>
116+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
117+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
118+
/// <param name="Opacity">Sets the opactity of the trace</param>
119+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
120+
/// <param name="Text">Sets a text associated with each datum</param>
121+
/// <param name="MultiText">Sets individual text for each datum</param>
122+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
123+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
124+
/// <param name="MarkerColor">Sets the color of the marker</param>
125+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
126+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
127+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
128+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
129+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
130+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
131+
public static GenericChart.GenericChart PointTernary<AType, BType, CType, SumType, TextType>(
132+
Optional<IEnumerable<AType>> A = default,
133+
Optional<IEnumerable<BType>> B = default,
134+
Optional<IEnumerable<CType>> C = default,
135+
Optional<SumType> Sum = default,
136+
Optional<string> Name = default,
137+
Optional<bool> ShowLegend = default,
138+
Optional<double> Opacity = default,
139+
Optional<IEnumerable<double>> MultiOpacity = default,
140+
Optional<TextType> Text = default,
141+
Optional<IEnumerable<TextType>> MultiText = default,
142+
Optional<StyleParam.TextPosition> TextPosition = default,
143+
Optional<IEnumerable<StyleParam.TextPosition>> MultiTextPosition = default,
144+
Optional<Color> MarkerColor = default,
145+
Optional<StyleParam.Colorscale> MarkerColorScale = default,
146+
Optional<Line> MarkerOutline = default,
147+
Optional<StyleParam.MarkerSymbol> MarkerSymbol = default,
148+
Optional<IEnumerable<StyleParam.MarkerSymbol>> MultiMarkerSymbol = default,
149+
Optional<Marker> Marker = default,
150+
Optional<bool> UseDefaults = default
151+
)
152+
where AType : IConvertible
153+
where BType : IConvertible
154+
where CType : IConvertible
155+
where SumType : IConvertible
156+
where TextType : IConvertible
157+
=>
158+
Plotly.NET.ChartTernary.Chart.PointTernary<AType, BType, CType, SumType, TextType>(
159+
A: A.ToOption(),
160+
B: B.ToOption(),
161+
C: C.ToOption(),
162+
Sum: Sum.ToOption(),
163+
Name: Name.ToOption(),
164+
ShowLegend: ShowLegend.ToOption(),
165+
Opacity: Opacity.ToOption(),
166+
MultiOpacity: MultiOpacity.ToOption(),
167+
Text: Text.ToOption(),
168+
MultiText: MultiText.ToOption(),
169+
TextPosition: TextPosition.ToOption(),
170+
MultiTextPosition: MultiTextPosition.ToOption(),
171+
MarkerColor: MarkerColor.ToOption(),
172+
MarkerColorScale: MarkerColorScale.ToOption(),
173+
MarkerOutline: MarkerOutline.ToOption(),
174+
MarkerSymbol: MarkerSymbol.ToOption(),
175+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
176+
Marker: Marker.ToOption(),
177+
UseDefaults: UseDefaults.ToOption()
178+
);
179+
180+
/// <summary>
181+
/// Creates a line plot on a ternary coordinate system
182+
///
183+
/// In general, LineTernary creates a barycentric line plot on three variables which sum to a constant, graphically depicting the ratios of the three variables as positions in an equilateral triangle.
184+
/// </summary>
185+
/// <param name="A">Sets the quantity of component `a` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
186+
/// <param name="B">Sets the quantity of component `b` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
187+
/// <param name="C">Sets the quantity of component `c` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
188+
/// <param name="Sum">The number each triplet should sum to, if only two of `a`, `b`, and `c` are provided. This overrides `ternary&lt;i&gt;.sum` to normalize this specific trace, but does not affect the values displayed on the axes. 0 (or missing) means to use `ternary&lt;i&gt;.sum`</param>
189+
/// <param name="ShowMarkers">Wether to show markers for the individual data points</param>
190+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
191+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
192+
/// <param name="Opacity">Sets the opactity of the trace</param>
193+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
194+
/// <param name="Text">Sets a text associated with each datum</param>
195+
/// <param name="MultiText">Sets individual text for each datum</param>
196+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
197+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
198+
/// <param name="MarkerColor">Sets the color of the marker</param>
199+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
200+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
201+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
202+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
203+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
204+
/// <param name="LineColor">Sets the color of the line</param>
205+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
206+
/// <param name="LineWidth">Sets the width of the line</param>
207+
/// <param name="LineDash">sets the drawing style of the line</param>
208+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
209+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
210+
public static GenericChart.GenericChart LineTernary<AType, BType, CType, SumType, TextType>(
211+
Optional<IEnumerable<AType>> A = default,
212+
Optional<IEnumerable<BType>> B = default,
213+
Optional<IEnumerable<CType>> C = default,
214+
Optional<SumType> Sum = default,
215+
Optional<bool> ShowMarkers = default,
216+
Optional<string> Name = default,
217+
Optional<bool> ShowLegend = default,
218+
Optional<double> Opacity = default,
219+
Optional<IEnumerable<double>> MultiOpacity = default,
220+
Optional<TextType> Text = default,
221+
Optional<IEnumerable<TextType>> MultiText = default,
222+
Optional<StyleParam.TextPosition> TextPosition = default,
223+
Optional<IEnumerable<StyleParam.TextPosition>> MultiTextPosition = default,
224+
Optional<Color> MarkerColor = default,
225+
Optional<StyleParam.Colorscale> MarkerColorScale = default,
226+
Optional<Line> MarkerOutline = default,
227+
Optional<StyleParam.MarkerSymbol> MarkerSymbol = default,
228+
Optional<IEnumerable<StyleParam.MarkerSymbol>> MultiMarkerSymbol = default,
229+
Optional<Marker> Marker = default,
230+
Optional<Color> LineColor = default,
231+
Optional<StyleParam.Colorscale> LineColorScale = default,
232+
Optional<double> LineWidth = default,
233+
Optional<StyleParam.DrawingStyle> LineDash = default,
234+
Optional<Line> Line = default,
235+
Optional<bool> UseDefaults = default
236+
)
237+
where AType : IConvertible
238+
where BType : IConvertible
239+
where CType : IConvertible
240+
where SumType : IConvertible
241+
where TextType : IConvertible
242+
=>
243+
Plotly.NET.ChartTernary.Chart.LineTernary<AType, BType, CType, SumType, TextType>(
244+
A: A.ToOption(),
245+
B: B.ToOption(),
246+
C: C.ToOption(),
247+
Sum: Sum.ToOption(),
248+
ShowMarkers: ShowMarkers.ToOption(),
249+
Name: Name.ToOption(),
250+
ShowLegend: ShowLegend.ToOption(),
251+
Opacity: Opacity.ToOption(),
252+
MultiOpacity: MultiOpacity.ToOption(),
253+
Text: Text.ToOption(),
254+
MultiText: MultiText.ToOption(),
255+
TextPosition: TextPosition.ToOption(),
256+
MultiTextPosition: MultiTextPosition.ToOption(),
257+
MarkerColor: MarkerColor.ToOption(),
258+
MarkerColorScale: MarkerColorScale.ToOption(),
259+
MarkerOutline: MarkerOutline.ToOption(),
260+
MarkerSymbol: MarkerSymbol.ToOption(),
261+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
262+
Marker: Marker.ToOption(),
263+
LineColor: LineColor.ToOption(),
264+
LineColorScale: LineColorScale.ToOption(),
265+
LineWidth: LineWidth.ToOption(),
266+
LineDash: LineDash.ToOption(),
267+
Line: Line.ToOption(),
268+
UseDefaults: UseDefaults.ToOption()
269+
);
270+
271+
/// <summary>
272+
/// Creates a bubble plot on a ternary coordinate system
273+
///
274+
/// 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.
275+
///
276+
/// In general, BubbleTernary creates a barycentric point plot on three variables which sum to a constant, graphically depicting the ratios of the three variables as positions in an equilateral triangle.
277+
/// A 4th data dimension is used to determine the size of the points.
278+
/// </summary>
279+
/// <param name="sizes">Sets the bubble size of the plotted data</param>
280+
/// <param name="A">Sets the quantity of component `a` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
281+
/// <param name="B">Sets the quantity of component `b` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
282+
/// <param name="C">Sets the quantity of component `c` in each data point. If `a`, `b`, and `c` are all provided, they need not be normalized, only the relative values matter. If only two arrays are provided they must be normalized to match `ternary&lt;i&gt;.sum`.</param>
283+
/// <param name="Sum">The number each triplet should sum to, if only two of `a`, `b`, and `c` are provided. This overrides `ternary&lt;i&gt;.sum` to normalize this specific trace, but does not affect the values displayed on the axes. 0 (or missing) means to use `ternary&lt;i&gt;.sum`</param>
284+
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
285+
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
286+
/// <param name="Opacity">Sets the opactity of the trace</param>
287+
/// <param name="MultiOpacity">Sets the opactity of individual datum markers</param>
288+
/// <param name="Text">Sets a text associated with each datum</param>
289+
/// <param name="MultiText">Sets individual text for each datum</param>
290+
/// <param name="TextPosition">Sets the position of text associated with each datum</param>
291+
/// <param name="MultiTextPosition">Sets the position of text associated with individual datum</param>
292+
/// <param name="MarkerColor">Sets the color of the marker</param>
293+
/// <param name="MarkerColorScale">Sets the colorscale of the marker</param>
294+
/// <param name="MarkerOutline">Sets the outline of the marker</param>
295+
/// <param name="MarkerSymbol">Sets the marker symbol for each datum</param>
296+
/// <param name="MultiMarkerSymbol">Sets the marker symbol for each individual datum</param>
297+
/// <param name="Marker">Sets the marker (use this for more finegrained control than the other marker-associated arguments)</param>
298+
/// <param name="LineColor">Sets the color of the line</param>
299+
/// <param name="LineColorScale">Sets the colorscale of the line</param>
300+
/// <param name="LineWidth">Sets the width of the line</param>
301+
/// <param name="LineDash">sets the drawing style of the line</param>
302+
/// <param name="Line">Sets the line (use this for more finegrained control than the other line-associated arguments)</param>
303+
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
304+
public static GenericChart.GenericChart BubbleTernary<AType, BType, CType, SumType, TextType>(
305+
IEnumerable<int> sizes,
306+
Optional<IEnumerable<AType>> A = default,
307+
Optional<IEnumerable<BType>> B = default,
308+
Optional<IEnumerable<CType>> C = default,
309+
Optional<SumType> Sum = default,
310+
Optional<string> Name = default,
311+
Optional<bool> ShowLegend = default,
312+
Optional<double> Opacity = default,
313+
Optional<IEnumerable<double>> MultiOpacity = default,
314+
Optional<TextType> Text = default,
315+
Optional<IEnumerable<TextType>> MultiText = default,
316+
Optional<StyleParam.TextPosition> TextPosition = default,
317+
Optional<IEnumerable<StyleParam.TextPosition>> MultiTextPosition = default,
318+
Optional<Color> MarkerColor = default,
319+
Optional<StyleParam.Colorscale> MarkerColorScale = default,
320+
Optional<Line> MarkerOutline = default,
321+
Optional<StyleParam.MarkerSymbol> MarkerSymbol = default,
322+
Optional<IEnumerable<StyleParam.MarkerSymbol>> MultiMarkerSymbol = default,
323+
Optional<Marker> Marker = default,
324+
Optional<Color> LineColor = default,
325+
Optional<StyleParam.Colorscale> LineColorScale = default,
326+
Optional<double> LineWidth = default,
327+
Optional<StyleParam.DrawingStyle> LineDash = default,
328+
Optional<Line> Line = default,
329+
Optional<bool> UseDefaults = default
330+
)
331+
where AType : IConvertible
332+
where BType : IConvertible
333+
where CType : IConvertible
334+
where SumType : IConvertible
335+
where TextType : IConvertible
336+
=>
337+
Plotly.NET.ChartTernary.Chart.BubbleTernary<AType, BType, CType, SumType, TextType>(
338+
sizes: sizes,
339+
A: A.ToOption(),
340+
B: B.ToOption(),
341+
C: C.ToOption(),
342+
Sum: Sum.ToOption(),
343+
Name: Name.ToOption(),
344+
ShowLegend: ShowLegend.ToOption(),
345+
Opacity: Opacity.ToOption(),
346+
MultiOpacity: MultiOpacity.ToOption(),
347+
Text: Text.ToOption(),
348+
MultiText: MultiText.ToOption(),
349+
TextPosition: TextPosition.ToOption(),
350+
MultiTextPosition: MultiTextPosition.ToOption(),
351+
MarkerColor: MarkerColor.ToOption(),
352+
MarkerColorScale: MarkerColorScale.ToOption(),
353+
MarkerOutline: MarkerOutline.ToOption(),
354+
MarkerSymbol: MarkerSymbol.ToOption(),
355+
MultiMarkerSymbol: MultiMarkerSymbol.ToOption(),
356+
Marker: Marker.ToOption(),
357+
LineColor: LineColor.ToOption(),
358+
LineColorScale: LineColorScale.ToOption(),
359+
LineWidth: LineWidth.ToOption(),
360+
LineDash: LineDash.ToOption(),
361+
Line: Line.ToOption(),
362+
UseDefaults: UseDefaults.ToOption()
363+
);
106364
}
107365
}

0 commit comments

Comments
 (0)