AshReports.Layout.IR.Line (ash_reports v0.1.0)
Intermediate Representation for horizontal and vertical lines.
Lines are used for visual separators in grids and tables (hline/vline).
Orientation
:horizontal- Spans across columns (hline):vertical- Spans across rows (vline)
Position
For horizontal lines, position is the row index (y). For vertical lines, position is the column index (x).
Examples
# Horizontal line at row 2, spanning columns 0-3
hline = AshReports.Layout.IR.Line.new(
orientation: :horizontal,
position: 2,
start: 0,
end: 3,
stroke: "1pt"
)
# Vertical line at column 1
vline = AshReports.Layout.IR.Line.new(
orientation: :vertical,
position: 1,
stroke: "2pt solid red"
)
Summary
Functions
Creates a horizontal line (hline) at the given row.
Returns true if the line is horizontal.
Creates a new LineIR struct with the given options.
Returns true if the line is vertical.
Creates a vertical line (vline) at the given column.
Types
@type orientation() :: :horizontal | :vertical
@type t() :: %AshReports.Layout.IR.Line{ end: non_neg_integer() | nil, orientation: orientation(), position: non_neg_integer(), start: non_neg_integer() | nil, stroke: String.t() | nil }
Functions
@spec hline(non_neg_integer(), Keyword.t()) :: t()
Creates a horizontal line (hline) at the given row.
Returns true if the line is horizontal.
Creates a new LineIR struct with the given options.
Options
:orientation-:horizontalor:vertical(required):position- Row index for hline, column index for vline (required):start- Start position for the line (optional):end- End position for the line (optional):stroke- Stroke specification (e.g., "1pt", "2pt solid red")
Examples
iex> AshReports.Layout.IR.Line.new(orientation: :horizontal, position: 1)
%AshReports.Layout.IR.Line{orientation: :horizontal, position: 1, ...}
Returns true if the line is vertical.
@spec vline(non_neg_integer(), Keyword.t()) :: t()
Creates a vertical line (vline) at the given column.