AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.1.1 version of this document. Switch to the 8.4.0 version to see the up to date information.

class anychart.elements.LegendItem Improve this Doc

Extends: anychart.elements.Text

Inner class for representing legend item.

Methods Overview

Miscellaneous
draw()Draws legend item.
getContentBounds()Return legend item content bounds.
getHeight()Calculating actual height of legend item independently of enabled state.
getTextElement()Legend item text element.
getWidth()Calculating actual width of legend item independently of enabled state.
iconFill()Getter/setter for icon fill setting.
iconHatchFill()Getter/setter for icon fill setting.
iconStroke()Getter/setter for icon stroke setting.
iconTextSpacing()Getter/setter for iconTextSpacing setting.
iconType()Getter/setter for icon type.
maxHeight()Getter/setter for max height of legend item.
maxWidth()Getter/setter for max width of legend item.
parentBounds()Getter/setter for parentBounds.
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.

Methods Description

draw

Draws legend item.

Returns:

anychart.elements.LegendItem - An instance of anychart.elements.LegendItem class for method chaining.

getContentBounds

Return legend item content bounds.

Returns:

anychart.math.Rect - Content bounds.

getHeight

Calculating actual height of legend item independently of enabled state.

Returns:

number - Height.

getTextElement

Legend item text element.

Returns:

anychart.graphics.vector.Text - Text element.

getWidth

Calculating actual width of legend item independently of enabled state.

Returns:

number - Width.

iconFill

Getter/setter for icon fill setting.

Params:

NameTypeDescription
valueanychart.graphics.vector.FillIcon fill setting.

Returns:

anychart.graphics.vector.Fill | anychart.elements.LegendItem - Icon fill setting or self for method chaining.

iconStroke

Getter/setter for icon stroke setting.

Params:

NameTypeDescription
valueanychart.graphics.vector.StrokeIcon stroke setting.

Returns:

anychart.graphics.vector.Stroke | anychart.elements.LegendItem - Icon stroke setting or self for method chaining.

iconTextSpacing

Getter/setter for iconTextSpacing setting.

Params:

NameTypeDescription
valuenumberValue of spacing between icon and text.

Returns:

anychart.elements.LegendItem | number - Spacing between icon and text or self for method chaining.

iconType

Getter/setter for icon type.

Params:

NameTypeDescription
valuestring | functionIcon type or custom drawer function.

Returns:

string | function | anychart.elements.LegendItem - icon type or drawer function or self for method chaining.

maxHeight

Getter/setter for max height of legend item.

Params:

NameTypeDescription
valuenumberMax height setting.

Returns:

number | anychart.elements.LegendItem - Max height or self for method chaining.

maxWidth

Getter/setter for max width of legend item.

Params:

NameTypeDescription
valuenumberMax width setting.

Returns:

number | anychart.elements.LegendItem - Max width or self for method chaining.

parentBounds

Getter/setter for parentBounds.

Params:

NameTypeDescription
valueanychart.math.RectValue to set.

Returns:

anychart.math.Rect | anychart.elements.LegendItem - Parent bounds or self for method chaining.

text

Getter/setter for legend item text.

Params:

NameTypeDescription
valuestringLegend item text.

Returns:

string | anychart.elements.LegendItem - Legend item text or self for method chaining.

x

Getter/setter for X coordinate of legend item.

Params:

NameTypeDescription
valuenumber | stringNew x coordinate.

Returns:

number | string | anychart.elements.LegendItem - X coordinate or self for method chaining.

y

Getter/setter for Y coordinate of legend item.

Params:

NameTypeDescription
valuenumber | stringNew y coordinate.

Returns:

number | string | anychart.elements.LegendItem - Y coordinate or self for method chaining.