Re-anchors an existing table to a different one of the nine screen positions without touching its cells.
The nine values are position.top_left, top_center, top_right, middle_left, middle_center, middle_right, bottom_left, bottom_center and bottom_right. Cells, colors and size stay as they were; only the anchor moves.
The position can change on any bar, so a table can follow a user setting or a condition. A table belongs to one slot at a time.
Syntax
table.set_position(table_id: series table, position: series string) -> void
table.set_position(position: series string) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| table_id | series table | required | The table that moves to another screen position. |
| position | series string | required | The new screen slot: a position.* constant such as position.bottom_left or position.middle_center. |
Returns
Nothing.
Example
//@version=6
indicator("table.set_position: corner input", overlay = true)
corner = input.string("Top right", "Table corner", options = ["Top left", "Top right", "Bottom left", "Bottom right"])
pos = switch corner
"Top left" => position.top_left
"Top right" => position.top_right
"Bottom left" => position.bottom_left
=> position.bottom_right
var t = table.new(position.top_right, 1, 1)
if barstate.islast
table.cell(t, 0, 0, "Panel")
table.set_position(t, pos)See also
Runs on Sidechair