Tables
Term.Tables.TableTerm.Tables.TableTerm.Tables.TableTerm.Tables.TableTerm.Tables.assert_table_argumentsTerm.Tables.calc_columns_widthsTerm.Tables.cellTerm.Tables.cellTerm.Tables.expandTerm.Tables.make_row_cellsTerm.Tables.rows_heightsTerm.Tables.table_row
Term.Tables.Table — TypeTableA Table renderable.
Examples
t = 1:3
data = hcat(t, rand(Int8, length(t)))
Table(data)
┌───────────┬───────────┐
│ Column1 │ Column2 │
├───────────┼───────────┤
│ 1 │ -95 │
├───────────┼───────────┤
│ 2 │ -85 │
├───────────┼───────────┤
│ 3 │ 115 │
└───────────┴───────────┘Term.Tables.Table — MethodTable(data::AbstractDict; kwargs...)
Construct Table from a Dict. The Dict's keys make up the table header if none is assigned.
Term.Tables.Table — MethodTable(
tb::TablesPkg.AbstractColumns;
box::Symbol = :SQUARE,
style::String = "default",
hpad::Union{Vector,Int} = 2,
vpad::Union{Vector,Int} = 0,
vertical_justify::Symbol = :center,
show_header::Bool = true,
header::Union{Nothing,Vector,Tuple} = nothing,
header_style::Union{String,Vector,Tuple} = "default",
header_justify::Union{Nothing,Symbol,Vector,Tuple} = nothing,
columns_style::Union{String,Vector,Tuple} = "default",
columns_justify::Union{Symbol,Vector,Tuple} = :center,
columns_widths::Union{Nothing,Int,Vector} = nothing,
footer::Union{Function,Nothing,Vector,Tuple} = nothing,
footer_style::Union{String,Vector,Tuple} = "default",
footer_justify::Union{Nothing,Symbol,Vector,Tuple} = :center,
compact::Bool = false,
)Generic constructor for a Table renderable.
Arguments such as header_style, columns_style and footer_style can either be passed a single value, which will be applied to all columns, or a vector of values, which will be applied to each column.
Term.Tables.Table — MethodTable(data::Union{AbstractVector, AbstractMatrix}; kwargs...)Construct Table from Vector and Matrix
Term.Tables.assert_table_arguments — Methodassert_table_argumentsCheck that arguments passed to Table match the Table's shape. Single arguments are fine, but when a vector is passed it should have the appropriate size.
Term.Tables.calc_columns_widths — Methodcolumns_widthsGet the width of each column in a Table.
If user passed a columns_widths argument use that, otherwise compute the width of each column based on the size of its contents including the header and footer.
Term.Tables.cell — Methodcell(x::AbstractString, hor_pad::Int, h::Int, w::Int, justify::Symbol, style::String, vertical_justify::Symbol)Create a Table's row's cell from a string - apply styling and vertical/horizontal justification.
Term.Tables.cell — Methodcell(x::AbstractString, hor_pad::Int, h::Int, w::Int, justify::Symbol, style::String, vertical_justify::Symbol)Create a Table's row's cell from a renderable - apply styling and vertical/horizontal justification.
Term.Tables.expand — MethodexpandExpand single Table arguments into a vector if necessary.
Term.Tables.make_row_cells — Methodmake_row_cells(
entries::Union{Tuple, Vector},
style::Vector{String},
justify::Vector{Symbol},
widths::Vector{Int},
height::Int,
vertical_justify::Symbol,
)Create a row's cell from a vector of 'entries' (renderables or strings).
Term.Tables.rows_heights — Methodrows_heightsGet the height of each row in a Table
Term.Tables.table_row — Methodfunction table_row(
cells::Vector,
widths::Vector,
box::Symbol,
top_level::Symbol,
mid_level::Symbol,
bottom_level::Symbol,
box_style::String,
row_height::Int;
compact = false,
)Create a single row of a Table renderable.
Each row is made up of an upper, mid and bottom section. The upper and bottom sections are created by rows of the Box type. The mid section is made up of the row's cells and dividing lines.
Arguments
- cells: vector of cells content. Of length equal to the number of columns
- widths: vector of width of each cell.
- box: name of the
Boxused to construct the cell's lines - top/mid/bottom_level: name of the
Boxlevel to be used for construction - box_style: styling to be applied to box
- row_height: height of the row
- compact: if true avoids adding a top layer to the row