table
Properties
all
Type: series array<table>
Returns an array filled with all the current tables drawn by the script.
Functions
new
table.new(
series string position,
series int columns,
series int rows,
series color bgcolor = na,
series color frame_color = na,
series int frame_width = 0,
series color border_color = na,
series int border_width = 0,
series bool force_overlay = false
) → series tableCreates a table object on the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
position | series string | The position of the table on the chart (e.g., position.top_left, position.top_center, etc.). | |
columns | series int | The number of columns in the table. | |
rows | series int | The number of rows in the table. | |
bgcolor | series color | na | The background color of the table. |
frame_color | series color | na | The frame border color of the table. |
frame_width | series int | 0 | The frame border width in pixels. |
border_color | series color | na | The table border color. |
border_width | series int | 0 | The table border width in pixels. |
force_overlay | series bool | false | If true, the table is rendered on top. |
Returns: series table
Methods
cell
Sets the properties of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text | series string | "" | The text content of the cell. |
width | series float | 0 | The width of the cell in pixels. |
height | series float | 0 | The height of the cell in pixels. |
text_color | series color | color.black | The text color. |
text_halign | series string | text.align_center | The horizontal text alignment. |
text_valign | series string | text.align_center | The vertical text alignment. |
text_size | series int | 14 | The text size in pixels. |
bgcolor | series color | na | The background color of the cell. |
tooltip | series string | na | The tooltip text for the cell. |
text_font_family | series string | font.family_default | The font family for the text. |
text_formatting | const text_format | text.format_none | The text formatting options. |
cell_set_bgcolor
table.cell_set_bgcolor(
series table table_id,
series int column,
series int row,
series color bgcolor
)Sets the background color of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
bgcolor | series color | The new background color for the cell. |
cell_set_height
table.cell_set_height(
series table table_id,
series int column,
series int row,
series float height
)Sets the height of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
height | series float | The new height of the cell in pixels. |
cell_set_text
table.cell_set_text(
series table table_id,
series int column,
series int row,
series string text
)Sets the text of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text | series string | The new text content for the cell. |
cell_set_text_color
table.cell_set_text_color(
series table table_id,
series int column,
series int row,
series color text_color
)Sets the text color of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text_color | series color | The new text color for the cell. |
cell_set_text_font_family
table.cell_set_text_font_family(
series table table_id,
series int column,
series int row,
series string text_font_family
)Sets the font family of the text in a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text_font_family | series string | The font family: font.family_default or font.family_monospace. |
cell_set_text_formatting
table.cell_set_text_formatting(
series table table_id,
series int column,
series int row,
const text_format text_formatting
)Sets the text formatting of the text in a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text_formatting | const text_format | The text formatting options. |
cell_set_text_halign
table.cell_set_text_halign(
series table table_id,
series int column,
series int row,
series string text_halign
)Sets the horizontal alignment of the text in a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text_halign | series string | The horizontal text alignment: text.align_left, text.align_center, or text.align_right. |
cell_set_text_size
Sets the text size of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text_size | series int | The new text size in pixels. |
cell_set_text_valign
table.cell_set_text_valign(
series table table_id,
series int column,
series int row,
series string text_valign
)Sets the vertical alignment of the text in a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
text_valign | series string | The vertical text alignment: text.align_top, text.align_center, or text.align_bottom. |
cell_set_tooltip
table.cell_set_tooltip(
series table table_id,
series int column,
series int row,
series string tooltip
)Sets the tooltip of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
tooltip | series string | The new tooltip text for the cell. |
cell_set_width
table.cell_set_width(
series table table_id,
series int column,
series int row,
series float width
)Sets the width of a specific cell in a table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
column | series int | The column index of the cell (0-based). | |
row | series int | The row index of the cell (0-based). | |
width | series float | The new width of the cell in pixels. |
clear
table.clear(
series table table_id,
series int start_column = 0,
series int start_row = 0,
series int end_column = na,
series int end_row = na
)Clears the contents of the specified range of cells in the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table to modify. | |
start_column | series int | 0 | The starting column index. |
start_row | series int | 0 | The starting row index. |
end_column | series int | na | The ending column index. When na, denotes last column. |
end_row | series int | na | The ending row index. When na, denotes last row. |
delete
table.delete(series table table_id)Deletes the table from the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table to delete. |
merge_cells
table.merge_cells(
series table table_id,
series int start_column = 0,
series int start_row = 0,
series int end_column = na,
series int end_row = na
)Merges the specified range of cells in the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table to modify. | |
start_column | series int | 0 | The starting column index. |
start_row | series int | 0 | The starting row index. |
end_column | series int | na | The ending column index. When na, denotes last column. |
end_row | series int | na | The ending row index. When na, denotes last row. |
set_bgcolor
table.set_bgcolor(series table table_id, series color bgcolor)Sets the background color of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
bgcolor | series color | The new background color of the table. |
set_border_color
table.set_border_color(series table table_id, series color border_color)Sets the border color of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
border_color | series color | The new border color of the table. |
set_border_width
table.set_border_width(series table table_id, series int border_width)Sets the border width of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
border_width | series int | The new border width in pixels. |
set_frame_color
table.set_frame_color(series table table_id, series color frame_color)Sets the frame color of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
frame_color | series color | The new frame border color of the table. |
set_frame_width
table.set_frame_width(series table table_id, series int frame_width)Sets the frame width of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
frame_width | series int | The new frame border width in pixels. |
set_position
table.set_position(series table table_id, series string position)Sets the position of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series table | The table object to modify. | |
position | series string | The new position of the table on the chart. |