Fuses a rectangular block of cells into one cell that spans several columns, rows or both.
table.merge_cells(t, 0, 0, 2, 0) turns the top row of a three-column table into one title cell. The block runs from the start column and row to the end column and row, both included, so (0, 0, 1, 1) merges a two-by-two square.
The merged cell takes the content and style of its top-left cell. The order does not matter: merge before or after filling the cells, as long as the block lies inside the table.
Syntax
table.merge_cells(table_id: series table, start_column: series int, start_row: series int, end_column: series int, end_row: series int) -> void
table.merge_cells(start_column: series int, start_row: series int, end_column: series int, end_row: series int) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| table_id | series table | required | The table whose cells are merged into one. |
| start_column | series int | required | Column of the block's top-left cell, counting from 0 at the left. |
| start_row | series int | required | Row of the block's top-left cell, counting from 0 at the top. |
| end_column | series int | required | Column of the block's bottom-right cell, counted from 0 and included in the merge. |
| end_row | series int | required | Row of the block's bottom-right cell, counted from 0 and included in the merge. |
Returns
Nothing.
Remarks
- Once merged, the block counts as a single cell, so no grid line from
table.set_border_width()crosses it.
Example
//@version=6
indicator("table.merge_cells: title row", overlay = true)
var t = table.new(position.top_right, 3, 2)
if barstate.isfirst
table.merge_cells(t, 0, 0, 2, 0)
table.cell(t, 0, 0, "Session stats", bgcolor = color.navy, text_color = color.white)
if barstate.islast
table.cell(t, 0, 1, str.tostring(close))See also
Runs on Sidechair