class anychart.standalones.axisMarkers.Text Improve this Doc
Extends: anychart.core.axisMarkers.Text
The Text class contains methods for configuring standalones text markers.
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. |
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. |
parentBounds() | Parent bounds for text marker. |
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. |
Miscellaneous | |
container() | Container for the text marker. |
draw() | Drawing of the text marker. |
Methods Description
adjustFontSize
- [false, false] - don't adjust (adjust is off )
- [true, false] - adjust width
- [false, true] - adjust height
- [true, true] - adjust the first suitable value.
Returns:
Object - AdjustFontSize settings.var textMarker = chart.textMarker(); var adjustFontSize = textMarker.adjustFontSize();
Note: Works only when anychart.core.annotations.Label#width and anychart.core.annotations.Label#height are set.
Note: anychart.core.annotations.Label#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 (see source code). |
byHeight | boolean | Is font needs to be adjusted by height. |
Returns:
anychart.core.annotations.Label - Self instance for method chaining.textMarker.adjustFontSize(false); // the same textMarker.adjustFontSize(false, false); // the same textMarker.adjustFontSize([false, false]);
Try it:
align
Returns:
anychart.enums.Align | string - The text marker align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.enums.Align | string | 'center' | Text marker align. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
anchor
Returns:
anychart.enums.Anchor | string - Text marker anchor settings.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
anchor | anychart.enums.Anchor | string | 'auto' | Text marker anchor to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
axis
Params:
Name | Type | Default | Description |
---|---|---|---|
axis | anychart.core.axes.Linear | null | Axis instance to set. |
Returns:
anychart.core.axisMarkers.Line - Self instance for method chaining.Try it:
background
- null/boolean - disable or enable text marker background.
- object - sets text marker background settings.
- string - sets fill for the text marker background.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | string | Object | null | boolean | false | Background settings. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.container
Returns:
anychart.graphics.vector.Layer | anychart.graphics.vector.Stage - The text marker container.Params:
Name | Type | Description |
---|---|---|
element | anychart.graphics.vector.Layer | anychart.graphics.vector.Stage | string | Element | The value to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
disablePointerEvents
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
draw
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
enabled
Returns:
boolean - Element state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Enabled state to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.if (!element.enabled()) element.enabled(true);
Try it:
fontColor
Returns:
string - Font color.var textMarker = chart.textMarker(); var fontColor = textMarker.fontColor();
https://www.w3schools.com/html/html_colors.asp
Params:
Name | Type | Description |
---|---|---|
color | string | Font color to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
Returns:
string - Font color.var textMarker = chart.textMarker(); var fontColor = textMarker.fontColor();
https://www.w3schools.com/html/html_colors.asp
Params:
Name | Type | Description |
---|---|---|
color | string | Font color to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontDecoration
Returns:
anychart.graphics.vector.Text.Decoration | string - Font decoration.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.Decoration | string | 'none' | Font decoration to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontFamily
Params:
Name | Type | Default | Description |
---|---|---|---|
family | string | 'Verdana', Helvetica, Arial, sans-serif | Font family to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontOpacity
Returns:
number - Font opacity.var textMarker = chart.textMarker(); var fontOpacity = textMarker.fontOpacity();
Params:
Name | Type | Default | Description |
---|---|---|---|
opacity | number | 1 | Font opacity to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontSize
Returns:
string | number - Font size.var textMarker = chart.textMarker(); var fontSize = textMarker.fontSize();
Params:
Name | Type | Description |
---|---|---|
size | string | number | Font size to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontStyle
Returns:
anychart.graphics.vector.Text.FontStyle | string - Font style.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
style | anychart.graphics.vector.Text.FontStyle | string | 'normal' | Font style to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontVariant
Returns:
anychart.graphics.vector.Text.FontVariant | string - Font variant.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.FontVariant | string | 'normal' | Font variant to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
fontWeight
https://www.w3schools.com/cssref/pr_font_weight.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
weight | string | number | 'normal' | Font weight to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
hAlign
Returns:
anychart.graphics.vector.Text.HAlign | string - Text horizontal align.var textMarker = chart.textMarker(); var hAlign = textMarker.hAlign();
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.graphics.vector.Text.HAlign | string | 'start' | Value to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
height
Returns:
number | string | null - The text marker height.var textMarker = chart.textMarker(); var height = textMarker.height();
Params:
Name | Type | Default | Description |
---|---|---|---|
height | number | string | null | Text marker height to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
isHorizontal
Returns:
boolean - Returns true if the text marker's layout is horizontal.Try it:
layout
Returns:
anychart.enums.Layout | string - The text marker layout.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
layout | anychart.enums.Layout | string | 'horizontal' | Text marker layout to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
letterSpacing
https://www.w3schools.com/cssref/pr_text_letter-spacing.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
spacing | string | number | 'normal' | Value to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
lineHeight
https://www.w3schools.com/cssref/pr_dim_line-height.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
height | string | number | 'normal' | Value to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
maxFontSize
Returns:
number - Maximum font size.var textMarker = chart.textMarker(); var maxFontSize = textMarker.maxFontSize();
Params:
Name | Type | Description |
---|---|---|
size | number | string | Maximum font size to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
minFontSize
Returns:
number - Minimum font size.var textMarker = chart.textMarker(); var minFontSize = textMarker.minFontSize();
Params:
Name | Type | Description |
---|---|---|
size | number | string | Minimum font size to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
offsetX
Returns:
number | string - The offset by x.var textMarkerSettings = chart.textMarker(); var offsetX = textMarkerSettings.offsetX();
Params:
Name | Type | Default | Description |
---|---|---|---|
offset | number | string | 0 | Offset by x to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
offsetY
Returns:
number | string - The text marker offset by y.var textMarkerSettings = chart.textMarker(); var offsetY = textMarkerSettings.offsetY();
Params:
Name | Type | Default | Description |
---|---|---|---|
offset | number | string | 0 | Offset by y to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
padding
Returns:
anychart.core.utils.Padding - The text marker padding.Try it:
Params:
Name | Type | Description |
---|---|---|
padding | Array.<(number|string)> | Object | An array of field values to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
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.standalones.axisMarkers.Text - Self instance for method chaining.// 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);
Try it:
parentBounds
Returns:
anychart.math.Rect - Text marker bounds.Params:
Name | Type | Description |
---|---|---|
bounds | anychart.math.Rect | Object | null | Bounds to set |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
left | number | Left space |
top | number | Top space |
width | number | Width line marker |
height | number | Height line marker |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
position
Returns:
anychart.enums.Position | string - Text marker position.Params:
Name | Type | Default | Description |
---|---|---|---|
position | anychart.enums.Position | string | 'center' | Text marker position to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.rotation
Returns:
null | number - The text marker rotation.var textMarkerSettings = chart.textMarker(); var rotation = textMarkerSettings.rotation();
Params:
Name | Type | Default | Description |
---|---|---|---|
rotation | number | null | Text marker rotation to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
scale
Returns:
anychart.scales.Base - The text marker scale.Params:
Name | Type | Default | Description |
---|---|---|---|
settings | anychart.scales.Base | Object | anychart.enums.ScaleTypes | string | anychart.scales.Linear | Scale settings to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
scaleRangeMode
Returns:
string - Scale range mode.var textMarker = chart.textMarker(); var scaleRangeMode = textMarker.scaleRangeMode();
Whether to consider the text marker value in the scale calculation or not. The 'consider' mode consideres the marker value in the scale.
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | string | anychart.enums.ScaleRangeMode | 'none' | Scale range mode to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
selectable
Returns:
boolean - The text selectable option.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
text
Returns:
string - The text marker settings.var textMarkerSettings = chart.textMarker(); var text = textMarkerSettings.text();
Params:
Name | Type | Default | Description |
---|---|---|---|
text | string | 'Text marker' | Text to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
textDirection
Returns:
anychart.graphics.vector.Text.Direction | string - Text direction.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
direction | anychart.graphics.vector.Text.Direction | string | 'ltr' | Text direction to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
textIndent
Params:
Name | Type | Default | Description |
---|---|---|---|
indent | number | 0 | Text indent to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
textOverflow
Returns:
anychart.graphics.vector.Text.TextOverflow | string - Text overflow settings.var title = chart.title(); var textOverflow = title.textOverflow();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.TextOverflow | string | "" | Text overflow settings to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
textSettings
Returns:
Object - A copy of settings object.Try it:
Params:
Name | Type | Description |
---|---|---|
name | string | Setting name. |
Returns:
string | number | boolean | undefined - Value of settings.Try it:
Params:
Name | Type | Description |
---|---|---|
objectWithSettings | Object | Settings 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.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
name | string | Setting name. |
settings | string | number | boolean | function | Text settings. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
useHtml
Returns:
boolean - Value of useHTML flag.var textMarker = chart.textMarker(); var useHtml = textMarker.useHtml();
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
Returns:
boolean - Value of useHTML flag.Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
vAlign
Returns:
anychart.graphics.vector.Text.VAlign | string - Text vertical align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.graphics.vector.Text.VAlign | string | 'top' | Value to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
value
Returns:
number - The text marker value.var textMarkerSettings = chart.textMarker(); var value = textMarkerSettings.value();
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0 | Text marker value to set |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
width
Returns:
number | string | null - The text marker width.var textMarkerSettings = chart.textMarker(); var width = textMarkerSettings.width();
Params:
Name | Type | Default | Description |
---|---|---|---|
width | number | string | null | Text marker width to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
wordBreak
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.WordBreak | string | "normal" | Word-break mode to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
wordWrap
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.WordWrap | string | 'normal' | Word-wrap mode to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it:
zIndex
Returns:
number - Chart Z-index.var zIndex = series.zIndex();
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 30 | Z-index to set. |
Returns:
anychart.standalones.axisMarkers.Text - Self instance for method chaining.Try it: