AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.core.axisMarkers.Text Improve this Doc

Extends: anychart.core.Text

Text marker.

Methods Overview

Specific settings
text()Text settings.
value()Text marker value.
Advanced Text Settings
fontVariant()Font variant settings.
letterSpacing()Text letter spacing settings.
textDirection()Text direction settings.
textIndent()Text indent settings.
textOverflow()Text overflow settings.
useHtml()Text useHtml settings.
wordBreak()Word break mode.
wordWrap()Word-wrap mode.
Axes and Scales
axis()Axis settings.
scale()Scale settings.
scaleRangeMode()Scale range mode.
Base Text Settings
fontColor()Font color settings.
fontDecoration()Font decoration settings.
fontFamily()Font family settings.
fontOpacity()Font opacity settings.
fontSize()Font size settings.
fontStyle()Font style settings.
fontWeight()Font weight settings.
hAlign()Text horizontal align settings.
lineHeight()Text line height settings.
textShadow()Text shadow settings.
vAlign()Text vertical align settings.
Coloring
background()Background settings.
Events
disablePointerEvents()Pointer events settings.
Interactivity
enabled()Element state (enabled or disabled).
selectable()Text selectable option.
Size and Position
align()Align settings.
anchor()Anchor settings.
height()Text marker height.
isHorizontal()Whether a text marker has horizontal layout.
layout()Layout settings.
offsetX()Text marker offset by x.
offsetY()Text marker offset by y.
padding()Padding settings.
position()Text marker position.
rotation()Rotation settings.
width()Text marker width.
zIndex()Z-index of the series.
Text Settings
adjustFontSize()Adjusting settings.
fontColor()Font color settings.
maxFontSize()Maximum font size settings.
minFontSize()Minimum font size settings.
textSettings()Text settings.
useHtml()Text useHtml settings.

Methods Description

adjustFontSize

Getter for the adjust font settings.

Returns:

Object - AdjustFontSize settings.
See listing
var textMarker = chart.textMarker();
var adjustFontSize = textMarker.adjustFontSize();
Setter for the adjust font settings.

Params:

NameTypeDefaultDescription
bothOrByWidthObject | Array.<boolean> | boolean
{width: false, height: false}
If only one param is set, its value goes for another too (see source code).
byHeightboolean
Is font needs to be adjusted by height.

Returns:

anychart.core.annotations.Label - Self instance for method chaining.
Example
textMarker.adjustFontSize(false);
// the same
textMarker.adjustFontSize(false, false);
// the same
textMarker.adjustFontSize([false, false]);

align

Getter for the text marker align.

Returns:

anychart.enums.Align | string - The text marker align.
Setter for the text marker align.

Params:

NameTypeDefaultDescription
alignanychart.enums.Align | string
'center'
Text marker align.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

anchor

Getter for the text marker anchor settings.

Returns:

anychart.enums.Anchor | string - Text marker anchor settings.
Setter for the text marker anchor settings.

Params:

NameTypeDefaultDescription
anchoranychart.enums.Anchor | string
'auto'
Text marker anchor to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

axis

Getter for the text marker axis.

Returns:

anychart.core.axes.Linear - The text marker axis.
Setter for the text marker axis.

Params:

NameTypeDefaultDescription
axisanychart.core.axes.Linear
null
Axis instance to set.

Returns:

anychart.core.axisMarkers.Line - Self instance for method chaining.

background

Getter for the background.

Returns:

anychart.core.ui.Background - The text marker background.
Setter for the background.

Params:

NameTypeDefaultDescription
settingsstring | Object | null | boolean
false
Background settings.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

disablePointerEvents

Getter for the pointer events.

Returns:

boolean - Flag of the state.
Setter for the pointer events.

Params:

NameTypeDefaultDescription
enabledboolean
false
Enabled state to set.

Returns:

anychart.core.axisMarkers.Text - 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.axisMarkers.Text - Self instance for method chaining.
Example.
if (!element.enabled())
   element.enabled(true);

fontColor

Getter for the text font color.

Returns:

string - Font color.
See listing
var textMarker = chart.textMarker();
var fontColor = textMarker.fontColor();
Setter for the text font color.
https://www.w3schools.com/html/html_colors.asp

Params:

NameTypeDescription
colorstringFont color to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.
Getter for the text font color.

Returns:

string - Font color.
See listing
var textMarker = chart.textMarker();
var fontColor = textMarker.fontColor();
Setter for the text font color.
https://www.w3schools.com/html/html_colors.asp

Params:

NameTypeDescription
colorstringFont color to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontDecoration

Getter for the text font decoration.

Returns:

anychart.graphics.vector.Text.Decoration | string - Font decoration.
Setter for the text font decoration.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Text.Decoration | string
'none'
Font decoration to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontFamily

Getter for the font family.

Returns:

string - Font family.
Setter for the font family.

Params:

NameTypeDefaultDescription
familystring
'Verdana', Helvetica, Arial, sans-serif
Font family to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontOpacity

Getter for the text font opacity.

Returns:

number - Font opacity.
See listing
var textMarker = chart.textMarker();
var fontOpacity = textMarker.fontOpacity();
Setter for the text font opacity. Double value from 0 to 1.

Params:

NameTypeDefaultDescription
opacitynumber
1
Font opacity to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontSize

Getter for the text font size.

Returns:

string | number - Font size.
See listing
var textMarker = chart.textMarker();
var fontSize = textMarker.fontSize();
Setter for the text font size.

Params:

NameTypeDescription
sizestring | numberFont size to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontStyle

Getter for the text font style.

Returns:

anychart.graphics.vector.Text.FontStyle | string - Font style.
Setter for the text font style.

Params:

NameTypeDefaultDescription
styleanychart.graphics.vector.Text.FontStyle | string
'normal'
Font style to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontVariant

Getter for the text font variant.

Returns:

anychart.graphics.vector.Text.FontVariant | string - Font variant.
Setter for the text font variant.

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Text.FontVariant | string
'normal'
Font variant to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

fontWeight

Getter for the text font weight.

Returns:

string | number - Font weight.

Params:

NameTypeDefaultDescription
weightstring | number
'normal'
Font weight to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

hAlign

Getter for the text horizontal align.

Returns:

anychart.graphics.vector.Text.HAlign | string - Text horizontal align.
See listing
var textMarker = chart.textMarker();
var hAlign = textMarker.hAlign();
Setter for the text horizontal align.

Params:

NameTypeDefaultDescription
alignanychart.graphics.vector.Text.HAlign | string
'start'
Value to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

height

Getter for the text marker height.

Returns:

number | string | null - The text marker height.
See listing
var textMarker = chart.textMarker();
var height = textMarker.height();
Setter for the text marker height.

Params:

NameTypeDefaultDescription
heightnumber | string
null
Text marker height to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

isHorizontal

Whether a text marker has horizontal layout. Layout is define by anychart.core.axisMarkers.Text#layout method.

Returns:

boolean - Returns true if the text marker's layout is horizontal.

layout

Getter for text marker layout.

Returns:

anychart.enums.Layout | string - The text marker layout.
Setter for text marker layout.

Params:

NameTypeDefaultDescription
layoutanychart.enums.Layout | string
'horizontal'
Text marker layout to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

letterSpacing

Getter for the text letter spacing.

Returns:

string | number - Letter spacing.

Params:

NameTypeDefaultDescription
spacingstring | number
'normal'
Value to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

lineHeight

Getter for the text line height.

Returns:

string | number - Text line height.

Params:

NameTypeDefaultDescription
heightstring | number
'normal'
Value to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

maxFontSize

Getter for maximum font size settings for adjust text to.

Returns:

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

Params:

NameTypeDescription
sizenumber | stringMaximum font size to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

minFontSize

Getter for minimum font size settings for adjust text from.

Returns:

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

Params:

NameTypeDescription
sizenumber | stringMinimum font size to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

offsetX

Getter for the text marker offset by x.

Returns:

number | string - The offset by x.
See listing
var textMarkerSettings = chart.textMarker();
var offsetX = textMarkerSettings.offsetX();
Setter for the text marker offset by x.

Params:

NameTypeDefaultDescription
offsetnumber | string
0
Offset by x to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

offsetY

Getter for the text marker offset by y.

Returns:

number | string - The text marker offset by y.
See listing
var textMarkerSettings = chart.textMarker();
var offsetY = textMarkerSettings.offsetY();
Setter for the text marker offset by y.

Params:

NameTypeDefaultDescription
offsetnumber | string
0
Offset by y to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

padding

Setter for the text marker padding in pixels by one value.

Params:

NameTypeDescription
paddingArray.<(number|string)> | ObjectAn array of field values to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.
Setter for the text marker padding in pixels using several numbers.

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.axisMarkers.Text - Self instance for method chaining.
Example
// 1) top and bottom 10px, left and right 15px
textMarker.padding(10, '15px');
// 2) top 10px, left and right 15px, bottom 5px
textMarker.padding(10, '15px', 5);
// 3) top 10px, right 15px, bottom 5px, left 12px
textMarker.padding(10, '15px', '5px', 12);

position

Getter for the text marker position.

Returns:

anychart.enums.Position | string - Text marker position.
Setter for the text marker position.

Params:

NameTypeDefaultDescription
positionanychart.enums.Position | string
'center'
Text marker position to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

rotation

Getter for the text marker rotation in degrees.

Returns:

null | number - The text marker rotation.
See listing
var textMarkerSettings = chart.textMarker();
var rotation = textMarkerSettings.rotation();
Setter for the text marker rotation.

Params:

NameTypeDefaultDescription
rotationnumber
null
Text marker rotation to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

scale

Getter for the text marker scale.

Returns:

anychart.scales.Base - The text marker scale.
Setter for the text marker scale.

Params:

NameTypeDefaultDescription
settingsanychart.scales.Base | Object | anychart.enums.ScaleTypes | string
anychart.scales.Linear
Scale settings to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

scaleRangeMode

Getter for the scale range mode.

Returns:

string - Scale range mode.
See listing
var textMarker = chart.textMarker();
var scaleRangeMode = textMarker.scaleRangeMode();
Setter for the scale range mode.
Whether to consider the text marker value in the scale calculation or not. The 'consider' mode consideres the marker value in the scale.

Params:

NameTypeDefaultDescription
modestring | anychart.enums.ScaleRangeMode
'none'
Scale range mode to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

selectable

Getter for the text selectable option.

Returns:

boolean - The text selectable option.
Setter for the text selectable.

Params:

NameTypeDefaultDescription
enabledboolean
false
Enabled state to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

text

Getter for the text marker text settings.

Returns:

string - The text marker settings.
See listing
var textMarkerSettings = chart.textMarker();
var text = textMarkerSettings.text();
Setter for the text marker text settings.

Params:

NameTypeDefaultDescription
textstring
'Text marker'
Text to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

textDirection

Getter for the text direction.

Returns:

anychart.graphics.vector.Text.Direction | string - Text direction.
Setter for the text direction.

Params:

NameTypeDefaultDescription
directionanychart.graphics.vector.Text.Direction | string
'ltr'
Text direction to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

textIndent

Getter for the text indent.

Returns:

number - Text indent.
Setter for the text indent.

Params:

NameTypeDefaultDescription
indentnumber
0
Text indent to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

textOverflow

Getter for the text overflow settings.

Returns:

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

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Text.TextOverflow | string
""
Text overflow settings to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

textSettings

Getter for the full text appearance settings.

Returns:

Object - A copy of settings object.
Getter for all text appearance settings.

Params:

NameTypeDescription
namestringSetting name.

Returns:

string | number | boolean | undefined - Value of settings.
Setter for text appearance settings.

Params:

NameTypeDescription
objectWithSettingsObjectSettings object. Complete object looks like this:
   {
     'fontSize': smth,
     'fontFamily': smth,
     'fontColor': smth,
     'fontOpacity': smth,
     'fontDecoration': smth,
     'fontStyle': smth,
     'fontVariant': smth,
     'fontWeight': smth,
     'letterSpacing': smth,
     'textDirection': smth,
     'lineHeight': smth,
     'textIndent': smth,
     'vAlign': smth,
     'hAlign': smth,
     'wordWrap': smth,
     'wordBreak': smth,
     'textOverflow': smth,
     'selectable': smth,
     'useHtml': smth
     'textShadow':smth
   }

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.
Setter for the text appearance settings.

Params:

NameTypeDescription
namestringSetting name.
settingsstring | number | boolean | functionText settings.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

textShadow

Getter for the text shadow.

Returns:

string - String representation of text shadow.
See listing
var textMarker = chart.textMarker();
var textShadow = textMarker.textShadow();
Setter for the text shadow.

Params:

NameTypeDefaultDescription
textShadowanychart.graphics.vector.TextShadow | string
'none'
Text shadow to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

useHtml

Getter for the useHTML flag.

Returns:

boolean - Value of useHTML flag.
See listing
var textMarker = chart.textMarker();
var useHtml = textMarker.useHtml();
Setter for flag useHTML.

Params:

NameTypeDefaultDescription
enabledboolean
false
Enabled state to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.
Getter for the useHTML flag.

Returns:

boolean - Value of useHTML flag.
Setter for flag useHTML.

Params:

NameTypeDefaultDescription
enabledboolean
false
Enabled state to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

vAlign

Getter for the text vertical align.

Returns:

anychart.graphics.vector.Text.VAlign | string - Text vertical align.
Setter for the text vertical align.

Params:

NameTypeDefaultDescription
alignanychart.graphics.vector.Text.VAlign | string
'top'
Value to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

value

Getter for the text marker value.

Returns:

number - The text marker value.
See listing
var textMarkerSettings = chart.textMarker();
var value = textMarkerSettings.value();
Setter for the text marker value.

Params:

NameTypeDefaultDescription
valuenumber
0
Text marker value to set

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

width

Getter for the text marker width.

Returns:

number | string | null - The text marker width.
See listing
var textMarkerSettings = chart.textMarker();
var width = textMarkerSettings.width();
Setter for the text marker width.

Params:

NameTypeDefaultDescription
widthnumber | string
null
Text marker width to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

wordBreak

Getter for the word-break mode.

Returns:

anychart.enums.WordBreak | string - Word-break mode.
Setter for the word-break mode.

Params:

NameTypeDefaultDescription
modeanychart.enums.WordBreak | string
"normal"
Word-break mode to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

wordWrap

Getter for the word-wrap mode.

Returns:

anychart.enums.WordWrap | string - Word-wrap mode.
Setter for the word-wrap mode.

Params:

NameTypeDefaultDescription
modeanychart.enums.WordWrap | string
'normal'
Word-wrap mode to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.

zIndex

Getter for the Z-index of the series.

Returns:

number - Chart Z-index.
See listing
var zIndex = series.zIndex();
Setter for the Z-index of the series.

Params:

NameTypeDefaultDescription
zIndexnumber
30
Z-index to set.

Returns:

anychart.core.axisMarkers.Text - Self instance for method chaining.