Top
You are looking at an outdated 7.8.0 version of this document. Switch to the 7.14.3 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()Remove all listeners.
unlisten()Remove of the listener.
unlistenByKey()Remove of 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:

Name Type Default Description
value anychart.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:

Name Type Default Description
value string | 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:

Name Type Default Description
value boolean
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:

Name Type Default Description
value number
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:

Name Type Description
type string The event type id.
listener function Callback method.
useCapture boolean Whether to fire in capture phase (defaults to false).
listenerScope scope Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

Try it:

listenOnce

Adds an event listener to an implementing object.

Params:

Name Type Description
type string The event type id.
listener function Callback method.
useCapture boolean Whether to fire in capture phase (defaults to false).
listenerScope scope Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

Try it:

offsetX

Offset by X of tooltip position.

Params:

Name Type Default Description
value number
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:

Name Type Default Description
value number
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:

Name Type Default Description
value string | 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:

Name Type Description
type string Type of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

Try it:

separator

Tooltip title separator.

Params:

Name Type Default Description
value Object | 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 function content text for union tooltip.

Returns:

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

Params:

Name Type Default Description
value function
function() {return this.x+": "+this.valuePrefix+this.value+this.valuePostfix;}
Function to format content text.

Returns:

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

Try it:

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:

Name Type Default Description
value null | 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:

Name Type Default Description
value function
function() {return this.seriesName;}
Function to format title text.

Returns:

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

Try it:

unlisten

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

Params:

Name Type Description
type string The event type id.
listener function Callback method.
useCapture boolean Whether to fire in capture phase (defaults to false).
listenerScope scope Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

Try it:

unlistenByKey

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

Params:

Name Type Description
key Object The key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.

Try it:

valuePostfix

Gets/Sets value postfix.

Params:

Name Type Description
value string

Returns:

string anychart.core.ui.Tooltip -

valuePrefix

Gets/Sets value prefix.

Params:

Name Type Description
value string

Returns:

string anychart.core.ui.Tooltip -