Table
// The diagrams you want to put in a table should be in a 2D array.
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
draw(t)
table.table (
diagrams
:
Diagram[][] , padding
:
number = 0 , orientation
:
'rows'|'column' = 'rows' ,
min_rowsize
:
number = 0 , min_colsize
:
number = 0 )
:
Diagram
// The diagrams you want to put in a table should be in a 2D array.
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
draw(t)
Styling The Table
The
Tags that available for tables are
TAG.TABLE
,
TAG.TABLE_CELL
, and
TAG.TABLE_CONTENT
.
TAG.ROW_
and
TAG.COL_
are also available for rows and columns.
// If you want to hide the border of the table, you can style the table cell
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
t = t.apply_to_tagged_recursive(TAG.TABLE_CELL, (d) => d.stroke('none'))
draw(t)
// If you want to hide the border of the table, you can style the table cell
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
t = t.apply_to_tagged_recursive(TAG.TABLE_CELL, (d) => d.stroke('none'))
draw(t)
// All element in row n have the tag `TAG.ROW_+n`
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
t = t.apply_to_tagged_recursive([TAG.TABLE_CELL, TAG.ROW_+'0'], (d) => d.fill('#ddd'))
draw(t)
// All element in row n have the tag `TAG.ROW_+n`
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
t = t.apply_to_tagged_recursive([TAG.TABLE_CELL, TAG.ROW_+'0'], (d) => d.fill('#ddd'))
draw(t)
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
t = t.apply_to_tagged_recursive([TAG.TABLE_CELL, TAG.ROW_+'0', TAG.COL_+'1'], (d) => d.fill('#ddd'))
draw(t)
let r1 = text('red').fontsize(24);
let r2 = text('blue').fontsize(24);
let r3 = square().fill('red');
let r4 = square().fill('blue');
let t = table.table([[r1,r2],[r3,r4]], 0.5)
t = t.apply_to_tagged_recursive([TAG.TABLE_CELL, TAG.ROW_+'0', TAG.COL_+'1'], (d) => d.fill('#ddd'))
draw(t)