Text alignment, wrapping and formatting options for labels, boxes and table cells: text.align_*, text.wrap_* and text.format_*.
text.align_left, text.align_center and text.align_right set horizontal alignment; text.align_top, text.align_center and text.align_bottom set vertical alignment. They go in label.new's textalign, box.new's text_halign and text_valign, and table.cell's text_halign and text_valign. text.align_center works for both directions.
text.wrap_auto wraps text to fit the width of the box or cell; text.wrap_none keeps it on one line and clips it. text.format_bold, text.format_italic and text.format_none go in the text_formatting argument. To get bold and italic together, add them: text.format_bold + text.format_italic.
Constants
| Name | Value | Description |
|---|---|---|
text.align_bottom | Align to the bottom edge. | |
text.align_center | Centre, horizontally or vertically. | |
text.align_left | Align to the left edge. | |
text.align_right | Align to the right edge. | |
text.align_top | Align to the top edge. | |
text.format_bold | Bold text. | |
text.format_italic | Italic text. | |
text.format_none | No formatting; the default. | |
text.wrap_auto | Wrap text to fit the available width. | |
text.wrap_none | Keep the text on one line. |
Remarks
text.format_noneturns formatting off; it is the default.- On Sidechair:
label.newreads textalign.
Example
//@version=6
indicator("Text options", overlay = true)
if barstate.islast
label.new(bar_index, high, "last\nbar", textalign = text.align_right, style = label.style_label_left, color = color.navy, textcolor = color.white)
plot(close, "Close", color.gray)See also
Runs on Sidechair