class anychart.core.ui.LabelsFactory Improve this Doc
Extends: anychart.core.Text
Class for creation of sets of similar labels and management of such sets. Any individual label can be changed after all labels are displayed.
Methods Overview
Specific settings | |
clip() | Labels clip settings. |
format() | Text formatter function. |
getLabel() | Returns label by index. |
getLabelsCount() | Gets labels count. |
Advanced Text Settings | |
adjustFontSize() | Adjusting 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. |
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. |
maxFontSize() | Maximum font size setting. |
maxLength() | Maximum text length. |
minFontSize() | Minimum font size setting. |
textShadow() | Text shadow settings. |
vAlign() | Text vertical align settings. |
Coloring | |
background() | Background settings. |
connectorStroke() | Stroke settings. |
Events | |
disablePointerEvents() | Pointer events settings. |
Interactivity | |
enabled() | Element state (enabled or disabled). |
selectable() | Text selectable option. |
Size and Position | |
anchor() | Anchor settings. |
height() | Height settings. |
offsetX() | Offset by X. |
offsetY() | Offset by Y. |
padding() | Padding settings. |
position() | Position settings. |
positionFormatter() | Position formatter function. |
rotation() | Rotation settings. |
width() | Width settings. |
zIndex() | Z-index of the element. |
Methods Description
adjustFontSize
Params:
Name | Type | Default | Description |
---|---|---|---|
adjustByWidth | boolean | false | Enables adjusting by width. Is font needs to be adjusted by width. |
adjustByHeight | boolean | false | Enables adjusting by height. Is font needs to be adjusted by height. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | Object | Array.<boolean> | boolean | false | Enables adjusting by width and height. Adjusting flag, object or array. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
anchor
Returns:
anychart.enums.Anchor | string - Labels anchor setting.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
anchor | anychart.enums.Anchor | string | 'center' | Labels anchor settings. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
background
Returns:
anychart.core.ui.Background - Labels background.Try it:
- null/boolean - disable or enable labels background.
- string - sets labels background color value.
- object - sets labels background settings.
Params:
Name | Type | Default | Description |
---|---|---|---|
settings | string | Object | null | boolean | false | Background settings to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.clip
Returns:
anychart.graphics.vector.Shape | string | anychart.graphics.vector.Clip | anychart.math.Rect - Clip settings.Params:
Name | Type | Description |
---|---|---|
clipSettings | anychart.graphics.vector.Shape | string | anychart.graphics.vector.Clip | anychart.math.Rect | Labels clip settings. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.connectorStroke
Returns:
anychart.graphics.vector.Stroke - Connector stroke settings.var mapLabels = series.labels(); var stroke = mapLabels.connectorStroke();
Params:
Name | Type | Default | Description |
---|---|---|---|
color | anychart.graphics.vector.Stroke | string | null | Stroke settings. | |
thickness | number | 1 | Line thickness. |
dashpattern | string | Controls the pattern of dashes and gaps used to stroke paths. | |
lineJoin | anychart.graphics.vector.StrokeLineJoin | Line joint style. | |
lineCap | anychart.graphics.vector.StrokeLineCap | Line cap style. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
settings | Object | Stroke settings from anychart.graphics.vector.Stroke. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
disablePointerEvents
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
enabled
Returns:
boolean - Element state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | null | boolean | true | Enabled state to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
fontColor
Returns:
string - Font color.var fontColor = labels.fontColor();
https://www.w3schools.com/html/html_colors.asp
Params:
Name | Type | Description |
---|---|---|
color | string | Font color to set. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
fontOpacity
Params:
Name | Type | Default | Description |
---|---|---|---|
opacity | number | 1 | Value to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
fontSize
Params:
Name | Type | Default | Description |
---|---|---|---|
size | string | number | 12 | Font size to set. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
fontWeight
Returns:
string | number - Font weight.var fontWeight = labels.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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
format
Returns:
function | string - Text formatter.Learn more about using the format() method.
Params:
Name | Type | Description |
---|---|---|
token | string | String token to format content label text. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
Learn more about using the format() method.
Params:
Name | Type | Description |
---|---|---|
function | function | Function to format content label text. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
getLabel
Params:
Name | Type | Description |
---|---|---|
index | number | Label index. |
Returns:
anychart.core.ui.LabelsFactory.Label - Already existing label.Try it:
getLabelsCount
hAlign
Returns:
anychart.graphics.vector.Text.HAlign | string - Text horizontal align.var hAlign = labels.hAlign();
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.graphics.vector.Text.HAlign | string | 'start' | Value to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
height
Returns:
number | string | null - Labels height.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
height | number | string | null | Height value to set. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
maxFontSize
Returns:
number - Maximum font size setting.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
size | number | string | 72 | Maximum font size to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
maxLength
Returns:
number | null - Maximum length of text.var maxLengthValue = chart.labels().maxLength(); // null by default.
Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
maxLength | number | null | null | Maximum text length to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.chart.labels().maxLength(20); // Limit characters count of all chart labels.
minFontSize
Returns:
number - Minimum font size settings.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
size | number | string | 8 | Minimum font size to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
offsetX
Returns:
number | string - Labels offsetX value.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
offset | number | string | 0 | Labels offsetX settings to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
offsetY
Returns:
number | string - Labels offsetY value.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
offset | number | string | 0 | Labels offsetY settings to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
padding
Returns:
anychart.core.utils.Padding - Labels padding.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
padding | Array.<(number|string)> | Object | number | string | {top: 2, right: 4, bottom: 2, left: 4} | Space value, object or array. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value1 | string | number | 2 | Top or top-bottom space. |
value2 | string | number | 4 | Right or right-left space. |
value3 | string | number | 2 | Bottom space. |
value4 | string | number | 4 | Left space. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
position
Returns:
string - Labels position settings.Try it:
The default value and the list of available values can be different depending on where the labels are used, e.g. with axes of different types or with different charts. Find more information in the detailed description.
Class | Default value | Available value |
anychart.charts.TreeMap | 'left-top' | 'left-top' |
anychart.charts.Cartesian | value not set | anychart.enums.Position|string |
anychart.charts.Polar |
||
anychart.charts.Scatter |
||
anychart.charts.Pareto |
||
anychart.charts.Venn |
||
anychart.charts.Cartesian3d |
||
anychart.charts.Sparkline |
||
anychart.charts.Radar |
||
anychart.charts.HeatMap | 'center' | 'center' |
anychart.charts.Pie | 'inside' | 'inside', 'outside' |
anychart.charts.Funnel | 'outside-left-in-column' | |
anychart.charts.Map | value not set | 'start', 'middle', 'end' for connector maps only |
anychart.charts.Pyramid | 'outside-left-in-column' | |
anychart.core.axes.Polar | 'by-path' | 'by-path', 'normal' |
anychart.core.axes.Circular | 'inside' | anychart.enums.SidePosition|string |
anychart.core.axes.Linear | 'outside' | anychart.enums.SidePosition|string |
anychart.core.axes.LinearGauge | 'outside' | anychart.enums.SidePosition|string |
anychart.core.axes.Map | 'outside' | anychart.enums.SidePosition|string |
anychart.core.axes.Radar | 'outside' | anychart.enums.SidePosition|string |
anychart.core.axes.Radial | 'outside' | anychart.enums.SidePosition|string |
anychart.core.axes.StockDateTime | 'outside' | anychart.enums.SidePosition|string |
anychart.core.cartesian.series.Box | 'higest' | 'higest', 'median', 'lowest', 'q1', 'q3', custom values from data |
anychart.core.cartesian.series.SplineArea | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.Spline | 'value' | 'value', custom values from data |
anychart.core.cartesian.series.RangeStepArea | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.cartesian.series.StepArea | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.RangeBar | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.cartesian.series.Column3d | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.Area |
||
anychart.core.cartesian.series.Stick |
||
anychart.core.cartesian.series.Bubble | 'value' | "zero", 'value', 'x', 'size' custom values from data |
anychart.core.cartesian.series.Bar |
||
anychart.core.cartesian.series.Area3d | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.OHLC | 'high' | 'high', 'low', 'open', 'close', 'x', custom values from data |
anychart.core.cartesian.series.Candlestick | 'high' | 'high', 'low', 'open', 'close', 'x', custom values from data |
anychart.core.cartesian.series.Column | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.RangeArea | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.cartesian.series.JumpLine | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.StepLine | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.Line | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.RangeColumn | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.cartesian.series.RangeSplineArea | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.cartesian.series.Hilo | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.cartesian.series.Marker | 'value' | "zero", 'value', custom values from data |
anychart.core.cartesian.series.Bar3d | 'value' | "zero", 'value', 'x', 'size' custom values from data |
anychart.core.map.series.Choropleth | 'value' | 'value' |
anychart.core.map.series.Bubble | 'value' | 'value' |
anychart.core.map.series.Connector | 'middle' | 'middle', 'end', 'start' |
anychart.core.map.series.Marker | 'value' | 'value' |
anychart.core.mekko.series.Mekko | 'value' | 'value', anychart.enums.Position|string |
anychart.core.polar.series.Polyline |
||
anychart.core.polar.series.Area |
||
anychart.core.polar.series.Column |
||
anychart.core.polar.series.Line |
||
anychart.core.polar.series.RangeColumn | 'high' | 'high', 'low', 'x', custom values from data |
anychart.core.polar.series.Marker | 'value' | 'value', anychart.enums.Position|string |
anychart.core.polar.series.Polygon |
||
anychart.core.radar.series.Area |
||
anychart.core.radar.series.Line |
||
anychart.core.radar.series.Marker |
||
anychart.core.scatter.series.Bubble |
||
anychart.core.scatter.series.Line |
||
anychart.core.scatter.series.Marker |
||
anychart.core.waterfall.series.Waterfall |
||
anychart.core.ui.Timeline | 'right-center' | |
anychart.standalones.ProjectTimeline |
||
anychart.standalones.ResourceTimeline |
||
anychart.core.resource.Activities | 'left-top' | |
anychart.standalones.axes.Polar | 'by-path' | 'by-path', 'normal' |
Params:
Name | Type | Default | Description |
---|---|---|---|
position | string | N/A | Labels position settings. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.positionFormatter
Returns:
function - Labels position formatter function.Params:
Name | Type | Default | Description |
---|---|---|---|
formatter | function | function() {return this['value'];} | Labels position formatter function. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
rotation
Returns:
number - Rotation angle in degrees.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
angle | number | 0 | Rotation angle in degrees. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
textIndent
Params:
Name | Type | Default | Description |
---|---|---|---|
indent | number | 0 | Text indent to set. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
textShadow
Returns:
string - String representation of text shadow.var textShadow = labels.textShadow();
Params:
Name | Type | Default | Description |
---|---|---|---|
textShadow | anychart.graphics.vector.TextShadow | string | 'none' | Text shadow to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it:
useHtml
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
width
Params:
Name | Type | Default | Description |
---|---|---|---|
width | number | string | null | Labels width to set. |
Returns:
anychart.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - 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.core.ui.LabelsFactory - Self instance for method chaining.Try it:
zIndex
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.core.ui.LabelsFactory - Self instance for method chaining.Try it: