> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tables

> Showing a grid of text on the chart with table.new and table.cell, positioning it, changing cells, and filling it once on the last bar.

A table is a fixed grid of text cells pinned to a corner or edge of the chart, not to a price or bar. Use one for a summary: a
few statistics, a legend, a status.

## Create and fill

`table.new(position, columns, rows, bgcolor, frame_color, frame_width, border_color, border_width, force_overlay)` creates the table.
`position` is `position.top_left`, `top_center`, `top_right`, `middle_left`, `middle_center`, `middle_right`, `bottom_left`,
`bottom_center` or `bottom_right`. `table.cell(table, column, row, text, width, height, textcolor, texthalign, textvalign, size,
bgcolor, tooltip, ...)` sets a cell; columns and rows count from 0. A cell outside the table is ignored.

Create the table once, in a `static` variable, and fill it only on the last bar, where the values are final:

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Range table", overlay=true)
static table t = table.new(position.top_right, 2, 3, bgcolor=color.new(color.gray, 0.8), border_width=1)
if barstate.islast {
    table.cell(t, 0, 0, "High")
    table.cell(t, 1, 0, str.tostring(high), textcolor=color.green)
    table.cell(t, 0, 1, "Low")
    table.cell(t, 1, 1, str.tostring(low), textcolor=color.red)
    table.cell(t, 0, 2, "Volume")
    table.cell(t, 1, 2, str.tostring(volume))
}
```

Calling `table.cell` again on the same cell replaces its content.

## Change a table

* Cells: `table.cell_set_text`, `cell_set_bgcolor`, `cell_set_text_color`, `cell_set_text_size`, `cell_set_text_halign`,
  `cell_set_text_valign`, `cell_set_width`, `cell_set_height`, `cell_set_tooltip`, each taking the table, the column and the row first.
* Whole table: `table.set_position`, `set_bgcolor`, `set_frame_color`, `set_frame_width`, `set_border_color`, `set_border_width`.
* `table.merge_cells(table, start_column, start_row, end_column, end_row)` joins a block; `table.clear(...)` empties a block of
  cells; `table.delete(table)` removes the table.

The functions work as methods too: `t.cell(0, 0, "x")`.

## Limits

There is room for one table per position: nine in all. A new table at a position that already has one deletes the old one, so a
script that makes a table on every bar keeps only the last. The limit cannot be changed. Cell text is limited to 999 characters.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.