class anychart.standalones.LabelsFactory Improve this Doc
Extends: anychart.core.ui.LabelsFactory
The LabelsFactory class contains methods for configuring standalones labels factory.
Methods Overview
Specific settings | |
clip() | Labels clip settings. |
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. |
minFontSize() | Minimum font size setting. |
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 | |
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. |
Miscellaneous | |
add() | Creates a new instance of anychart.core.ui.LabelsFactory.Label, saves it in the factory |
clear() | Clears an array of labels. |
container() | Container for the elements. |
draw() | Labels drawing. |
measure() | Measure labels and returns labels bounds. |
measureWithTransform() | Measures label in its coordinate system and returns bounds as an array of points in parent coordinate system. |
parentBounds() | Getter for the parent bounds. |
Methods Description
add
Params:
Name | Type | Description |
---|---|---|
formatProvider | * | Object that provides info for format function. |
positionProvider | * | Object that provides info for positionFormatter function. |
index | number | Label index. |
Returns:
anychart.core.ui.LabelsFactory.Label - Returns new label instance.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.standalones.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.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.clear
Params:
Name | Type | Description |
---|---|---|
index | number | If set, removes only the label that is in passed index. |
Returns:
anychart.standalones.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.standalones.LabelsFactory - Self instance for method chaining.container
Returns:
anychart.graphics.vector.Layer | anychart.graphics.vector.Stage - An instance of the class for method chaining.Params:
Name | Type | Description |
---|---|---|
element | anychart.graphics.vector.Layer | anychart.graphics.vector.Stage | string | Element | The value to set. |
Returns:
anychart.standalones.LabelsFactory - Self instance for method chaining.disablePointerEvents
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.LabelsFactory - Self instance for method chaining.Try it:
draw
Returns:
anychart.standalones.LabelsFactory - Returns itself for chaining.enabled
Returns:
boolean - Element state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | null | boolean | true | Enabled state to set. |
Returns:
anychart.standalones.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.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
fontOpacity
Params:
Name | Type | Default | Description |
---|---|---|---|
opacity | number | 1 | Value to set. |
Returns:
anychart.standalones.LabelsFactory - Self instance for method chaining.Try it:
fontSize
Params:
Name | Type | Default | Description |
---|---|---|---|
size | string | number | 12 | Font size to set. |
Returns:
anychart.standalones.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.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
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.standalones.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.standalones.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.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
measure
Params:
Name | Type | Description |
---|---|---|
formatProviderOrLabel | * | anychart.core.ui.LabelsFactory.Label | Object that provides info for format function. |
positionProvider | * | Object that provides info for positionFormatter function. |
settings | Object | Settings to set. |
cacheIndex | number | Index of the cash. |
Returns:
anychart.math.Rect - Labels bounds.measureWithTransform
Params:
Name | Type | Description |
---|---|---|
formatProviderOrLabel | * | anychart.core.ui.LabelsFactory.Label | Object that provides info for format function. |
positionProvider | * | Object that provides info for positionFormatter function. |
settings | Object | Settings to set. |
cacheIndexIndex | number | of the cash. |
Returns:
Array.<number> - Label bounds.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.standalones.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.standalones.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.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
parentBounds
Bounds that would be used in case of percent size calculations. Expects pixel values only.
Returns:
anychart.math.Rect - The parent bounds of the element.Bounds that would be used in case of percent size calculations. Expects pixel values only.
Params:
Name | Type | Description |
---|---|---|
bounds | anychart.math.Rect | Object | number | null | Bounds to set. |
Returns:
anychart.standalones.LabelsFactory - Self instance for method chaining.Bounds that would be used in case of percent size calculations. Expects pixel values only.
Params:
Name | Type | Description |
---|---|---|
left | number | Left space. |
top | number | Top space. |
width | number | Element width. |
height | number | Element height. |
Returns:
anychart.standalones.LabelsFactory - Self instance for method chaining.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.standalones.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.standalones.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.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
textIndent
Params:
Name | Type | Default | Description |
---|---|---|---|
indent | number | 0 | Text indent to set. |
Returns:
anychart.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
useHtml
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
width
Params:
Name | Type | Default | Description |
---|---|---|---|
width | number | string | null | Labels width to set. |
Returns:
anychart.standalones.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.standalones.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.standalones.LabelsFactory - Self instance for method chaining.Try it:
zIndex
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.standalones.LabelsFactory - Self instance for method chaining.Try it: