From 4ebd0d054c74f06d160a97ba74e016b4786c002d Mon Sep 17 00:00:00 2001
From: TheKiiiing <86165940+TheKiiiing@users.noreply.github.com>
Date: Sat, 3 Aug 2024 04:00:47 +0200
Subject: [PATCH] Add C# wrapper for Chart.SingleStack(...)
---
src/Plotly.NET.CSharp/ChartAPI/Chart.cs | 49 +++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/src/Plotly.NET.CSharp/ChartAPI/Chart.cs b/src/Plotly.NET.CSharp/ChartAPI/Chart.cs
index 13db2dac..8a335e92 100644
--- a/src/Plotly.NET.CSharp/ChartAPI/Chart.cs
+++ b/src/Plotly.NET.CSharp/ChartAPI/Chart.cs
@@ -71,5 +71,54 @@ public static GenericChart Grid(
XSide: XSide.ToOption(),
YSide: YSide.ToOption()
).Invoke(gCharts);
+
+ ///
+ /// Creates a chart stack (a subplot grid with one column) from the input charts.
+ ///
+ /// The charts to display.
+ /// A collection of titles for the individual subplots.
+ /// The font of the subplot titles
+ /// A vertical offset applied to each subplot title, moving it upwards if positive and vice versa
+ /// Used for freeform grids, where some axes may be shared across subplots but others are not. Each entry should be a cartesian subplot id, like "xy" or "x3y2", or "" to leave that cell empty. You may reuse x axes within the same column, and y axes within the same row. Non-cartesian subplots and traces that support `domain` can place themselves in this grid separately using the `gridcell` attribute.
+ /// Used with `yaxes` when the x and y axes are shared across columns and rows. Each entry should be an y axis id like "y", "y2", etc., or "" to not put a y axis in that row. Entries other than "" must be unique. Ignored if `subplots` is present. If missing but `xaxes` is present, will generate consecutive IDs.
+ /// Used with `yaxes` when the x and y axes are shared across columns and rows. Each entry should be an x axis id like "x", "x2", etc., or "" to not put an x axis in that column. Entries other than "" must be unique. Ignored if `subplots` is present. If missing but `yaxes` is present, will generate consecutive IDs.
+ /// Is the first row the top or the bottom? Note that columns are always enumerated from left to right.
+ /// If no `subplots`, `xaxes`, or `yaxes` are given but we do have `rows` and `columns`, we can generate defaults using consecutive axis IDs, in two ways: "coupled" gives one x axis per column and one y axis per row. "independent" uses a new xy pair for each cell, left-to-right across each row then iterating rows according to `roworder`.
+ /// Horizontal space between grid cells, expressed as a fraction of the total width available to one cell. Defaults to 0.1 for coupled-axes grids and 0.2 for independent grids.
+ /// Vertical space between grid cells, expressed as a fraction of the total height available to one cell. Defaults to 0.1 for coupled-axes grids and 0.3 for independent grids.
+ /// Sets the domains of this grid subplot (in plot fraction). The first and last cells end exactly at the domain edges, with no grout around the edges.
+ /// Sets where the x axis labels and titles go. "bottom" means the very bottom of the grid. "bottom plot" is the lowest plot that each x axis is used in. "top" and "top plot" are similar.
+ /// Sets where the y axis labels and titles go. "left" means the very left edge of the grid. "left plot" is the leftmost plot that each y axis is used in. "right" and "right plot" are similar.
+ public static GenericChart SingleStack(
+ IEnumerable gCharts,
+ Optional> SubPlotTitles = default,
+ Optional SubPlotTitleFont = default,
+ Optional SubPlotTitleOffset = default,
+ Optional[][]> SubPlots = default,
+ Optional XAxes = default,
+ Optional YAxes = default,
+ Optional RowOrder = default,
+ Optional Pattern = default,
+ Optional XGap = default,
+ Optional YGap = default,
+ Optional Domain = default,
+ Optional XSide = default,
+ Optional YSide = default
+ ) =>
+ Plotly.NET.Chart.SingleStack, IEnumerable>(
+ SubPlotTitles: SubPlotTitles.ToOption(),
+ SubPlotTitleFont: SubPlotTitleFont.ToOption(),
+ SubPlotTitleOffset: SubPlotTitleOffset.ToOption(),
+ SubPlots: SubPlots.ToOption(),
+ XAxes: XAxes.ToOption(),
+ YAxes: YAxes.ToOption(),
+ RowOrder: RowOrder.ToOption(),
+ Pattern: Pattern.ToOption(),
+ XGap: XGap.ToOption(),
+ YGap: YGap.ToOption(),
+ Domain: Domain.ToOption(),
+ XSide: XSide.ToOption(),
+ YSide: YSide.ToOption()
+ ).Invoke(gCharts);
}
}