Table
Handle for a table drawing.
Static Methods
new
Table.new(
position: series Position,
columns: series int,
rows: series int,
bgcolor: series color = na,
frame_color: series color = na,
frame_width: series int = 0,
border_color: series color = na,
border_width: series int = 0,
force_overlay: series bool = false
): series TableCreates a table object on the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
position | series Position | 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
Static Properties
all
Returns an array filled with all the current tables drawn by the script.
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 TextHAlign | TextHAlign.Center | The horizontal text alignment. |
text_valign | series TextVAlign | TextVAlign.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 FontFamily | FontFamily.Default | The font family for the text. |
text_formatting | const TextFormat | text.NONE | The text formatting options. |
cell_set_bgcolor
Table.cell_set_bgcolor(
table_id: series Table,
column: series int,
row: series int,
bgcolor: series color
)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(
table_id: series Table,
column: series int,
row: series int,
height: series float
)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(
table_id: series Table,
column: series int,
row: series int,
text: series string
)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(
table_id: series Table,
column: series int,
row: series int,
text_color: series 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(
table_id: series Table,
column: series int,
row: series int,
text_font_family: series string
)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: FontFamily.Default or font.family_monospace. |
cell_set_text_formatting
Table.cell_set_text_formatting(
table_id: series Table,
column: series int,
row: series int,
text_formatting: const TextFormat
)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 TextFormat | The text formatting options. |
cell_set_text_halign
Table.cell_set_text_halign(
table_id: series Table,
column: series int,
row: series int,
text_halign: series string
)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(
table_id: series Table,
column: series int,
row: series int,
text_valign: series string
)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(
table_id: series Table,
column: series int,
row: series int,
tooltip: series string
)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(
table_id: series Table,
column: series int,
row: series int,
width: series float
)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(
table_id: series Table,
start_column: series int = 0,
start_row: series int = 0,
end_column: series int = na,
end_row: series int = 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(table_id: series Table)Deletes the table from the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series Table | The table to delete. |
merge_cells
Table.merge_cells(
table_id: series Table,
start_column: series int = 0,
start_row: series int = 0,
end_column: series int = na,
end_row: series int = 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(table_id: series Table, bgcolor: series color)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(table_id: series Table, border_color: series 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(table_id: series Table, border_width: series int)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(table_id: series Table, frame_color: series 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(table_id: series Table, frame_width: series int)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(table_id: series Table, position: series Position)Sets the position of the table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
table_id | series Table | The table object to modify. | |
position | series Position | The new position of the table on the chart. |