Tooltip
The tooltip extension is a feature that allows you to customize the behavior and appearance of tooltips displayed when users interact with chart elements. Tooltips provide additional information about a data point when the user hovers over or taps on it.
Namespace: options.plugins.tooltip
Enabled¶
Are on-canvas tooltips enabled? Default true
External¶
Mode¶
Sets which elements appear in the tooltip. Default interaction.mode
Intersect¶
If true
, the tooltip mode applies only when the mouse position intersects with an element.
If false
, the mode will be applied at all times. Default interaction.intersect
Position¶
The mode for positioning the tooltip. Default 'average'
ItemSort¶
Sort tooltip items. Default function
Filter¶
Filter tooltip items. Default function
BackgroundColor¶
Background color of the tooltip.
TitleColor¶
Color of title text. Default '#fff'
TitleFont¶
TitleAlign¶
Horizontal alignment of the title text lines. Default 'left'
TitleSpacing¶
Spacing to add to top and bottom of each title line. Default 2
TitleMarginBottom¶
Margin to add on bottom of title section. Default 6
BodyColor¶
Color of body text. defautl '#fff'
BodyFont¶
BodyAlign¶
Horizontal alignment of the body text lines. Default 'left'
BodySpacing¶
Spacing to add to top and bottom of each tooltip item. Default 2
FooterColor¶
Color of footer text. Default '#fff'
FooterFont¶
FooterAlign¶
Horizontal alignment of the footer text lines. Default 'left'
FooterSpacing¶
Spacing to add to top and bottom of each footer line. Default 2
FooterMarginTop¶
Margin to add before drawing the footer. Default 6
Padding¶
Padding inside the tooltip. Default 6
CaretPadding¶
Extra distance to move the end of the tooltip arrow away from the tooltip point. Default 2
CaretSize¶
Size, in px, of the tooltip arrow. Default 5
CornerRadius¶
Radius of tooltip corner curves. Default 6
MultiKeyBackground¶
Color to draw behind the colored boxes when multiple items are in the tooltip. Default '#fff'
DisplayColors¶
If true
, color boxes are shown in the tooltip. Default true
BoxWidth¶
Width of the color box if displayColors is true
. Default bodyFont.size
BoxHeight¶
Height of the color box if displayColors is true
. Default bodyFont.size
BoxPadding¶
Padding between the color box and the text. Default 1
UsePointStyle¶
Use the corresponding point style (from dataset options) instead of color boxes, ex: star, triangle etc.
(size is based on the minimum value between boxWidth
and boxHeight
). Default false
BorderColor¶
BorderWidth¶
Size of the border. Default 0
Rtl¶
true
for rendering the tooltip from right to left.
TextDirection¶
This will force the text direction 'rtl'
or 'ltr'
on the canvas for rendering the tooltips,
regardless of the css specified on the canvas.
XAlign¶
Position of the tooltip caret in the X direction.
YAlign¶
Position of the tooltip caret in the Y direction.
Callbacks¶
Namespace: options.plugins.tooltip.callbacks
, the tooltip has the following callbacks for providing text.
For all functions, this
will be the tooltip object created from the Tooltip
constructor.
If the callback returns undefined
, then the default callback will be used. To remove things from the tooltip callback should return an empty string.
BeforeTitle¶
Returns the text to render before the title.
Title¶
Returns text to render as the title of the tooltip.
AfterTitle¶
Returns text to render after the title.
BeforeBody¶
Returns text to render before the body section.
BeforeLabel¶
Returns text to render before an individual label. This will be called for each item in the tooltip.
Label¶
Returns text to render for an individual item in the tooltip.
LabelColor¶
Returns the colors to render for the tooltip item.
LabelTextColor¶
Returns the colors for the text of the label for the tooltip item.
LabelPointStyle¶
Returns the point style to use instead of color boxes if usePointStyle is true (object with values pointStyle and rotation). Default implementation uses the point style from the dataset points.
AfterLabel¶
Returns text to render after an individual label.
AfterBody¶
Returns text to render after the body section.
BeforeFooter¶
Returns text to render before the footer section.
Footer¶
Returns text to render as the footer of the tooltip.
AfterFooter¶
Text to render after the footer section.