Top

class anychart.core.ui.CrosshairLabel Improve this Doc

CrosshairLabel class.

Methods Overview

Specific settings
axisIndex()Axis index.
format()Text formatter function.
Advanced Text Settings
adjustFontSize()Adjust font settings.
maxFontSize()Maximum font size setting.
minFontSize()Minimum font size setting.
Coloring
background()Background settings.
Size and Position
anchor()Anchor settings.
height()Height settings.
offsetX()Offset by X.
offsetY()Offset by Y.
padding()Padding settings.
width()Width settings.

Methods Description

adjustFontSize

Getter for adjust font settings.

Returns:

Object - Adjust font size.

Try it:

Setter for adjust font settings.

Params:

Name Type Default Description
bothOrByWidth Object | Array.<boolean> | boolean
{width: false, height: false}
If only one param is set, its value goes for another too.
byHeight boolean
Is font needs to be adjusted by height.

Returns:

anychart.core.ui.CrosshairLabel - Self instance for method chaining.
Example.
label.adjustFontSize(false);
// the same
label.adjustFontSize(false, false);
// the same
label.adjustFontSize([false, false]);

Try it:

anchor

Getter for crosshair label anchor settings.

Returns:

anychart.enums.Anchor - Label anchor settings.

Try it:

Setter for the crosshair label anchor settings.

Params:

Name Type Default Description
value anychart.enums.Anchor | string
null
Value to set.

Returns:

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

Try it:

axisIndex

Getter for the axis index.

Returns:

number - Axis index

Try it:

Setter for the axis index.

Params:

Name Type Default Description
value number
0
Axis index

Returns:

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

Try it:

background

Getter for crosshair label background settings.

Returns:

anychart.core.ui.Background - Returns background settings.

Try it:

Setter for crosshair label background settings.

Params:

Name Type Default Description
value string | Object | null | boolean
true
Value to set.

Returns:

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

format

Getter for labels format function.

Returns:

function - Labels format function.

Try it:

Setter for labels format function.
Learn more about using format() method.

Params:

Name Type Description
function function Function to format label text.

Returns:

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

Try it:

height

Getter for the crosshair label height.

Returns:

number string null - Label width.

Try it:

Setter for the crosshair label height.

Params:

Name Type Default Description
value number | string | null
null
Value to set.

Returns:

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

Try it:

maxFontSize

Getter for the font size for adjust text to.

Returns:

number - Current value.

Try it:

Setter for the font size for adjust text to.

Params:

Name Type Default Description
value number | string
72
Value to set.

Returns:

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

Try it:

minFontSize

Getter for the minimum font size for adjust text from.

Returns:

number - Minimum font size.

Try it:

Setter for the minimum font size for adjust text from.

Params:

Name Type Default Description
value number | string
8
Value to set.

Returns:

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

Try it:

offsetX

Getter for crosshair label offsetX settings.

Returns:

number string - Label offsetX value.

Try it:

Setter for crosshair label offsetX settings.

Arrows show offsets layout.

Params:

Name Type Default Description
value number | string
0
Value to set.

Returns:

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

Try it:

offsetY

Getter for crosshair label offsetY settings.

Returns:

number string - Label offsetY value.

Try it:

Setter for crosshair label offsetY settings. See illustration in anychart.core.ui.CrosshairLabel#offsetX.

Params:

Name Type Default Description
value number | string
0
Value to set.

Returns:

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

Try it:

padding

Setter for crosshair label padding in pixels by one value.

Params:

Name Type Default Description
value Array.<(number|string)> | Object
{top: 5, right: 10, bottom: 5, left: 10}
Value to set.

Returns:

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

Try it:

Setter for crosshair label padding in pixels.

Params:

Name Type Default Description
value1 string | number
5
Top or top-bottom space.
value2 string | number
10
Right or right-left space.
value3 string | number
5
Bottom space.
value4 string | number
10
Left space.

Returns:

anychart.core.ui.CrosshairLabel - 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);

Try it:

width

Getter for the crosshair label width.

Returns:

number string null - Label width.

Try it:

Setter for the crosshair label width.

Params:

Name Type Default Description
value number | string | null
null
Value to set.

Returns:

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

Try it: