Class: Tooltip

Tooltip

A floating tooltip instance. This is a plugin that responds to interaction State and displays a DOM element on the screen next to the cursor. The element will display the price of every plot on the chart as of the date of the bar the cursor is hovering over. Tooltip is a plugin. To use it, you must add "tooltip" to the InteractionConfig plugins array.

Since:
  • 9.8.0 Introduced
  • 10.1.0 Added formatting using yAxis.formatter

Type Definitions


TooltipConfig

UI tooltip configuration. Configures the tooltip plugin that displays a floating DOM element with the prices of the plots as of the bar the cursor is hovering over.

Type:
Properties:
Name Type Argument Description
export string <optional>

Name of the exported class, usually "Tooltip".

displayMapping Record.<string, (Record.<string, string>|undefined)> <optional>

Allows specification of custom labels to display in the tooltip area in lieu of the standard field names. Using the key global allows the value mapping to apply to all plots. Using a key matching a plot name restricts the mapping to that plot name. You can use handlebars ({{xxx}}) to reference a study input. See example for details.

Since:
  • 9.8.0

Example

Use handlebars to reference a study name in a `displayMapping`:

displayMapping: {
	...
 // instead of showing "ma 1", "ma 2", "ma 3" in the tooltip, now it will show "ma 10", "ma 50", "ma 200" (assuming these 3 values are the maCross input values).
	maCross: {
		"ma 1": "ma\u200c{{MA 1 Period}}",
		"ma 2": "ma\u200c{{MA 2 Period}}",
		"ma 3": "ma\u200c{{MA 3 Period}}"
	}
}