AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.9.0 version of this document. Switch to the 8.4.0 version to see the up to date information.

class anychart.core.ui.Tooltip Improve this Doc

Extends: anychart.core.Base

Tooltip class.

Methods Overview

Specific settings
hideDelay()Sets/gets delay in milliseconds before tooltip becomes invisible on visible(false) call.
separator()Tooltip title separator.
textFormatter()Function to format content text.
title()Tooltip's title visual settings.
titleFormatter()Function to format title text.
Coloring
background()Tooltip background.
Events
listen()Adds an event listener.
listenOnce()Adds a single time event listener.
removeAllListeners()Removes all listeners.
unlisten()Removes the listener.
unlistenByKey()Removes the listener by the key.
Interactivity
enabled()Enabled for tooltip.
Size and Position
anchor()Gets or sets Tooltip anchor settings.
offsetX()Offset by X of tooltip position.
offsetY()Y offset of tooltip position.
padding()Tooltip padding.
Miscellaneous
valuePostfix()Gets/Sets value postfix.
valuePrefix()Gets/Sets value prefix.

Methods Description

anchor

Gets or sets Tooltip anchor settings.

Params:

NameTypeDefaultDescription
valueanychart.enums.Anchor | string
"leftTop"
Tooltip anchor settings.

Returns:

anychart.core.ui.Tooltip | anychart.enums.Anchor - Tooltip anchor settings or itself for method chaining.

background

Tooltip background.

Params:

NameTypeDefaultDescription
valuestring | Object | null | boolean
false
Tooltip background settings.

Returns:

anychart.core.ui.Background | anychart.core.ui.Tooltip - Background instance or itself for method chaining.

enabled

Enabled for tooltip.

Params:

NameTypeDefaultDescription
valueboolean
true
Value to set.

Returns:

anychart.core.ui.Tooltip | boolean -

hideDelay

Sets/gets delay in milliseconds before tooltip becomes invisible on visible(false) call.

Params:

NameTypeDefaultDescription
valuenumber
0
Delay in milliseconds before tooltip becomes invisible on visible(false) call.

Returns:

number | anychart.core.ui.Tooltip - delay in milliseconds before tooltip becomes invisible on visible(false) call or itself for method chaining.

listen

Adds an event listener to an implementing object.

Params:

NameTypeDescription
typestringThe event type id.
listenerfunctionCallback method.
useCapturebooleanWhether to fire in capture phase (defaults to false).
listenerScopescopeObject in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.

Params:

NameTypeDescription
typestringThe event type id.
listenerfunctionCallback method.
useCapturebooleanWhether to fire in capture phase (defaults to false).
listenerScopescopeObject in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

offsetX

Offset by X of tooltip position.

Params:

NameTypeDefaultDescription
valuenumber
10
New value of X offset of tooltip position.

Returns:

number | anychart.core.ui.Tooltip - X offset of tooltip position of itself for method chaining.

offsetY

Y offset of tooltip position.

Params:

NameTypeDefaultDescription
valuenumber
10
New value of Y offset of tooltip position.

Returns:

number | anychart.core.ui.Tooltip - Y offset of tooltip position of itself for method chaining.

padding

Tooltip padding.

Params:

NameTypeDefaultDescription
valuestring | number | Array.<(number|string)> | Object
{top: 5, right: 10, bottom: 5, left: 10}
Tooltip padding settings.

Returns:

anychart.core.utils.Padding | anychart.core.ui.Tooltip - Padding instance or itself for method chaining.

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.

separator

Tooltip title separator.

Params:

NameTypeDefaultDescription
valueObject | boolean | null
false
Tooltip separator settings.

Returns:

anychart.core.ui.Separator | anychart.core.ui.Tooltip - Separator instance or itself for method chaining.

textFormatter

Getter for the current formatter content text for union tooltip.

Returns:

function | string - Function to format title text.
Example
var currentTooltipSettings = series.tooltip();
var currentFormatter = currentTooltipSettings.textFormatter();
Setter for the formatter content text for union tooltip.

Params:

NameTypeDefaultDescription
valuefunction | string
function() {return this.x+": "+this.valuePrefix+this.value+this.valuePostfix;}
Function or string token to format content text.

Returns:

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

title

Getter for tooltip's title visual settings.

Returns:

anychart.core.ui.Title - An instance of class for method chaining.
Setter for tooltip's title visual settings.

Params:

NameTypeDefaultDescription
valuenull | boolean | Object | string
false
Tooltip settings.

Returns:

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

titleFormatter

Getter for title text formatter function.

Returns:

function - Function to format title text.
Example
var currentTooltipSettings = series.tooltip();
var currentFormatter = currentTooltipSettings.titleFormatter();
Setter for title text formatter function.

Params:

NameTypeDefaultDescription
valuefunction
function() {return this.seriesName;}
Function to format title text.

Returns:

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

unlisten

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

Params:

NameTypeDescription
typestringThe event type id.
listenerfunctionCallback method.
useCapturebooleanWhether to fire in capture phase (defaults to false).
listenerScopescopeObject 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.

valuePostfix

Gets/Sets value postfix.

Params:

NameTypeDescription
valuestring

Returns:

string | anychart.core.ui.Tooltip -

valuePrefix

Gets/Sets value prefix.

Params:

NameTypeDescription
valuestring

Returns:

string | anychart.core.ui.Tooltip -