Sets how the lines of a multi-line label line up with each other: left, center or right.
The alignment applies to each line of the text against the others, so it only matters when the text has line breaks. A one-line label looks the same under all three values.
Right alignment suits stacked numbers of different lengths, because the last digits line up in a column.
Syntax
label.set_textalign(id: series label, textalign: series string) -> void
label.set_textalign(textalign: series string) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series label | required | The label whose multi-line text alignment changes. The words and shape are not touched. |
| textalign | series string | required | text.align_left, text.align_center or text.align_right: how the lines of a multi-line label line up with each other. |
Returns
Nothing.
Remarks
- On Sidechair: the value is stored and returned unchanged, but every line is drawn centered, so
text.align_leftandtext.align_rightcurrently look liketext.align_center.
Example
//@version=6
indicator("label.set_textalign: OHLC column", overlay = true)
var label l = label.new(bar_index, high, "")
label.set_xy(l, bar_index, high)
label.set_text(l, "O " + str.tostring(open, "#.##") + "\nH " + str.tostring(high, "#.##") + "\nL " + str.tostring(low, "#.##") + "\nC " + str.tostring(close, "#.##"))
label.set_textalign(l, text.align_right)See also
Runs on Sidechair