|
| 1 | +namespace FSharp.Plotly |
| 2 | + |
| 3 | +open System |
| 4 | + |
| 5 | +/// A plot grid that can contain subplots with shared axes. |
| 6 | +type LayoutGrid () = |
| 7 | + inherit DynamicObj () |
| 8 | + |
| 9 | + /// Initializes LayoutGrid object |
| 10 | + /// |
| 11 | + /// |
| 12 | + ///SubPlots : 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. |
| 13 | + /// |
| 14 | + ///XAxes : 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. |
| 15 | + /// |
| 16 | + ///YAxes : 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. |
| 17 | + /// |
| 18 | + ///Rows : The number of rows in the grid. If you provide a 2D `subplots` array or a `yaxes` array, its length is used as the default. But it's also possible to have a different length, if you want to leave a row at the end for non-cartesian subplots. |
| 19 | + /// |
| 20 | + ///Columns : The number of columns in the grid. If you provide a 2D `subplots` array, the length of its longest row is used as the default. If you give an `xaxes` array, its length is used as the default. But it's also possible to have a different length, if you want to leave a row at the end for non-cartesian subplots. |
| 21 | + /// |
| 22 | + ///RowOrder : Is the first row the top or the bottom? Note that columns are always enumerated from left to right. |
| 23 | + /// |
| 24 | + ///Pattern : 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`. |
| 25 | + /// |
| 26 | + ///XGap : 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. |
| 27 | + /// |
| 28 | + ///YGap : 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. |
| 29 | + /// |
| 30 | + ///Domain : 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. |
| 31 | + /// |
| 32 | + ///XSide : 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. |
| 33 | + /// |
| 34 | + ///YSide : 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. |
| 35 | + static member init |
| 36 | + ( |
| 37 | + ?SubPlots : StyleParam.AxisId [] [], |
| 38 | + ?XAxes : StyleParam.AxisId [], |
| 39 | + ?YAxes : StyleParam.AxisId [], |
| 40 | + ?Rows : int, |
| 41 | + ?Columns : int, |
| 42 | + ?RowOrder : StyleParam.LayoutGridRowOrder, |
| 43 | + ?Pattern : StyleParam.LayoutGridPattern, |
| 44 | + ?XGap : float, |
| 45 | + ?YGap : float, |
| 46 | + ?Domain : Domain, |
| 47 | + ?XSide : StyleParam.LayoutGridXSide, |
| 48 | + ?YSide : StyleParam.LayoutGridYSide |
| 49 | + ) = |
| 50 | + LayoutGrid () |
| 51 | + |> LayoutGrid.style |
| 52 | + ( |
| 53 | + ?SubPlots = SubPlots, |
| 54 | + ?XAxes = XAxes , |
| 55 | + ?YAxes = YAxes , |
| 56 | + ?Rows = Rows , |
| 57 | + ?Columns = Columns , |
| 58 | + ?RowOrder = RowOrder, |
| 59 | + ?Pattern = Pattern , |
| 60 | + ?XGap = XGap , |
| 61 | + ?YGap = YGap , |
| 62 | + ?Domain = Domain , |
| 63 | + ?XSide = XSide , |
| 64 | + ?YSide = YSide |
| 65 | + |
| 66 | + ) |
| 67 | + |
| 68 | + // Applies the styles to LayoutGrid() |
| 69 | + /// |
| 70 | + ///SubPlots : 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. |
| 71 | + /// |
| 72 | + ///XAxes : 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. |
| 73 | + /// |
| 74 | + ///YAxes : 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. |
| 75 | + /// |
| 76 | + ///Rows : The number of rows in the grid. If you provide a 2D `subplots` array or a `yaxes` array, its length is used as the default. But it's also possible to have a different length, if you want to leave a row at the end for non-cartesian subplots. |
| 77 | + /// |
| 78 | + ///Columns : The number of columns in the grid. If you provide a 2D `subplots` array, the length of its longest row is used as the default. If you give an `xaxes` array, its length is used as the default. But it's also possible to have a different length, if you want to leave a row at the end for non-cartesian subplots. |
| 79 | + /// |
| 80 | + ///RowOrder : Is the first row the top or the bottom? Note that columns are always enumerated from left to right. |
| 81 | + /// |
| 82 | + ///Pattern : 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`. |
| 83 | + /// |
| 84 | + ///XGap : 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. |
| 85 | + /// |
| 86 | + ///YGap : 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. |
| 87 | + /// |
| 88 | + ///Domain : 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. |
| 89 | + /// |
| 90 | + ///XSide : 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. |
| 91 | + /// |
| 92 | + ///YSide : 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. |
| 93 | + static member style |
| 94 | + ( |
| 95 | + ?SubPlots : StyleParam.AxisId [] [], |
| 96 | + ?XAxes : StyleParam.AxisId [], |
| 97 | + ?YAxes : StyleParam.AxisId [], |
| 98 | + ?Rows : int, |
| 99 | + ?Columns : int, |
| 100 | + ?RowOrder : StyleParam.LayoutGridRowOrder, |
| 101 | + ?Pattern : StyleParam.LayoutGridPattern, |
| 102 | + ?XGap : float, |
| 103 | + ?YGap : float, |
| 104 | + ?Domain : Domain, |
| 105 | + ?XSide : StyleParam.LayoutGridXSide, |
| 106 | + ?YSide : StyleParam.LayoutGridYSide |
| 107 | + ) = |
| 108 | + (fun (layoutGrid: LayoutGrid) -> |
| 109 | + SubPlots |> DynObj.setValueOptBy layoutGrid "subplots" (Array.map (Array.map StyleParam.AxisId.toString)) |
| 110 | + XAxes |> DynObj.setValueOptBy layoutGrid "xaxes" (Array.map StyleParam.AxisId.toString) |
| 111 | + YAxes |> DynObj.setValueOptBy layoutGrid "yaxes" (Array.map StyleParam.AxisId.toString) |
| 112 | + Rows |> DynObj.setValueOpt layoutGrid "rows" |
| 113 | + Columns |> DynObj.setValueOpt layoutGrid "columns" |
| 114 | + RowOrder |> DynObj.setValueOptBy layoutGrid "roworder" StyleParam.LayoutGridRowOrder.toString |
| 115 | + Pattern |> DynObj.setValueOptBy layoutGrid "pattern" StyleParam.LayoutGridPattern.toString |
| 116 | + XGap |> DynObj.setValueOpt layoutGrid "xgap" |
| 117 | + YGap |> DynObj.setValueOpt layoutGrid "ygap" |
| 118 | + Domain |> DynObj.setValueOpt layoutGrid "domain" |
| 119 | + XSide |> DynObj.setValueOptBy layoutGrid "xside" StyleParam.LayoutGridXSide.toString |
| 120 | + YSide |> DynObj.setValueOptBy layoutGrid "yside" StyleParam.LayoutGridYSide.toString |
| 121 | + |
| 122 | + layoutGrid |
| 123 | + ) |
0 commit comments