line

fun line(template: String): layerTooltips

Specifies the string template to use in the multi-line tooltip.

Parameters

template

A line template to add the tooltip with a label. Variables and aesthetics can be accessed via a special syntax:

  • ^color for aes

  • @year for variable

  • @{number of cylinders} for variable with spaces in the name

  • @{square m^2} for variable with spaces and '^' symbol in the name

  • @nameWith^ for the variable with '^' symbol in its name

A '^' symbol can be escaped with a backslash, a brace character in the literal text - by doubling:

  • .line("text") -> "text"

  • .line("{{text}}") -> "{text}"

  • .line("@model") -> "mustang"

  • .line("{{@model}}") -> "{mustang}"

The specified 'line' for outlier will move it to the general multi-line tooltip. The default tooltip has a label before the value, usually containing the name of the mapped variable. It has its own behaviour, like blank label for axis aesthetics. This default label can be set in template using a pair of symbols '@|'. The label can be overridden by specifying a string value before '|' symbol. Within the tooltip line the label is left-aligned, the formed by template string is right-aligned.

If a label is not specified, the string will be centered in the tooltip. For example:

  • line("^color"): no label, value is centered;

  • line("|^color"): label is empty, value is right-aligned;

  • line("@|^color"): default label is used, value is right-aligned;

  • line("my label|^color"): label is specified, value is right-aligned.