Sets where text sits along a box's height: under the top border, in the middle or above the bottom border.
text.align_top places the text under the upper border, text.align_bottom above the lower one, and text.align_center in the middle. The effect shows when the box is taller than its text.
Together with the horizontal setting it pins the text to any of nine positions inside the box.
Syntax
box.set_text_valign(id: series box, text_valign: series string) -> void
box.set_text_valign(text_valign: series string) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box whose vertical text position changes. |
| text_valign | series string | required | text.align_top, text.align_center (default) or text.align_bottom. It has an effect only when the box is taller than its text. |
Returns
Nothing.
Remarks
- On Sidechair: vertical alignment is not applied yet, so a call reports a warning and the text stays in the middle.
Example
//@version=6
indicator("box.set_text_valign: caption at the floor", overlay = true)
if barstate.islast
z = box.new(bar_index - 30, ta.highest(high, 30), bar_index, ta.lowest(low, 30), bgcolor = color.new(color.green, 88), text = "Demand", text_color = color.green)
box.set_text_valign(z, text.align_bottom)See also
Not on Sidechair yet