diff --git a/src/Plotly.NET.CSharp/ChartAPI/ChartTernary.cs b/src/Plotly.NET.CSharp/ChartAPI/ChartTernary.cs index a4d4c7fb5..00775da72 100644 --- a/src/Plotly.NET.CSharp/ChartAPI/ChartTernary.cs +++ b/src/Plotly.NET.CSharp/ChartAPI/ChartTernary.cs @@ -103,5 +103,263 @@ public static GenericChart.GenericChart ScatterTernary + /// Creates a point plot on a ternary coordinate system + /// + /// 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. + /// + /// 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<i>.sum`. + /// 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<i>.sum`. + /// 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<i>.sum`. + /// The number each triplet should sum to, if only two of `a`, `b`, and `c` are provided. This overrides `ternary<i>.sum` to normalize this specific trace, but does not affect the values displayed on the axes. 0 (or missing) means to use `ternary<i>.sum` + /// Sets the trace name. The trace name appear as the legend item and on hover + /// Determines whether or not an item corresponding to this trace is shown in the legend. + /// Sets the opactity of the trace + /// Sets the opactity of individual datum markers + /// Sets a text associated with each datum + /// Sets individual text for each datum + /// Sets the position of text associated with each datum + /// Sets the position of text associated with individual datum + /// Sets the color of the marker + /// Sets the colorscale of the marker + /// Sets the outline of the marker + /// Sets the marker symbol for each datum + /// Sets the marker symbol for each individual datum + /// Sets the marker (use this for more finegrained control than the other marker-associated arguments) + /// If set to false, ignore the global default settings set in `Defaults` + public static GenericChart.GenericChart PointTernary( + Optional> A = default, + Optional> B = default, + Optional> C = default, + Optional Sum = default, + Optional Name = default, + Optional ShowLegend = default, + Optional Opacity = default, + Optional> MultiOpacity = default, + Optional Text = default, + Optional> MultiText = default, + Optional TextPosition = default, + Optional> MultiTextPosition = default, + Optional MarkerColor = default, + Optional MarkerColorScale = default, + Optional MarkerOutline = default, + Optional MarkerSymbol = default, + Optional> MultiMarkerSymbol = default, + Optional Marker = default, + Optional UseDefaults = default + ) + where AType : IConvertible + where BType : IConvertible + where CType : IConvertible + where SumType : IConvertible + where TextType : IConvertible + => + Plotly.NET.ChartTernary.Chart.PointTernary( + A: A.ToOption(), + B: B.ToOption(), + C: C.ToOption(), + Sum: Sum.ToOption(), + Name: Name.ToOption(), + ShowLegend: ShowLegend.ToOption(), + Opacity: Opacity.ToOption(), + MultiOpacity: MultiOpacity.ToOption(), + Text: Text.ToOption(), + MultiText: MultiText.ToOption(), + TextPosition: TextPosition.ToOption(), + MultiTextPosition: MultiTextPosition.ToOption(), + MarkerColor: MarkerColor.ToOption(), + MarkerColorScale: MarkerColorScale.ToOption(), + MarkerOutline: MarkerOutline.ToOption(), + MarkerSymbol: MarkerSymbol.ToOption(), + MultiMarkerSymbol: MultiMarkerSymbol.ToOption(), + Marker: Marker.ToOption(), + UseDefaults: UseDefaults.ToOption() + ); + + /// + /// Creates a line plot on a ternary coordinate system + /// + /// 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. + /// + /// 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<i>.sum`. + /// 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<i>.sum`. + /// 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<i>.sum`. + /// The number each triplet should sum to, if only two of `a`, `b`, and `c` are provided. This overrides `ternary<i>.sum` to normalize this specific trace, but does not affect the values displayed on the axes. 0 (or missing) means to use `ternary<i>.sum` + /// Wether to show markers for the individual data points + /// Sets the trace name. The trace name appear as the legend item and on hover + /// Determines whether or not an item corresponding to this trace is shown in the legend. + /// Sets the opactity of the trace + /// Sets the opactity of individual datum markers + /// Sets a text associated with each datum + /// Sets individual text for each datum + /// Sets the position of text associated with each datum + /// Sets the position of text associated with individual datum + /// Sets the color of the marker + /// Sets the colorscale of the marker + /// Sets the outline of the marker + /// Sets the marker symbol for each datum + /// Sets the marker symbol for each individual datum + /// Sets the marker (use this for more finegrained control than the other marker-associated arguments) + /// Sets the color of the line + /// Sets the colorscale of the line + /// Sets the width of the line + /// sets the drawing style of the line + /// Sets the line (use this for more finegrained control than the other line-associated arguments) + /// If set to false, ignore the global default settings set in `Defaults` + public static GenericChart.GenericChart LineTernary( + Optional> A = default, + Optional> B = default, + Optional> C = default, + Optional Sum = default, + Optional ShowMarkers = default, + Optional Name = default, + Optional ShowLegend = default, + Optional Opacity = default, + Optional> MultiOpacity = default, + Optional Text = default, + Optional> MultiText = default, + Optional TextPosition = default, + Optional> MultiTextPosition = default, + Optional MarkerColor = default, + Optional MarkerColorScale = default, + Optional MarkerOutline = default, + Optional MarkerSymbol = default, + Optional> MultiMarkerSymbol = default, + Optional Marker = default, + Optional LineColor = default, + Optional LineColorScale = default, + Optional LineWidth = default, + Optional LineDash = default, + Optional Line = default, + Optional UseDefaults = default + ) + where AType : IConvertible + where BType : IConvertible + where CType : IConvertible + where SumType : IConvertible + where TextType : IConvertible + => + Plotly.NET.ChartTernary.Chart.LineTernary( + A: A.ToOption(), + B: B.ToOption(), + C: C.ToOption(), + Sum: Sum.ToOption(), + ShowMarkers: ShowMarkers.ToOption(), + Name: Name.ToOption(), + ShowLegend: ShowLegend.ToOption(), + Opacity: Opacity.ToOption(), + MultiOpacity: MultiOpacity.ToOption(), + Text: Text.ToOption(), + MultiText: MultiText.ToOption(), + TextPosition: TextPosition.ToOption(), + MultiTextPosition: MultiTextPosition.ToOption(), + MarkerColor: MarkerColor.ToOption(), + MarkerColorScale: MarkerColorScale.ToOption(), + MarkerOutline: MarkerOutline.ToOption(), + MarkerSymbol: MarkerSymbol.ToOption(), + MultiMarkerSymbol: MultiMarkerSymbol.ToOption(), + Marker: Marker.ToOption(), + LineColor: LineColor.ToOption(), + LineColorScale: LineColorScale.ToOption(), + LineWidth: LineWidth.ToOption(), + LineDash: LineDash.ToOption(), + Line: Line.ToOption(), + UseDefaults: UseDefaults.ToOption() + ); + + /// + /// Creates a bubble plot on a ternary 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. + /// + /// 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. + /// A 4th data dimension is used to determine the size of the points. + /// + /// Sets the bubble size of the plotted data + /// 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<i>.sum`. + /// 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<i>.sum`. + /// 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<i>.sum`. + /// The number each triplet should sum to, if only two of `a`, `b`, and `c` are provided. This overrides `ternary<i>.sum` to normalize this specific trace, but does not affect the values displayed on the axes. 0 (or missing) means to use `ternary<i>.sum` + /// Sets the trace name. The trace name appear as the legend item and on hover + /// Determines whether or not an item corresponding to this trace is shown in the legend. + /// Sets the opactity of the trace + /// Sets the opactity of individual datum markers + /// Sets a text associated with each datum + /// Sets individual text for each datum + /// Sets the position of text associated with each datum + /// Sets the position of text associated with individual datum + /// Sets the color of the marker + /// Sets the colorscale of the marker + /// Sets the outline of the marker + /// Sets the marker symbol for each datum + /// Sets the marker symbol for each individual datum + /// Sets the marker (use this for more finegrained control than the other marker-associated arguments) + /// Sets the color of the line + /// Sets the colorscale of the line + /// Sets the width of the line + /// sets the drawing style of the line + /// Sets the line (use this for more finegrained control than the other line-associated arguments) + /// If set to false, ignore the global default settings set in `Defaults` + public static GenericChart.GenericChart BubbleTernary( + IEnumerable sizes, + Optional> A = default, + Optional> B = default, + Optional> C = default, + Optional Sum = default, + Optional Name = default, + Optional ShowLegend = default, + Optional Opacity = default, + Optional> MultiOpacity = default, + Optional Text = default, + Optional> MultiText = default, + Optional TextPosition = default, + Optional> MultiTextPosition = default, + Optional MarkerColor = default, + Optional MarkerColorScale = default, + Optional MarkerOutline = default, + Optional MarkerSymbol = default, + Optional> MultiMarkerSymbol = default, + Optional Marker = default, + Optional LineColor = default, + Optional LineColorScale = default, + Optional LineWidth = default, + Optional LineDash = default, + Optional Line = default, + Optional UseDefaults = default + ) + where AType : IConvertible + where BType : IConvertible + where CType : IConvertible + where SumType : IConvertible + where TextType : IConvertible + => + Plotly.NET.ChartTernary.Chart.BubbleTernary( + sizes: sizes, + A: A.ToOption(), + B: B.ToOption(), + C: C.ToOption(), + Sum: Sum.ToOption(), + Name: Name.ToOption(), + ShowLegend: ShowLegend.ToOption(), + Opacity: Opacity.ToOption(), + MultiOpacity: MultiOpacity.ToOption(), + Text: Text.ToOption(), + MultiText: MultiText.ToOption(), + TextPosition: TextPosition.ToOption(), + MultiTextPosition: MultiTextPosition.ToOption(), + MarkerColor: MarkerColor.ToOption(), + MarkerColorScale: MarkerColorScale.ToOption(), + MarkerOutline: MarkerOutline.ToOption(), + MarkerSymbol: MarkerSymbol.ToOption(), + MultiMarkerSymbol: MultiMarkerSymbol.ToOption(), + Marker: Marker.ToOption(), + LineColor: LineColor.ToOption(), + LineColorScale: LineColorScale.ToOption(), + LineWidth: LineWidth.ToOption(), + LineDash: LineDash.ToOption(), + Line: Line.ToOption(), + UseDefaults: UseDefaults.ToOption() + ); } } diff --git a/tests/Plotly.NET.Tests.CSharpConsole/Program.cs b/tests/Plotly.NET.Tests.CSharpConsole/Program.cs index c929311df..eb6940a5c 100644 --- a/tests/Plotly.NET.Tests.CSharpConsole/Program.cs +++ b/tests/Plotly.NET.Tests.CSharpConsole/Program.cs @@ -236,21 +236,29 @@ static void Main(string[] args) high: new double [] {1.8, 8.5}, low: new double [] {0.5, 0.1}, close: new double [] {1.1, 2.9}, - x: new DateTime [] {DateTime.Parse("07/07/2021"), DateTime.Parse("07/07/2022") } + x: new DateTime [] {DateTime.Parse("07/07/2021"), DateTime.Parse("07/07/2022") }, + Name: "ohlc" ).WithXAxisRangeSlider( rangeSlider: Plotly.NET.LayoutObjects.RangeSlider.init( - Visible: false - )), + Visible: false + )).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) + ), Chart.Candlestick( open: new double [] {1.2, 2.7}, high: new double [] {1.8, 8.5}, low: new double [] {0.5, 0.1}, close: new double [] {1.1, 2.9}, - x: new DateTime [] {DateTime.Parse("07/07/2021"), DateTime.Parse("07/07/2022") } + x: new DateTime [] {DateTime.Parse("07/07/2021"), DateTime.Parse("07/07/2022") }, + Name: "candlestick" ).WithXAxisRangeSlider( rangeSlider: Plotly.NET.LayoutObjects.RangeSlider.init( Visible: false - )), + )).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) + ), Chart.Waterfall( x: new string [] {"A", "B", "Net", "Purch", "Other", "Profit"}, y: new int [] {60, 80, 0, -40, -20, 0}, @@ -261,33 +269,54 @@ static void Main(string[] args) Plotly.NET.StyleParam.WaterfallMeasure.Relative, Plotly.NET.StyleParam.WaterfallMeasure.Relative, Plotly.NET.StyleParam.WaterfallMeasure.Total - } + }, + Name: "waterfall" + ).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) ), Chart.Funnel( x: new double [] { 1200, 909.4, 600.6, 300, 80 }, - y: new string[] { "A", "B", "C", "D", "E"} + y: new string[] { "A", "B", "C", "D", "E"}, + Name: "funnel" + ).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) ), Chart.Combine( new GenericChart [] { Chart.StackedFunnel( - x: new double [] { 1200, 909.4, 600.6, 300, 80 }, - y: new string[] { "A", "B", "C", "D", "E"} + x: new double [] { 1200, 909.4}, + y: new string[] { "A", "B"}, + Name: "stackedfunnel 1" ), Chart.StackedFunnel( - x: new double [] { 1200, 909.4, 600.6, 300, 80 }, - y: new string[] { "A", "B", "C", "D", "E"} + x: new double [] { 1200, 100.4,}, + y: new string[] { "A", "B"}, + Name: "stackedfunnel 2" ), } + ).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) ), Chart.FunnelArea( - values: new int [] { 5, 4, 3, 2, 1 }, - MultiText: new string[] { "A", "B", "C", "D", "E"} + values: new int [] { 5, 4}, + MultiText: new string[] { "A", "B"}, + Name: "funnelarea" + ).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) ), Chart.Indicator( value: 200, mode: Plotly.NET.StyleParam.IndicatorMode.NumberDeltaGauge, - DeltaReference: 160 + DeltaReference: 160, + Name: "indicator" + ).WithTraceInfo( + LegendGroup: "finance", + LegendGroupTitle: Plotly.NET.Title.init("finance charts", Font: Plotly.NET.Font.init(Size: 20)) ), //3D traces @@ -517,11 +546,40 @@ static void Main(string[] args) Chart.ScatterTernary( A: new int [] { 1, 2 }, B: new int [] { 3, 4 }, - C: new int [] { 5, 6 } + C: new int [] { 10, 2 }, + Name: "scatterternary" + ).WithTraceInfo( + LegendGroup: "scatterternary-derived", + LegendGroupTitle: Plotly.NET.Title.init("scatterternary derived traces", Font: Plotly.NET.Font.init(Size: 20)) + ), + Chart.PointTernary( + A: new int [] { 1, 2 }, + B: new int [] { 3, 4 }, + C: new int [] { 10, 2 }, + Name: "pointternary" + ).WithTraceInfo( + LegendGroup: "scatterternary-derived", + LegendGroupTitle: Plotly.NET.Title.init("scatterternary derived traces", Font: Plotly.NET.Font.init(Size: 20)) + ), + Chart.LineTernary( + A: new int [] { 1, 2 }, + B: new int [] { 3, 4 }, + C: new int [] { 10, 2 }, + Name: "lineternary" + ).WithTraceInfo( + LegendGroup: "scatterternary-derived", + LegendGroupTitle: Plotly.NET.Title.init("scatterternary derived traces", Font: Plotly.NET.Font.init(Size: 20)) + ), + Chart.BubbleTernary( + sizes: new int [] {30, 40}, + A: new int [] { 1, 2 }, + B: new int [] { 3, 4 }, + C: new int [] { 10, 2 }, + Name: "bubbleternary" + ).WithTraceInfo( + LegendGroup: "scatterternary-derived", + LegendGroupTitle: Plotly.NET.Title.init("scatterternary derived traces", Font: Plotly.NET.Font.init(Size: 20)) ), - Chart.Invisible(), - Chart.Invisible(), - Chart.Invisible(), Chart.Invisible(), Chart.Invisible(), Chart.Invisible(),