AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.ui.Tooltip Improve this Doc

Extends: anychart.core.VisualBase

Class for the tooltip.

Methods Overview

Specific settings
allowLeaveChart()Tooltip allowLeaveChart settings.
allowLeaveScreen()Tooltip allowLeaveScreen settings.
allowLeaveStage()Tooltip allowLeaveStage settings.
displayMode()Display mode settings.
format()Function to format content text.
hide()Hides tooltips with delay.
hideDelay()Hide delay settings.
titleFormat()Function to format title text.
unionFormat()Function to format content text.
valuePostfix()Postfix settings.
valuePrefix()Prefix settings.
Content Text Settings
disablePointerEvents()Pointer events settings.
fontColor()Font color settings.
fontDecoration()Font decoration setting.
fontFamily()Font family settings.
fontOpacity()Font opacity settings.
fontSize()Font size settings.
fontStyle()Font style settings.
fontVariant()Font variant settings.
fontWeight()Font weight settings.
hAlign()Text horizontal align settings.
letterSpacing()Text letter spacing settings.
lineHeight()Text line height setting.
selectable()Text selectable option.
textDirection()Text direction settings.
textIndent()Text indent settings.
textOverflow()Text overflow settings.
textSettings()Font opacity setting.
useHtml()Enable/Disable HTML tooltip.
vAlign()Text vertical align settings.
wordBreak()Word break mode.
wordWrap()Word-wrap mode.
Events
listen()Adds an event listener
listenOnce()Adds a single time event listener
onBeforeContentChange()onBeforeContentChange handler.
onBeforeTitleChange()onBeforeTitleChange handler.
onContentChanged()onContentChanged handler.
onDomReady()onDomReady handler.
onTitleChanged()onTitleChanged handler.
removeAllListeners()Removes all listeners
unlisten()Removes the listener
unlistenByKey()Removes the listener by the key
Export
print()Prints all elements.
Interactivity
enabled()Element state (enabled or disabled).
Size and Position
anchor()Anchor settings.
height()Tooltip height.
offsetX()X offset settings.
offsetY()Y offset settings.
padding()Padding settings.
position()Position settings.
positionMode()Position mode settings.
width()Tooltip width.
zIndex()Z-index of the element.
Text Settings
adjustFontSize()Adjusting settings.
maxFontSize()Maximum font size settings.
minFontSize()Minimum font size settings.
Visual settings
background()Background settings.
separator()Separator settings.
title()Title settings.

Methods Description

adjustFontSize

Getter for the adjusting font size.

Returns:

number - An adjusted font size.
See listing
var tooltip = chart.tooltip();
var adjustFontSize = tooltip.adjustFontSize();
Setter for the adjusting font size.

Params:

NameTypeDescription
adjustOrAdjustByWidthboolean | Array.<boolean> | ObjectIs font needs to be adjusted in case of 1 argument and adjusted by width in case of 2 arguments.
adjustByHeightbooleanIs font needs to be adjusted by height.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

allowLeaveChart

Getter for the allowLeaveChart tooltip mode.

Returns:

boolean - Boolean value.
See listing
var tooltipSettings = chart.tooltip();
var value = tooltipSettings.allowLeaveChart();
Setter for the allowLeaveChart tooltip mode.

Params:

NameTypeDefaultDescription
enabledboolean
true
Allow or forbid tooltip to leave chart when moving.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

allowLeaveScreen

Getter for the allowLeaveScreen tooltip mode.

Returns:

boolean - Boolean value.
See listing
var tooltipSettings = chart.tooltip();
var value = tooltipSettings.allowLeaveScreen();
Setter for the allowLeaveScreen tooltip mode.

Params:

NameTypeDefaultDescription
enabledboolean
false
Allow or forbid tooltip to leave screen when moving.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

allowLeaveStage

Getter for the allowLeaveStage tooltip mode.

Returns:

boolean - Boolean value.
See listing
var tooltipSettings = chart.tooltip();
var value = tooltipSettings.allowLeaveStage();
Setter for the allowLeaveStage tooltip mode.

Params:

NameTypeDefaultDescription
enabledboolean
false
Allow or forbid tooltip to leave stage when moving.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

anchor

Getter for the tooltip anchor.

Returns:

anychart.enums.Anchor | string - Tooltip anchor settings.
See listing
var tooltip = chart.tooltip();
var anchor = tooltip.anchor();
Setter for the tooltip anchor.

Params:

NameTypeDefaultDescription
anchoranychart.enums.Anchor | string
'left-top'
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

background

Getter for tooltip background settings.

Returns:

anychart.core.ui.Background - Background settings.
See listing
var tooltip = chart.tooltip();
var background = tooltip.background();
Setter for tooltip background settings.

Params:

NameTypeDescription
settingsnull | boolean | Object | stringBackground settings.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

disablePointerEvents

Getter for the pointer events settings.

Returns:

boolean - The pointer events settings.
See listing
var tooltip = chart.tooltip();
var disablePointerEvents = tooltip.disablePointerEvents();
Setter for the pointer events setting.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

displayMode

Getter for display mode settings.

Returns:

anychart.enums.TooltipDisplayMode | string - Display mode.
See listing
var tooltip = chart.tooltip();
var displayMode = tooltip.displayMode();
Setter for display mode settings. Note: Works only for the chart tooltip.

Params:

NameTypeDefaultDescription
valueanychart.enums.TooltipDisplayMode | string
'single'
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

enabled

Getter for the element state (enabled or disabled).

Returns:

boolean - Element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
enabledboolean
true
Enabled state to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.
Example.
if (!element.enabled())
   element.enabled(true);

fontColor

Getter for font color settings.

Returns:

string - Font color settings.
See listing
var tooltip = chart.tooltip();
var fontColor = tooltip.fontColor();
Setter for font color settings.

Params:

NameTypeDescription
colorstringFont color to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontDecoration

Getter for font decoration settings.

Returns:

anychart.graphics.vector.Text.Decoration - Font decoration settings.
See listing
var tooltip = chart.tooltip();
var fontDecoration = tooltip.fontDecoration();
Setter for font decoration settings.

Params:

NameTypeDescription
valueanychart.graphics.vector.Text.Decoration | stringFont decoration to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontFamily

Getter for font family settings.

Returns:

string - Font family settings.
See listing
var tooltip = chart.tooltip();
var fontFamily = tooltip.fontFamily();
Setter for font family settings.

Params:

NameTypeDescription
familystringFont family to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontOpacity

Getter for font opacity settings.

Returns:

number - Font opacity settings.
See listing
var tooltip = chart.tooltip();
var fontOpacity = tooltip.fontOpacity();
Setter for font opacity settings.

Params:

NameTypeDescription
opacitynumberFont opacity to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontSize

Getter for font size settings.

Returns:

number - Font size settings.
See listing
var tooltip = chart.tooltip();
var fontSize = tooltip.fontSize();
Setter for font size settings.

Params:

NameTypeDescription
sizenumber | stringFont size to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontStyle

Getter for font style settings.

Returns:

anychart.graphics.vector.Text.FontStyle - Font style settings.
See listing
var tooltip = chart.tooltip();
var fontStyle = tooltip.fontStyle();
Setter for font style settings.

Params:

NameTypeDescription
stylestring | anychart.graphics.vector.Text.FontStyleFont style to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontVariant

Getter for font variant settings.

Returns:

anychart.graphics.vector.Text.FontVariant - Font variant settings.
See listing
var tooltip = chart.tooltip();
var fontVariant = tooltip.fontVariant();
Setter for font variant settings.

Params:

NameTypeDescription
valuestring | anychart.graphics.vector.Text.FontVariantFont variant to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

fontWeight

Getter for font weight settings.

Returns:

string | number - Font weight settings.
See listing
var tooltip = chart.tooltip();
var fontWeight = tooltip.fontWeight();
Setter for font weight settings.

Params:

NameTypeDescription
weightstring | numberFont weight to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

format

Getter for the function content text for the tooltip.

Returns:

function | string - Function to format title text.
See listing
var tooltipSettings = chart.tooltip();
var format = tooltipSettings.format();
Setter for function content text for the tooltip.
Learn more about using the format() method.

Params:

NameTypeDescription
formatfunction | stringFunction or string token to format content text.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

hAlign

Getter for text horizontal align settings.

Returns:

anychart.graphics.vector.Text.HAlign - Horizontal align settings.
See listing
var tooltip = chart.tooltip();
var hAlign = tooltip.hAlign();
Setter for the text horizontal align settings.

Params:

NameTypeDescription
alignstring | anychart.graphics.vector.Text.HAlignHorizontal align to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

height

Getter for the tooltip height.

Returns:

string | number - Tooltip height.
See listing
var tooltipSettings = chart.tooltip();
var height = tooltipSettings.height();
Setter for the tooltip height.

Params:

NameTypeDescription
heightstring | numberTooltip height to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

hide

Hides tooltips with delay.

Params:

NameTypeDescription
forcebooleanIgnore tooltips hide delay.
eventanychart.core.MouseEventEvent that initiate tooltip hiding.

Returns:

boolean - Returns true if the tooltip was hidden.

hideDelay

Getter for delay in milliseconds before union tooltip item becomes hidden.

Returns:

number - Hide delay settings.
See listing
var tooltip = chart.tooltip();
var hideDelay = tooltip.hideDelay();
Setter for the delay in milliseconds before a tooltip becomes hidden.

Params:

NameTypeDefaultDescription
delaynumber
0
Delay in milliseconds.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

letterSpacing

Getter for text letter spacing settings.

Returns:

number - Letter spacing settings.
See listing
var tooltip = chart.tooltip();
var letterSpacing = tooltip.letterSpacing();
Setter for text letter spacing settings.

Params:

NameTypeDescription
spacingnumberValue to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

lineHeight

Getter for text line height settings.

Returns:

number | string - Line height settings.
See listing
var tooltip = chart.tooltip();
var lineHeight = tooltip.lineHeight();
Setter for text line height settings.

Params:

NameTypeDefaultDescription
heightnumber | string
'normal'
Line height to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method. Function that looks like:
function(event){
   // event.actualTarget - actual event target
   // event.currentTarget - current event target
   // event.iterator - event iterator
   // event.originalEvent - original event
   // event.point - event point
   // event.pointIndex - event point index
}
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object)
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

maxFontSize

Getter for maximum font size settings for adjust text from.

Returns:

number - Maximum font size.
See listing
var tooltip = chart.tooltip();
var maxFontSize = tooltip.maxFontSize();
Setter for maximum font size settings for adjust text from.

Params:

NameTypeDefaultDescription
sizenumber | string
9
Maximum font size to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

minFontSize

Getter for minimum font size settings for adjust text from.

Returns:

number - Minimum font size.
See listing
var tooltip = chart.tooltip();
var minFontSize = tooltip.minFontSize();
Setter for minimum font size settings for adjust text from.

Params:

NameTypeDefaultDescription
sizenumber | string
9
Minimum font size to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

offsetX

Getter for the tooltip offset by X.

Returns:

number - Tooltip offset by X.
See listing
var tooltip = chart.tooltip();
var offsetX = tooltip.offsetX();
Setter for union tooltip offsetX.

Params:

NameTypeDescription
offsetnumberOffset by X to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

offsetY

Getter for the tooltip offset by Y.

Returns:

number - Tooltip offset by Y.
See listing
var tooltip = chart.tooltip();
var offsetY = tooltip.offsetY();
Setter for the tooltip offset by Y.

Params:

NameTypeDescription
offsetnumberOffset by Y to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

onBeforeContentChange

Getter for the onBeforeContentChange handler.

Returns:

function():boolean - Handler function.
Setter for the onBeforeContentChange handler.
Enable HTML-mode for the tooltip with tooltip.useHtml(true) to work with onBeforeContentChange().

The handler is called before changes are applied.
The handler determines whether to change the content.
If the handler returns true, then the content is changed and the handler passed to onContentChanged() is called.
If the handler returns false the content is not changed and the handler passed to onTitleChanged() will never be called.

See the structure of HTML-tooltip elements in the useHtml() method.

Params:

NameTypeDescription
handlerfunction():booleanHandler function. Function that looks like
function(){
Handler context contains following fields:
// this.parentElement - reference to the basic HTML-element. The parent DIV of the entire element
// this.titleElement - reference to the title DIV
// this.separatorElement - reference to HR-element, tooltip separator
// this.contentElement - reference to the DIV of the tooltip content
return booleanFlag // type boolean. If the handler returns true then the content is changed. If the handler returns false then the content is not changed.
}

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

onBeforeTitleChange

Getter for the onBeforeTitleChange handler.

Returns:

function():boolean - Handler function.
Setter for the onBeforeTitleChange handler.
Enable HTML-mode for the tooltip with tooltip.useHtml(true) to work with onBeforeTitleChange().

The handler is called before changes are applied.
The handler determines whether to change the title.
If the handler returns true, then the title is changed and the handler passed to onTitleChanged() is called.
If the handler returns false the title is not changed and the handler passed to onTitleChanged() will never be called.

See the structure of HTML-tooltip elements in the useHtml() method.

Params:

NameTypeDescription
handlerfunction():booleanHandler function. Function that looks like
function(){
Handler context contains following fields:
// this.parentElement - reference to the basic HTML-element. The parent DIV of the entire element
// this.titleElement - reference to the title DIV
// this.separatorElement - reference to HR-element, tooltip separator
// this.contentElement - reference to the DIV of the tooltip content
return booleanFlag // type boolean. If the handler returns true then the title is changed. If the handler returns false then the title is not changed.
}

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

onContentChanged

Getter for the onContentChanged handler.

Returns:

function - Handler function.
Setter for the onContentChanged handler.
Enable HTML-mode for the tooltip with tooltip.useHtml(true) to work with onContentChanged().

The method informs that the content has been changed.
The onContentChanged() method is called only if the onBeforeContentChange() method returns true.

See the structure of HTML-tooltip elements in the useHtml() method.

Params:

NameTypeDescription
handlerfunctionHandler function. Function that looks like
function(){
Handler context contains following fields:
// this.parentElement - reference to the basic HTML-element. The parent DIV of the entire element
// this.titleElement - reference to the title DIV
// this.separatorElement - reference to HR-element, tooltip separator
// this.contentElement - reference to the DIV of the tooltip content
}

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

onDomReady

Getter for the onDomReady handler.

Returns:

function - Handler function.
Setter for the onDomReady handler.
Enable HTML-mode for the tooltip with tooltip.useHtml(true) to work with onDomReady().

The handler set from the onDomReady() method is called once when all elements of the HTML-tooltip have been created.
The handler set from the onDomReady() method is called for each tooltip on the chart. Setting the onDomReady() handler to a chart calls a handler for each tooltip on the chart (for example, several tooltips for separated mode).

See the structure of HTML-tooltip elements in the useHtml() method.

Params:

NameTypeDescription
handlerfunctionHandler function. Function that looks like
function(){
Handler context contains following fields:
// this.parentElement - reference to the basic HTML-element. The parent DIV of the entire element
// this.titleElement - reference to the title DIV
// this.separatorElement - reference to HR-element, tooltip separator
// this.contentElement - reference to the DIV of the tooltip content
}

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

onTitleChanged

Getter for the onTitleChanged handler.

Returns:

function - Handler function.
Setter for the onTitleChanged handler.
Enable HTML-mode for the tooltip with tooltip.useHtml(true) to work with onTitleChanged().

The method informs that the title has been changed.
The onTitleChanged() method is called only if the onBeforeTitleChange() method returns true.

See the structure of HTML-tooltip elements in the useHtml() method.

Params:

NameTypeDescription
handlerfunctionHandler function. Function that looks like
function(){
Handler context contains following fields:
// this.parentElement - reference to the basic HTML-element. The parent DIV of the entire element
// this.titleElement - reference to the title DIV
// this.separatorElement - reference to HR-element, tooltip separator
// this.contentElement - reference to the DIV of the tooltip content
}

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

padding

Setter for the tooltip padding in pixels by one value.

Params:

NameTypeDefaultDescription
paddingArray.<(number|string)> | Object
{top: 5, right: 10, bottom: 5, left: 10}
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.
Setter for the tooltip padding in pixels.

Params:

NameTypeDefaultDescription
value1string | number
5
Top or top-bottom space.
value2string | number
10
Right or right-left space.
value3string | number
5
Bottom space.
value4string | number
10
Left space.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.
Example
// 1) top and bottom 10px, left and right 15px
label.padding(10, '15px');
// 2) top 10px, left and right 15px, bottom 5px
label.padding(10, '15px', 5);
// 3) top 10px, right 15px, bottom 5px, left 12px
label.padding(10, '15px', '5px', 12);

position

Getter for the union tooltip position.

Returns:

anychart.enums.Position | string - Tooltip position.
See listing
var tooltip = chart.tooltip();
var position = tooltip.position();
Setter for the union tooltip position.
Note: Do not works with position mode FLOAT.

Params:

NameTypeDescription
positionanychart.enums.Position | stringPosition to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

positionMode

Getter for all tooltips position mode.

Returns:

string - Position mode.
See listing
var tooltip = chart.tooltip();
var positionMode = tooltip.positionMode();
Setter for all tooltips position mode.

Params:

NameTypeDescription
modeanychart.enums.TooltipPositionMode | stringPosition mode to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

print

Prints all elements on related stage.

Params:

NameTypeDefaultDescription
paperSizeOrOptionsanychart.graphics.vector.PaperSize | Object
Paper size or object with options.
landscapeboolean
false
Flag of landscape.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

selectable

Getter for the text selectable option.

Returns:

boolean - Text selectable value.
See listing
var tooltip = chart.tooltip();
var selectable = tooltip.selectable();
Setter for the text selectable option.

Params:

NameTypeDefaultDescription
enabledboolean
false
Selectable option to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

separator

Getter for the union tooltip separator.

Returns:

anychart.core.ui.Separator - Tooltip separator.
Setter for the union tooltip separator.

Params:

NameTypeDescription
settingsnull | boolean | ObjectSeparator settings.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

textDirection

Getter for the text direction settings.

Returns:

anychart.graphics.vector.Text.Direction - Text direction settings.
See listing
var tooltip = chart.tooltip();
var textDirection = tooltip.textDirection();
Setter for text direction settings.

Params:

NameTypeDescription
valuestring | anychart.graphics.vector.Text.DirectionText direction to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

textIndent

Getter for text-indent settings.

Returns:

number - Text indent settings.
See listing
var tooltip = chart.tooltip();
var textIndent = tooltip.textIndent();
Setter for text-indent settings.

Params:

NameTypeDescription
indentnumberText indent to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

textOverflow

Getter for text overflow settings.

Returns:

anychart.graphics.vector.Text.TextOverflow - Text overflow settings
See listing
var tooltip = chart.tooltip();
var textOverflow = tooltip.textOverflow();
Setter for text overflow settings.

Params:

NameTypeDescription
valueanychart.graphics.vector.Text.TextOverflow | stringValue to set

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

textSettings

Getter for the full text appearance settings.

Returns:

Object | string | number | boolean - Text settings.
See listing
var tooltip = chart.tooltip();
var textSettings = tooltip.textSettings();
Setter for the full text appearance settings.

Params:

NameTypeDescription
settingsObjectFew text settings.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.
Setter for the custom text appearance settings.

Params:

NameTypeDescription
namestringText settings name.
valuestring | number | booleanValue to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

title

Getter for union tooltip title visual settings.

Returns:

anychart.core.ui.Title - An instance of the class for method chaining.
See listing
var tooltip = chart.tooltip();
var title = tooltip.title();
Setter for union tooltip title visual settings.

Params:

NameTypeDescription
settingsnull | boolean | ObjectTitle settings.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

titleFormat

Getter for the function to format title.

Returns:

function | string - Function to format title text.
See listing
var tooltipSettings = chart.tooltip();
var formatter = tooltipSettings.titleFormat();
Setter for the function to format title.
Note: Use anychart.core.ui.Tooltip#title method to set title visual settings.

Params:

NameTypeDefaultDescription
formatfunction | string
function() {return 'Tooltip';}
Function to format title text. Function that looks like:
function(){
   // this.clientX - X coordinate of the mouse
   // this.clientY - Y coordinate of the mouse
   // this.formattedValues - array of the formatted values for the tooltip
   // this.points - array of the series points
   // this.allPoints - array of the all points
   // this.titleText - tooltip title text
   return titleFormatValue; // type Function
}

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

unionFormat

Getter for the function content text for union tooltip.

Returns:

function():string | string - Function to format title text.
See listing
var tooltipSettings = chart.tooltip();
var formatter = tooltipSettings.unionFormat();
Setter for the function content text for union tooltip.
Learn more about using unionFormat() method.

Params:

NameTypeDescription
unionFormatfunction():string | stringFunction or string token ('{%joinedFormattedValues}') to format content text. UnionFormat-function that looks like:function() { // this.clientX - X coordinate of the mouse. Type is number // this.clientY - Y coordinate of the mouse. Type is number // this.dataIntervalUnit - Interval unit. Type is string // this.dataIntervalUnitCount - Interval unit count. Type is number // this.formattedValues - Formatted values for the tooltip. Type is array of the string // this.hoveredDate - Type is number // this.isGrouped - Type is boolean // this.joinedFormattedValues - Formatted values for the join through
and '/n' (if tooltip.useHtml() is set to true, it parses the
tag, if tooltip.useHtml() is set to false, it parses '/n'). Type is string // this.name - Name. Type is string // this.points - Series points. Type is array // this.rawHoveredDate - Type is number // this.titleText - Tooltip title text. Type is number // this.valuePostfix - Postfix value. Type is number // this.valuePrefix - Prefix value. Type is number // this.x - The current x. Type is number } return unionFormat // string

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

NameTypeDefaultDescription
typestring
The event type id.
listenerfunction(e:Object):boolean|undefined
Callback method.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing
listenerScopeObject
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

NameTypeDescription
keyObjectThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

useHtml

Getter for the useHTML flag.

Returns:

boolean - UseHTML flag.
See listing
var tooltip = chart.tooltip();
var useHtml = tooltip.useHtml();
Setter for the HTML tooltip mode. Learn more about HTML tooltip
When the HTML tooltip mode is set to true AnyChart Component installs default tooltip CSS classes. Override the CSS class of the tooltip to customize the tooltip visually. Learn more about CSS Classes HTML-tooltip has the following DOM structure:
<div class="anychart-tooltip"> // The basic HTML-element. The parent DIV of the entire element.
     <div class="anychart-tooltip-title"></div> // The title element.
     <hr noshade="true" class="anychart-tooltip-separator"> // The tooltip separator element.
     <div></div> // The content element.
</div> 

The HTML text obtained from tooltip.format() is rendered to the contentElement.
The HTML text obtained from tooltip.titleFormat() is rendered to the tltleElement.

Params:

NameTypeDefaultDescription
enabledboolean
false
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

vAlign

Getter for text vertical align settings.

Returns:

anychart.graphics.vector.Text.VAlign - Vertical align.
See listing
var tooltip = chart.tooltip();
var vAlign = tooltip.vAlign();
Setter for text vertical align settings.

Params:

NameTypeDescription
alignstring | anychart.graphics.vector.Text.VAlignVertical align to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

valuePostfix

Getter for tooltip postfix value.

Returns:

string - Postfix settings.
See listing
var tooltip = series.tooltip();
var valuePostfix = tooltip.valuePostfix();
Setter for tooltip postfix value.

Params:

NameTypeDefaultDescription
valuestring
''
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

valuePrefix

Getter for tooltip prefix value.

Returns:

string - Prefix settings.
See listing
var tooltip = series.tooltip();
var valuePrefix = tooltip.valuePrefix();
Setter for tooltip prefix value.

Params:

NameTypeDefaultDescription
valuestring
''
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

width

Getter for the tooltip width.

Returns:

string | number - Tooltip width.
See listing
var tooltipSettings = chart.tooltip();
var width = tooltipSettings.width();
Setter for the tooltip width.

Params:

NameTypeDescription
widthstring | numberTooltip width to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

wordBreak

Getter for the word-break mode.

Returns:

anychart.enums.WordBreak | string - Word-break mode.
See listing
var wordBreak = tooltip.wordBreak();
Setter for the word-break mode.

Params:

NameTypeDefaultDescription
modeanychart.enums.WordBreak | string
'normal'
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

wordWrap

Getter for the word-wrap mode.

Returns:

anychart.enums.WordWrap | string - Word-wrap mode.
See listing
var wordWrap = tooltip.wordWrap();
Setter for the word-wrap mode.

Params:

NameTypeDefaultDescription
modeanychart.enums.WordWrap | string
'normal'
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.

zIndex

Getter for the Z-index of the element.

Returns:

number - Z-index.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
zIndexnumber
0
Value to set.

Returns:

anychart.core.ui.Tooltip - Self instance for method chaining.