Switches one cell between the default typeface and a monospace face with equal-width digits.
font.family_monospace gives every character the same width, which keeps columns of figures lined up from row to row. font.family_default restores the ordinary face.
Only the cell you name changes, so mix a monospace value column with a normal label column.
Syntax
table.cell_set_text_font_family(table_id: series table, column: series int, row: series int, text_font_family: series string) -> void
table.cell_set_text_font_family(column: series int, row: series int, text_font_family: series string) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| table_id | series table | required | The table that holds the cell whose typeface changes. |
| column | series int | required | Column of the cell whose typeface changes, counting from 0 at the left. |
| row | series int | required | Row of the cell whose typeface changes, counting from 0 at the top. |
| text_font_family | series string | required | font.family_default for the ordinary face, or font.family_monospace for equal-width characters. |
Returns
Nothing.
Example
//@version=6
indicator("table.cell_set_text_font_family: figures", overlay = true)
var t = table.new(position.top_right, 2, 2)
if barstate.islast
table.cell(t, 0, 0, "Close")
table.cell(t, 1, 0, str.tostring(close, "#.00"), text_halign = text.align_right)
table.cell(t, 0, 1, "Volume")
table.cell(t, 1, 1, str.tostring(volume, "#"), text_halign = text.align_right)
table.cell_set_text_font_family(t, 1, 0, font.family_monospace)
table.cell_set_text_font_family(t, 1, 1, font.family_monospace)See also
Runs on Sidechair