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.
Detailed description
Returns an array of two elements [isAdjustByWidth, isAdjustByHeight].
- [false, false] - do not adjust (adjust is off )
- [true, false] - adjust width
- [false, true] - adjust height
- [true, true] - adjust the first suitable value.
Returns:
Object - Adjust font size.Try it:
Setter for adjust font settings.
Detailed description
Minimal and maximal font sizes can be configured using:
anychart.core.ui.CrosshairLabel#minFontSize and anychart.core.ui.CrosshairLabel#maxFontSize.
Note: Works only when anychart.core.ui.CrosshairLabel#width and anychart.core.ui.CrosshairLabel#height are set.
Note: anychart.core.ui.CrosshairLabel#fontSize does not work when adjusting is enabled.
Note: Works only when anychart.core.ui.CrosshairLabel#width and anychart.core.ui.CrosshairLabel#height are set.
Note: anychart.core.ui.CrosshairLabel#fontSize does not work when adjusting is enabled.
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
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.
Detailed description
Sets label background settings depending on parameter type:
- null/boolean - disable or enable label background.
- object - sets label background settings.
- string - sets label background color.
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
Setter for labels format function.
Learn more about using format() method.
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.
Detailed description
Note: if null is passed, height is calculated automatically.
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
Setter for the font size for adjust text to.
Detailed description
Note: works only when adjusting is enabled. Look anychart.core.ui.CrosshairLabel#adjustFontSize.
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.
Detailed description
Note: works only when adjusting is enabled. Look anychart.core.ui.CrosshairLabel#adjustFontSize.
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.
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
Getter for the crosshair label padding.
Detailed description
Also, you can use anychart.core.utils.Padding#bottom, anychart.core.utils.Padding#left,
anychart.core.utils.Padding#right, anychart.core.utils.Padding#top methods to setting paddings.
Returns:
anychart.core.utils.Padding - Label padding.Try it:
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.
Detailed description
Note: if null is passed, width is calculated automatically.
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: