class anychart.core.ui.LegendItem Improve this Doc
Extends: anychart.core.Text
Inner class for representing legend item.
Methods Overview
Specific settings | |
getTextElement() | Legend item text element. |
iconType() | Getter/setter for icon type. |
text() | Getter/setter for legend item text. |
x() | Getter/setter for X coordinate of legend item. |
y() | Getter/setter for Y coordinate of legend item. |
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. |
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 | |
iconFill() | Getter/setter for icon fill setting. |
iconHatchFill() | Hatch fill settings. |
iconStroke() | Getter/setter for icon stroke setting. |
Events | |
disablePointerEvents() | Pointer events settings. |
Interactivity | |
enabled() | Element state (enabled or disabled). |
selectable() | Text selectable option. |
Size and Position | |
getContentBounds() | Return legend item content bounds. |
getHeight() | Calculating actual height of legend item independently of enabled state. |
getWidth() | Calculating actual width of legend item independently of enabled state. |
iconTextSpacing() | Getter/setter for iconTextSpacing setting. |
maxHeight() | Legend item maximum width. |
maxWidth() | Legend item maximum width. |
zIndex() | Z-index of the element. |
Text Settings | |
textSettings() | Text settings. |
Miscellaneous | |
draw() | Draws legend item. |
Methods Description
disablePointerEvents
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.Try it:
draw
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.enabled
Returns:
boolean - Element state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Enabled state to set. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.if (!element.enabled()) element.enabled(true);
Try it:
fontColor
https://www.w3schools.com/html/html_colors.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
color | string | '#7c868e' | Value to set. |
Returns:
anychart.core.ui.LegendItem - 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.LegendItem - 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.LegendItem - Self instance for method chaining.Try it:
fontOpacity
Params:
Name | Type | Default | Description |
---|---|---|---|
opacity | number | 1 | Value to set. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.Try it:
fontSize
Params:
Name | Type | Default | Description |
---|---|---|---|
size | string | number | 16 | Font size to set. |
Returns:
anychart.core.ui.LegendItem - 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.LegendItem - 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.LegendItem - 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.core.ui.LegendItem - Self instance for method chaining.Try it:
getContentBounds
Returns:
anychart.math.Rect - Content bounds.getHeight
Returns:
number - Height.getTextElement
Returns:
anychart.graphics.vector.Text - Text element.getWidth
Returns:
number - Width.hAlign
Returns:
anychart.graphics.vector.Text.HAlign | string - Text horizontal align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
align | anychart.graphics.vector.Text.HAlign | string | 'start' | Value to set. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.Try it:
iconFill
Params:
Name | Type | Description |
---|---|---|
value | anychart.graphics.vector.Fill | Icon fill setting. |
Returns:
anychart.graphics.vector.Fill | anychart.core.ui.LegendItem - Icon fill setting or self for method chaining.iconHatchFill
Returns:
anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function - The icon hatch fill setings.Params:
Name | Type | Description |
---|---|---|
patternFillOrType | anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function | anychart.graphics.vector.HatchFill.HatchFillType | string | PatternFill or HatchFill instance or type of hatch fill. |
color | string | Color. |
thickness | number | Thickness. |
size | number | Pattern size. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.iconStroke
Params:
Name | Type | Description |
---|---|---|
value | anychart.graphics.vector.Stroke | Icon stroke setting. |
Returns:
anychart.graphics.vector.Stroke | anychart.core.ui.LegendItem - Icon stroke setting or self for method chaining.iconTextSpacing
Params:
Name | Type | Description |
---|---|---|
value | number | Value of spacing between icon and text. |
Returns:
anychart.core.ui.LegendItem | number - Spacing between icon and text or self for method chaining.iconType
Params:
Name | Type | Description |
---|---|---|
value | string | function | Icon type or custom drawer function. |
Returns:
string | function | anychart.core.ui.LegendItem - icon type or drawer function or self for method chaining.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.LegendItem - 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.LegendItem - Self instance for method chaining.Try it:
maxHeight
Returns:
number | string - Maximum height.Params:
Name | Type | Description |
---|---|---|
value | number | string | Maximum height setting. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.maxWidth
Returns:
number | string - Maximum width.Params:
Name | Type | Description |
---|---|---|
value | number | string | Maximum width setting. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.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.LegendItem - Self instance for method chaining.Try it:
text
Params:
Name | Type | Description |
---|---|---|
value | string | Legend item text. |
Returns:
string | anychart.core.ui.LegendItem - Legend item text or self for method chaining.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.LegendItem - Self instance for method chaining.Try it:
textIndent
Params:
Name | Type | Default | Description |
---|---|---|---|
indent | number | 0 | Text indent to set. |
Returns:
anychart.core.ui.LegendItem - 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.LegendItem - 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.core.ui.LegendItem - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
name | string | Setting name. |
settings | string | number | boolean | function | Text settings. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.Try it:
useHtml
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Enabled state to set. |
Returns:
anychart.core.ui.LegendItem - 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.LegendItem - 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.LegendItem - 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.LegendItem - Self instance for method chaining.Try it:
x
Params:
Name | Type | Description |
---|---|---|
value | number | string | New x coordinate. |
Returns:
number | string | anychart.core.ui.LegendItem - X coordinate or self for method chaining.y
Params:
Name | Type | Description |
---|---|---|
value | number | string | New y coordinate. |
Returns:
number | string | anychart.core.ui.LegendItem - Y coordinate or self for method chaining.zIndex
Params:
Name | Type | Default | Description |
---|---|---|---|
zIndex | number | 0 | Value to set. |
Returns:
anychart.core.ui.LegendItem - Self instance for method chaining.Try it: