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.SeriesTooltip Improve this Doc

Extends: anychart.core.VisualBase

Class for series tooltip.

Methods Overview

Specific settings
hideDelay()Hide delay settings.
textFormatter()Function to format content text.
titleFormatter()Function to format title text.
valuePostfix()Postfix settings.
valuePrefix()Prefix settings.
Content Text Settings
disablePointerEvents()Pointer events setting.
fontColor()Font color setting.
fontDecoration()Font decoration setting.
fontFamily()Font family setting.
fontOpacity()Font opacity setting.
fontSize()Font size setting.
fontStyle()Font style setting.
fontVariant()Font variant setting.
fontWeight()Font weight setting.
hAlign()Text horizontal align setting.
letterSpacing()Text letter spacing setting.
lineHeight()Text line height setting.
selectable()Text selectable option.
textDirection()Text direction setting.
textIndent()Text indent setting.
textSettings()Font opacity setting.
textWrap()Text wrap setting.
useHtml()Use HTML option.
vAlign()Text vertical align setting.
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.
Export
print()Prints all elements.
Interactivity
enabled()Element state (enabled or disabled).
Size and Position
anchor()Anchor settings.
offsetX()X offset settings.
offsetY()Y offset settings.
padding()Padding settings.
position()Position settings.
zIndex()Z-index of the element.
Visual settings
background()Background settings.
separator()Separator settings.
title()Position mode settings.
Miscellaneous
textOverflow()Getter/Setter for the text overflow settings.

Methods Description

anchor

Getter for tooltip anchor.

Returns:

anychart.enums.Anchor - Current anchor settings.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.anchor();
Setter for tooltip anchor.

Params:

NameTypeDefaultDescription
valueanychart.enums.Anchor | string
Value to set.

Returns:

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

background

Getter for union tooltip background settings.

Returns:

anychart.core.ui.Background - An instance of class for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.background();
Setter for union tooltip background settings.

Params:

NameTypeDefaultDescription
valuenull | boolean | Object | string
depends on theme
Background settings.

Returns:

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

disablePointerEvents

Getter for the current pointer events setting.

Returns:

number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.disablePointerEvents();
Setter for the pointer events setting.

Params:

NameTypeDefaultDescription
valuenumber
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.disablePointerEvents(false);

enabled

Getter for the current element state (enabled or disabled).

Returns:

boolean - The current element state.
Setter for the element enabled state.

Params:

NameTypeDefaultDescription
valueboolean
true
Value to set.

Returns:

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

fontColor

Getter for the current font color setting.

Returns:

string - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontSize();
Setter for the font color setting.

Params:

NameTypeDefaultDescription
valuestring
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontColor('red');

fontDecoration

Getter for the current font decoration setting.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontDecoration();
Setter for the font decoration setting.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Text.Decoration | string
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontDecoration(0.2);

fontFamily

Getter for the current font family setting.

Returns:

string - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontSize();
Setter for the font family setting.

Params:

NameTypeDefaultDescription
valuestring
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontFamily('Tahoma');

fontOpacity

Getter for the current font opacity setting.

Returns:

number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontOpacity();
Setter for the font opacity setting.

Params:

NameTypeDefaultDescription
valuenumber
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontOpacity(0.2);

fontSize

Getter for the current font size setting.

Returns:

number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontSize();
Setter for the font size setting.

Params:

NameTypeDefaultDescription
valuenumber | string
8
Value to set.

Returns:

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

fontStyle

Getter for the current font style setting.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontStyle();
Setter for the font style setting.

Params:

NameTypeDefaultDescription
valuestring | anychart.graphics.vector.Text.FontStyle
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontStyle('italic');

fontVariant

Getter for the current font variant setting.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontVariant();
Setter for the font variant setting.

Params:

NameTypeDefaultDescription
valuestring | anychart.graphics.vector.Text.FontVariant
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontVariant('small-caps');

fontWeight

Getter for the current font weight setting.

Returns:

string | number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontWeight();
Setter for the font weight setting.

Params:

NameTypeDefaultDescription
valuestring | number
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontWeight(600);

hAlign

Getter for the current text horizontal align setting.

Returns:

anychart.graphics.vector.Text.HAlign - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.hAlign();
Setter for the text horizontal align setting.

Params:

NameTypeDefaultDescription
valuestring | anychart.graphics.vector.Text.HAlign
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.hAlign(0.2);

hideDelay

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

Returns:

number - Current hide delay settings.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.hideDelay();
Setter for delay in milliseconds before union tooltip item becomes hidden.

Params:

NameTypeDefaultDescription
valuenumber
0
Delay in milliseconds.

Returns:

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

letterSpacing

Getter for the current text letter spacing setting.

Returns:

number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.letterSpacing();
Setter for the text letter spacing setting.

Params:

NameTypeDefaultDescription
valuenumber
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.letterSpacing(0.2);

lineHeight

Getter for the current text line height setting.

Returns:

number | string - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.lineHeight();
Setter for the text line height setting.

Params:

NameTypeDefaultDescription
valuenumber | string
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.lineHeight(1.1);

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

Getter for tooltip offsetX.

Returns:

number - Current anchor settings.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.offsetX();
Setter for tooltip offsetX.

Params:

NameTypeDefaultDescription
valuenumber
Value to set.

Returns:

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

offsetY

Getter for tooltip offsetY.

Returns:

number - Current anchor settings.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.offsetY();
Setter for tooltip offsetY.

Params:

NameTypeDefaultDescription
valuenumber
Value to set.

Returns:

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

padding

Getter for the current tooltip padding.

Returns:

anychart.core.utils.Padding - Current label padding.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.padding();
Setter for tooltip padding in pixels by one value.

Params:

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

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
Setter for 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.SeriesTooltip - Self instance for method chaining.
See listing 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 tooltip position.

Returns:

anychart.enums.Position - Current position settings.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.position();
Setter for tooltip position.

Params:

NameTypeDefaultDescription
valueanychart.enums.Position | string
Value to set.

Returns:

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

print

Prints all elements on related stage.

Params:

NameTypeDefaultDescription
paperSizeanychart.graphics.vector.PaperSize
Paper size.
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 current text selectable option.

Returns:

boolean - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.selectable();
Setter for the text selectable option.

Params:

NameTypeDefaultDescription
valueboolean
false
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.selectable(false);

separator

Getter for tooltip separator.

Returns:

anychart.core.ui.Separator - An instance of class for method chaining.
Setter for tooltip separator.

Params:

NameTypeDefaultDescription
valuenull | boolean | Object
Separator settings.

Returns:

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

textDirection

Getter for the current text direction setting.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.fontOpacity();
Setter for the text direction setting.

Params:

NameTypeDefaultDescription
valuestring | anychart.graphics.vector.Text.Direction
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.fontOpacity('rtl');

textFormatter

Getter for the current formatter content text for union tooltip.

Returns:

function | string - Function to format title text.
See listing
var currentTooltipSettings = series.tooltip();
var currentFormatter = currentTooltipSettings.textFormatter();
Setter for 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.SeriesTooltip - Self instance for method chaining.

textIndent

Getter for the current text indent setting.

Returns:

number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.textIndent();
Setter for the text indent setting.

Params:

NameTypeDefaultDescription
valuenumber
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.textIndent(0.2);

textOverflow

Getter/Setter for the text overflow settings.

Params:

NameTypeDescription
valueanychart.graphics.vector.Text.TextOverflow | string

textSettings

Getter for the full text appearance settings.

Returns:

number - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.textSettings();
Setter for the full text appearance settings.

Params:

NameTypeDescription
valueObjectFew text settings.

Returns:

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

Params:

NameTypeDescription
namestringSettings Text settings name.
valuestring | number | booleanValue to set.

Returns:

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

textWrap

Getter for the current text wrap setting.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.textWrap();
Setter for the text wrap setting.

Params:

NameTypeDefaultDescription
valuestring | anychart.graphics.vector.Text.TextWrap
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.textWrap('noWrap');

title

Getter for union tooltip title visual settings.

Returns:

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

Params:

NameTypeDefaultDescription
valuenull | boolean | Object
Title settings.

Returns:

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

titleFormatter

Getter for function to format title for union tooltip.

Returns:

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

Params:

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

Returns:

anychart.core.ui.SeriesTooltip - 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.

useHtml

Getter for the current the useHTML flag.

Returns:

boolean - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.useHtml();
Setter for the useHTML flag.

Params:

NameTypeDefaultDescription
valueboolean
depends on theme
Value to set.

Returns:

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

vAlign

Getter for the current text vertical align setting.

Returns:

anychart.graphics.vector.Text.VAlign - Current value.
See listing
var currentTooltipSettings = series.tooltip();
var currentValue = currentTooltipSettings.vAlign();
Setter for the text vertical align setting.

Params:

NameTypeDefaultDescription
valuestring | anychart.graphics.vector.Text.VAlign
depends on theme
Value to set.

Returns:

anychart.core.ui.SeriesTooltip - Self instance for method chaining.
See listing
var currentTooltipSettings = series.tooltip();
currentTooltipSettings.vAlign('top');

valuePostfix

Getter for tooltip postfix value.

Returns:

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

Params:

NameTypeDefaultDescription
valuestring
''
Value to set.

Returns:

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

valuePrefix

Getter for tooltip prefix value.

Returns:

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

Params:

NameTypeDefaultDescription
valuestring
''
Value to set.

Returns:

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

zIndex

Getter for the current Z-index of the element.

Returns:

number - The current zIndex.
Setter for the Z-index of the element.

Params:

NameTypeDefaultDescription
valuenumber
0
Value to set.

Returns:

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