Sidechair

table.cell_set_width()

Browse the reference

Sets a cell's width as a percent of the chart width; 0 lets the text decide.

Try it in the editor

A value of 10 makes the cell a tenth of the chart's width. 0 returns the cell to automatic width, sized to its text.

Cells in one column share a width, so the setting on one cell shapes the whole column. A merged cell spans the widths of the columns it covers.

Syntax

Pine Script
table.cell_set_width(table_id: series table, column: series int, row: series int, width: series int/float (optional)) -> void
table.cell_set_width(column: series int, row: series int, width: series int/float (optional)) -> void

Arguments

NameTypeDefaultDescription
table_idseries tablerequiredThe table that holds the cell whose width is set.
columnseries intrequiredColumn of the cell whose width is set, counting from 0 at the left.
rowseries intrequiredRow of the cell whose width is set, counting from 0 at the top.
widthseries int/float0Width as a percent of the chart width, for example 10. 0, the default, fits the text.

Returns

Nothing.

Example

Pine ScriptA value column with an adjustable widthOpen in editor
//@version=6
indicator("table.cell_set_width: value column", overlay = true)
w = input.float(10, "Value column width, % of chart", minval = 1, maxval = 40)
var t = table.new(position.top_left, 2, 1)
if barstate.islast
    table.cell(t, 0, 0, "Volume")
    table.cell(t, 1, 0, str.tostring(volume, format.volume))
    table.cell_set_width(t, 1, 0, w)

See also

Runs on Sidechair