Sets the pop-up text that appears when the pointer rests on a label.
A tooltip is the place for detail that would crowd the label itself: the values behind a signal, the rule that fired, or a timestamp. It is stored apart from the label text, so changing one leaves the other alone.
Pass an empty string to remove the tooltip. \n starts a new line inside it.
Syntax
label.set_tooltip(id: series label, tooltip: series string) -> void
label.set_tooltip(tooltip: series string) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series label | required | The label whose hover text changes. The visible text is not touched. |
| tooltip | series string | required | The hover text for the label. An empty string removes it, and \n starts a new line inside the pop-up. |
Returns
Nothing.
Remarks
- On Sidechair: the tooltip is stored on the label but no hover text is drawn on the chart, so put anything the reader must see in the label text.
Example
//@version=6
indicator("label.set_tooltip: recent closes", overlay = true)
var label l = label.new(bar_index, high, "i")
label.set_xy(l, bar_index, high)
label.set_tooltip(l, "close " + str.tostring(close) + "\nprev " + str.tostring(close[1]) + "\nbefore " + str.tostring(close[2]))See also
Runs on Sidechair