table
Tables in a corner of the pane.
#Functions
#table.cellfunction
Sets a cell: its text and look (width / height in % of the pane, 0 = automatic).
table.cell(table_id: table, column: int, row: int, { text?: string = "", width?: float = 0, height?: float = 0, text_color?: color = color.black, text_halign?: string = text.align_center, text_valign?: string = text.align_center, text_size?: string = size.normal, bgcolor?: color = na, tooltip?: string = "", text_font_family?: string = font.family_default, text_formatting?: int = text.format_none, look?: const string = "" })| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text | stringdefault "" | Text drawn with the shape. |
width | floatdefault 0 | The width. |
height | floatdefault 0 | The height. |
text_color | colordefault color.black | The text color. |
text_halign | stringdefault text.align_center | The text halign. |
text_valign | stringdefault text.align_center | The text valign. |
text_size | stringdefault size.normal | The text size. |
bgcolor | colordefault na | The bgcolor. |
tooltip | stringdefault "" | Help text shown next to the input. |
text_font_family | stringdefault font.family_default | The text font family. |
text_formatting | intdefault text.format_none | The text formatting. |
look | const stringdefault "" | A style made with style.cell (its look, shared and user-editable). Without one the drawing still follows the Labels & text tab (size, font, dimming). |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell(0, 0, "Close")Since ChartScript 1
#table.cell_set_bgcolorfunction
Sets a cell's background.
table.cell_set_bgcolor(table_id: table, column: int, row: int, color: color)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
color | color | The colour. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_bgcolor(0, 0, color.blue)Since ChartScript 1
#table.cell_set_heightfunction
Sets a cell's height (% of the pane).
table.cell_set_height(table_id: table, column: int, row: int, height: float)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
height | float | The height. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_height(0, 0, 5)Since ChartScript 1
#table.cell_set_textfunction
Sets a cell's text.
table.cell_set_text(table_id: table, column: int, row: int, text: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text | string | Text drawn with the shape. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text(0, 0, "x")Since ChartScript 1
#table.cell_set_text_colorfunction
Sets a cell's text colour.
table.cell_set_text_color(table_id: table, column: int, row: int, text_color: color)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text_color | color | The text color. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text_color(0, 0, color.white)Since ChartScript 1
#table.cell_set_text_font_familyfunction
Sets a cell's font.
table.cell_set_text_font_family(table_id: table, column: int, row: int, text_font_family: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text_font_family | string | The text font family. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text_font_family(0, 0, font.family_monospace)Since ChartScript 1
#table.cell_set_text_formattingfunction
Bold / italic in a cell.
table.cell_set_text_formatting(table_id: table, column: int, row: int, text_formatting: int)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text_formatting | int | The text formatting. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text_formatting(0, 0, text.format_bold)Since ChartScript 1
#table.cell_set_text_halignfunction
Sets a cell's horizontal alignment.
table.cell_set_text_halign(table_id: table, column: int, row: int, text_halign: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text_halign | string | The text halign. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text_halign(0, 0, text.align_left)Since ChartScript 1
#table.cell_set_text_sizefunction
Sets a cell's text size.
table.cell_set_text_size(table_id: table, column: int, row: int, text_size: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text_size | string | The text size. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text_size(0, 0, size.small)Since ChartScript 1
#table.cell_set_text_valignfunction
Sets a cell's vertical alignment.
table.cell_set_text_valign(table_id: table, column: int, row: int, text_valign: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
text_valign | string | The text valign. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_text_valign(0, 0, text.align_top)Since ChartScript 1
#table.cell_set_tooltipfunction
Sets a cell's hover text.
table.cell_set_tooltip(table_id: table, column: int, row: int, tooltip: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
tooltip | string | Help text shown next to the input. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_tooltip(0, 0, "t")Since ChartScript 1
#table.cell_set_widthfunction
Sets a cell's width (% of the pane).
table.cell_set_width(table_id: table, column: int, row: int, width: float)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
column | int | The column. |
row | int | The row. |
width | float | The width. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.cell_set_width(0, 0, 10)Since ChartScript 1
#table.clearfunction
Empties a rectangle of cells (one cell when the end is na).
table.clear(table_id: table, start_column: int, start_row: int, { end_column?: int = na, end_row?: int = na })| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
start_column | int | The start column. |
start_row | int | The start row. |
end_column | intdefault na | The end column. |
end_row | intdefault na | The end row. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.clear(0, 0, 1, 1)Since ChartScript 1
#table.deletefunction
Removes the table.
table.delete(table_id: table)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.delete()Since ChartScript 1
#table.merge_cellsfunction
Merges a rectangle of cells into the first one.
table.merge_cells(table_id: table, start_column: int, start_row: int, end_column: int, end_row: int)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
start_column | int | The start column. |
start_row | int | The start row. |
end_column | int | The end column. |
end_row | int | The end row. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.merge_cells(0, 0, 1, 0)Since ChartScript 1
#table.newfunction
A table in a corner of the pane (position.*), one per position (9). The member can dock a script's tables in the bottom panel and copy their text.
table.new(position: string, columns: int, rows: int, { bgcolor?: color = na, frame_color?: color = na, frame_width?: int = 0, border_color?: color = na, border_width?: int = 0, force_overlay?: const bool = false, look?: const string = "" }): table| Parameter | Type | Description |
|---|---|---|
position | string | The position. |
columns | int | The columns. |
rows | int | The rows. |
bgcolor | colordefault na | The bgcolor. |
frame_color | colordefault na | The frame color. |
frame_width | intdefault 0 | The frame width. |
border_color | colordefault na | The border color. |
border_width | intdefault 0 | The border width. |
force_overlay | const booldefault false | Accepted and ignored in this version. |
look | const stringdefault "" | A style made with style.table (its look, shared and user-editable). Without one the drawing still follows the Labels & text tab (size, font, dimming). |
Returns table.
Example
state tb = table.new(position.top_right, 2, 2)Since ChartScript 1
#table.set_bgcolorfunction
Sets the background.
table.set_bgcolor(table_id: table, bgcolor: color)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
bgcolor | color | The bgcolor. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.set_bgcolor(color.black)Since ChartScript 1
#table.set_border_colorfunction
Sets the cell border colour.
table.set_border_color(table_id: table, border_color: color)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
border_color | color | The border color. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.set_border_color(color.gray)Since ChartScript 1
#table.set_border_widthfunction
Sets the cell border width.
table.set_border_width(table_id: table, border_width: int)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
border_width | int | The border width. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.set_border_width(1)Since ChartScript 1
#table.set_frame_colorfunction
Sets the frame colour.
table.set_frame_color(table_id: table, frame_color: color)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
frame_color | color | The frame color. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.set_frame_color(color.gray)Since ChartScript 1
#table.set_frame_widthfunction
Sets the frame width.
table.set_frame_width(table_id: table, frame_width: int)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
frame_width | int | The frame width. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.set_frame_width(1)Since ChartScript 1
#table.set_positionfunction
Moves the table to another corner.
table.set_position(table_id: table, position: string)| Parameter | Type | Description |
|---|---|---|
table_id | table | The table id. |
position | string | The position. |
Example
state tb = table.new(position.top_right, 2, 2)
tb.set_position(position.bottom_left)Since ChartScript 1
#Variables
#table.allvariable
Every table of the script that still exists.
table.all: array<table>Type series array<table>.
Example
const n = array.size(table.all)Since ChartScript 1