Tables

Term.Tables.TableType
Table

A Table renderable.

Examples


t = 1:3
data = hcat(t, rand(Int8, length(t)))
Table(data)

┌───────────┬───────────┐
│  Column1  │  Column2  │
├───────────┼───────────┤
│     1     │    -95    │
├───────────┼───────────┤
│     2     │    -85    │
├───────────┼───────────┤
│     3     │    115    │
└───────────┴───────────┘
source
Term.Tables.TableMethod

Table(data::AbstractDict; kwargs...)

Construct Table from a Dict. The Dict's keys make up the table header if none is assigned.

source
Term.Tables.TableMethod
Table(data::Union{AbstractVector, AbstractMatrix}; kwargs...)

Construct Table from Vector and Matrix

source
Term.Tables.TableMethod
Table(
    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.

Tip

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.

source
Term.Tables.assert_table_argumentsMethod
assert_table_arguments

Check 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.

source
Term.Tables.calc_columns_widthsMethod
columns_widths

Get 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.

source
Term.Tables.cellMethod
cell(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.

source
Term.Tables.cellMethod
cell(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.

source
Term.Tables.make_row_cellsMethod
make_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).

source
Term.Tables.table_rowMethod
table_row(cells, widths, box, top_level, mid_level, bottom_level, box_style, row_height)

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.

source