Top
You are looking at an outdated 7.2.0 version of this document. Switch to the 7.14.3 version to see the up to date information.

class anychart.elements.Legend Improve this Doc

Extends: anychart.elements.Text

Legend element.

Methods Overview

Miscellaneous
align()Getter for legend align setting.
background()Getter for legend background.
draw()Draw legend.
getRemainingBounds()
height()Getter for legend height.
iconTextSpacing()Getter for spacing between icon and text in legend item.
itemsLayout()Sets items layout.
itemsProvider()Getter for items provider.
itemsSpacing()Getter for items spacing setting.
margin()Legend margin setting.
padding()Legend padding setting.
paginator()Getter for paginator setting.
parentBounds()Getter for legend parent element bounds.
position()Getter for legend position setting.
title()Getter for legend title.
titleSeparator()Getter for title separator setting.
tooltip()Legend tooltip.
width()Getter for legend width.

Methods Description

align

Getter for legend align setting.

Returns:

anychart.enums.Align - Legend align.
Setter for legend align setting.

Params:

Name Type Description
value anychart.enums.Align | string Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

background

Getter for legend background.

Returns:

anychart.elements.Background - Background or self for method chaining.
Setter for legend background.

Params:

Name Type Description
value anychart.elements.Background Background setting.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

draw

Draw legend.

Returns:

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

getRemainingBounds

Returns:

anychart.math.Rect - Bounds that remain after legend.

height

Getter for legend height.

Returns:

number string null - Current height.
Setter for legend height.

Params:

Name Type Description
value number | string | null Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

iconTextSpacing

Getter for spacing between icon and text in legend item.

Returns:

number - Spacing setting.
Setter for spacing between icon and text in legend item.

Params:

Name Type Description
value string | number Spacing setting.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

itemsLayout

Sets items layout.

Params:

Name Type Description
value string Layout type for legend items.

Returns:

anychart.enums.Layout anychart.elements.Legend - Items layout or self for method chaining.

itemsProvider

Getter for items provider.

Returns:

Array.<anychart.elements.Legend.LegendItemProvider> - Array of legend item provider.
Setter for items provider.

Params:

Name Type Description
value Array.<anychart.elements.Legend.LegendItemProvider> Items provider.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

itemsSpacing

Getter for items spacing setting.

Returns:

string number - Items spacing setting.
Setter for items spacing setting.

Params:

Name Type Description
value string | number Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

margin

Legend margin setting.

Params:

Name Type Description
spaceOrTopOrTopAndBottom string | number | anychart.utils.Space Space object or top or top and bottom space.
rightOrRightAndLeft string | number Right or right and left space.
bottom string | number Bottom space.
left string | number Left space.

Returns:

anychart.elements.Legend anychart.utils.Margin - Margin or self for method chaining.

padding

Legend padding setting.

Params:

Name Type Description
spaceOrTopOrTopAndBottom string | number | anychart.utils.Space Space object or top or top and bottom space.
rightOrRightAndLeft string | number Right or right and left space.
bottom string | number Bottom space.
left string | number Left space.

Returns:

anychart.elements.Legend anychart.utils.Padding - Padding or self for method chaining.

paginator

Getter for paginator setting.

Returns:

anychart.elements.Separator - Current settings.
Setter for paginator setting.
Note: To turn Paginator off you need to send null or 'none'.

Params:

Name Type Description
value Object | anychart.elements.Paginator | string | null Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

parentBounds

Getter for legend parent element bounds.

Returns:

anychart.math.Rect - Parent element bounds.
Setter for legend's parent element bounds.

Params:

Name Type Description
value anychart.math.Rect Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

position

Getter for legend position setting.

Returns:

anychart.enums.Orientation - Legend position.
Setter for legend position setting.

Params:

Name Type Description
value anychart.enums.Orientation | string Legend position.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

title

Getter for legend title.

Returns:

anychart.elements.Title - Title settings.
Setter for legend title.
Note: to turn title off you have to send null or 'none'.

Params:

Name Type Description
value string | null | anychart.elements.Title Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

titleSeparator

Getter for title separator setting.

Returns:

anychart.elements.Separator - Current settings.
Setter for title separator setting.
Note: To turn off titleSeparatoryou have to send null or 'none'.

Params:

Name Type Description
value Object | string | null | anychart.elements.Separator Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.

tooltip

Legend tooltip.

Params:

Name Type Description
value null | string | Object | anychart.elements.Tooltip Tooltip settings.

Returns:

anychart.elements.Legend anychart.elements.Tooltip - Tooltip instance or self for method chaining.

width

Getter for legend width.

Returns:

number string null - Current width.
Setter for legend width.

Params:

Name Type Description
value number | string | null Value to set.

Returns:

anychart.elements.Legend - An instance of the anychart.elements.Legend class for method chaining.