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

class anychart.core.ui.Legend Improve this Doc

Extends: anychart.core.Text

Legend element.

Methods Overview

Miscellaneous
align()Getter for legend align settings.
background()Getter for legend background.
getRemainingBounds()Getter for remain bounds after legend.
height()Getter for legend height.
hoverCursor()Getter for hover cursor settings.
iconTextSpacing()Getter for spacing between icon and text in a legend item.
inverted()Getter for inverted settings.
items()Getter for custom items.
itemsFormatter()Getter for items formatter.
itemsLayout()Getter for items layout.
itemsSourceMode()Getter for items source mode.
itemsSpacing()Getter for items spacing settings.
itemsTextFormatter()Getter for items text formatter.
margin()Getter for the current margin setting.
padding()Getter for legend padding setting.
paginator()Getter for paginator setting.
position()Getter for legend position setting.
title()Getter for legend title.
titleSeparator()Getter for title separator setting.
tooltip()Getter for legend tooltip.
width()Getter for legend width.

Methods Description

align

Getter for legend align settings.

Returns:

anychart.enums.Align string - Legend align.

Try it:

Setter for legend align settings.

Params:

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

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

background

Getter for legend background.

Returns:

anychart.core.ui.Background - Current background settings.
Setter for legend background.

Params:

Name Type Default Description
value string | Object | null | boolean
true
Background setting.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

getRemainingBounds

Getter for remain bounds after legend.

Returns:

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

Try it:

height

Getter for legend height.

Returns:

number string null - Current height.

Try it:

Setter for legend height.

Params:

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

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

hoverCursor

Getter for hover cursor settings.

Returns:

anychart.enums.Cursor string - Hover cursor settings.

Try it:

Setter for hover cursor settings.

Params:

Name Type Default Description
value anychart.enums.Cursor | string
'pointer'
Hover cursor setting.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

iconTextSpacing

Getter for spacing between icon and text in a legend item.

Returns:

number - Spacing settings.

Try it:

Setter for spacing between icon and text in a legend item.

Params:

Name Type Default Description
value string | number
5
Spacing settings.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

inverted

Getter for inverted settings.

Returns:

boolean - Current inverted settings.

Try it:

Setter for inverted settings.

Params:

Name Type Default Description
value boolean
false
Whether item list should be inverted or not.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

items

Getter for custom items.

Returns:

Array.<anychart.core.ui.Legend.LegendItemProvider> - Current custom item.
Setter for custom items.

Params:

Name Type Description
value Array.<anychart.core.ui.Legend.LegendItemProvider> Items.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

itemsFormatter

Getter for items formatter.

Returns:

function - Formatter function.
Setter for items formatter.

Params:

Name Type Default Description
value function
function (a){return a}
Formatter function.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

itemsLayout

Getter for items layout.

Returns:

anychart.enums.Layout string - Current items layout.

Try it:

Setter for items layout.

Params:

Name Type Default Description
value string | anychart.enums.Layout
'horizontal'
Layout type for legend items.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

itemsSourceMode

Getter for items source mode.

Returns:

string anychart.enums.LegendItemsSourceMode - Items source mode.

Try it:

Setter for items source mode.

Params:

Name Type Default Description
value string | anychart.enums.LegendItemsSourceMode
'default'
Items source mode.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

itemsSpacing

Getter for items spacing settings.

Returns:

string number - Items spacing settings.

Try it:

Setter for items spacing settings.

Params:

Name Type Default Description
value string | number
15
Value to set.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

itemsTextFormatter

Getter for items text formatter.

Returns:

function - Items text formatter function.
Setter for items text formatter.

Params:

Name Type Description
value function Items text formatter function.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

margin

Getter for the current margin setting.

Returns:

anychart.core.utils.Margin - Current legend margin.
Setter for legend margin in pixels using a single value.

Params:

Name Type Description
value Array.<(number|string)> | Object | number | string Space value, object or array.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

Setter for legend margin in pixels using a single simple values.

Params:

Name Type Description
value1 string | number Top or top-bottom space.
value2 string | number Right or right-left space.
value3 string | number Bottom space.
value4 string | number Left space.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

padding

Getter for legend padding setting.

Returns:

anychart.core.utils.Padding - Current legend padding.
Setter for legend padding in pixels using a single value.

Params:

Name Type Description
value Array.<(number|string)> | Object | number | string Space value, object or array.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

Setter for legend padding setting in pixels using a several value.

Params:

Name Type Description
value1 string | number Top or top-bottom space.
value2 string | number Right or right-left space.
value3 string | number Bottom space.
value4 string | number Left space.

Returns:

anychart.core.ui.Legend - Padding or self for method chaining.

Try it:

paginator

Getter for paginator setting.

Returns:

anychart.core.ui.Paginator - Current settings.
Setter for paginator setting.

Params:

Name Type Description
value Object | boolean | null Value to set.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it:

position

Getter for legend position setting.

Returns:

anychart.enums.Orientation string - Legend position.

Try it:

Setter for legend position setting.

Params:

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

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

title

Getter for legend title.

Returns:

anychart.core.ui.Title - Title settings.
Setter for legend title.

Params:

Name Type Default Description
value null | boolean | Object | string
false
Value to set.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

titleSeparator

Getter for title separator setting.

Returns:

anychart.core.ui.Separator - Current settings.
Setter for title separator setting.

Params:

Name Type Default Description
value Object | boolean | null
false
Value to set.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

tooltip

Getter for legend tooltip.

Returns:

anychart.core.ui.Tooltip - Tooltip instance.

Try it:

Setter for legend tooltip.

Params:

Name Type Default Description
value Object | boolean | null
true
Tooltip settings.

Returns:

anychart.core.ui.Legend anychart.core.ui.Tooltip - Self instance for method chaining.

width

Getter for legend width.

Returns:

number string null - Current width.

Try it:

Setter for legend width.

Params:

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

Returns:

anychart.core.ui.Legend - Self instance for method chaining.

Try it: