AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.6.0 version of this document. Switch to the 8.4.0 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.
Setter for legend align settings.

Params:

NameTypeDefaultDescription
valueanychart.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:

NameTypeDefaultDescription
valuestring | 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.

height

Getter for legend height.

Returns:

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

Params:

NameTypeDefaultDescription
valuenumber | string | null
null
Value to set.

Returns:

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

hoverCursor

Getter for hover cursor settings.

Returns:

anychart.enums.Cursor | string - Hover cursor settings.
Setter for hover cursor settings.

Params:

NameTypeDefaultDescription
valueanychart.enums.Cursor | string
'pointer'
Hover cursor setting.

Returns:

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

iconTextSpacing

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

Returns:

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

Params:

NameTypeDefaultDescription
valuestring | number
5
Spacing settings.

Returns:

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

inverted

Getter for inverted settings.

Returns:

boolean - Current inverted settings.
Setter for inverted settings.

Params:

NameTypeDefaultDescription
valueboolean
false
Whether item list should be inverted or not.

Returns:

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

items

Getter for custom items.

Returns:

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

Params:

NameTypeDescription
valueArray.<anychart.core.ui.Legend.LegendItemProvider>Items.

Returns:

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

itemsFormatter

Getter for items formatter.

Returns:

function - Formatter function.
Setter for items formatter.

Params:

NameTypeDefaultDescription
valuefunction
function (a){return a}
Formatter function.

Returns:

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

itemsLayout

Getter for items layout.

Returns:

anychart.enums.Layout | string - Current items layout.
Setter for items layout.

Params:

NameTypeDefaultDescription
valuestring | 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.
Setter for items source mode.

Params:

NameTypeDefaultDescription
valuestring | anychart.enums.LegendItemsSourceMode
'default'
Items source mode.

Returns:

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

itemsSpacing

Getter for items spacing settings.

Returns:

string | number - Items spacing settings.
Setter for items spacing settings.

Params:

NameTypeDefaultDescription
valuestring | number
15
Value to set.

Returns:

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

itemsTextFormatter

Getter for items text formatter.

Returns:

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

Params:

NameTypeDescription
valuefunctionItems text formatter function.

Returns:

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

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:

NameTypeDescription
valueArray.<(number|string)> | Object | number | stringSpace value, object or array.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.
Setter for legend margin in pixels using a single simple values.

Params:

NameTypeDescription
value1string | numberTop or top-bottom space.
value2string | numberRight or right-left space.
value3string | numberBottom space.
value4string | numberLeft space.

Returns:

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

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:

NameTypeDescription
valueArray.<(number|string)> | Object | number | stringSpace value, object or array.

Returns:

anychart.core.ui.Legend - Self instance for method chaining.
Setter for legend padding setting in pixels using a several value.

Params:

NameTypeDescription
value1string | numberTop or top-bottom space.
value2string | numberRight or right-left space.
value3string | numberBottom space.
value4string | numberLeft space.

Returns:

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

paginator

Getter for paginator setting.

Returns:

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

Params:

NameTypeDescription
valueObject | boolean | nullValue to set.

Returns:

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

position

Getter for legend position setting.

Returns:

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

Params:

NameTypeDefaultDescription
valueanychart.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:

NameTypeDefaultDescription
valuenull | 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:

NameTypeDefaultDescription
valueObject | 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.
Setter for legend tooltip.

Params:

NameTypeDefaultDescription
valueObject | 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.
Setter for legend width.

Params:

NameTypeDefaultDescription
valuenumber | string | null
null
Value to set.

Returns:

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