class anychart.core.utils.LegendItemSettings Improve this Doc
Extends: anychart.core.Text
Helper class for maintaining legend item settings for series legend icon
Methods Overview
Specific settings | |
format() | Item text. |
iconMarkerType() | Marker type. |
iconSize() | Icon size. |
iconType() | Icon type settings. |
text() | Item text. |
Advanced Text Settings | |
fontVariant() | Font variant settings. |
letterSpacing() | Text letter spacing settings. |
textDirection() | Text direction settings. |
textIndent() | Text indent settings. |
textOverflow() | Text overflow settings. |
textWrap() | Text wrap settings. |
useHtml() | Text useHtml settings. |
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() | Icon fill settings |
iconHatchFill() | Icon hatch fill settings |
iconMarkerFill() | Icon marker fill settings. |
iconMarkerStroke() | Icon marker stroke settings. |
iconStroke() | Icon stroke settings |
Events | |
disablePointerEvents() | Pointer events settings. |
listen() | Adds an event listener. |
listenOnce() | Adds a single time event listener. |
removeAllListeners() | Removes all listeners. |
unlisten() | Removes the listener. |
unlistenByKey() | Removes the listener by the key. |
Export | |
print() | Prints all elements. |
Interactivity | |
disabled() | Disabled settings |
enabled() | Element state (enabled or disabled). |
iconEnabled() | Settings showing icons. |
selectable() | Text selectable option. |
Size and Position | |
zIndex() | Z-index of the element. |
Text Settings | |
textSettings() | Text settings. |
Miscellaneous | |
iconTextSpacing() | Spacing between icon and text |
Methods Description
disablePointerEvents
Returns:
boolean - Flag of the current state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | false | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
disabled
Returns:
boolean - Disabled setting.Try it:
Params:
Name | Type | Description |
---|---|---|
value | boolean | Is this item disabled. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
enabled
Returns:
boolean - The current element state.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | true | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - 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 |
---|---|---|---|
value | string | "#7c868e" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontDecoration
Returns:
anychart.graphics.vector.Text.Decoration | string - The current font decoration.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.Decoration | string | "none" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontFamily
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | "Verdana", Helvetica, Arial, sans-serif | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontOpacity
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 1 | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontSize
Returns:
string | number - Current font size.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | number | 16 | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontStyle
Returns:
anychart.graphics.vector.Text.FontStyle | string - The current font style.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.FontStyle | string | "normal" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontVariant
Returns:
anychart.graphics.vector.Text.FontVariant | string - The current font variant.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.FontVariant | string | "normal" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
fontWeight
Returns:
string | number - The current font weight.Try it:
https://www.w3schools.com/cssref/pr_font_weight.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | number | "normal" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
format
Returns:
string - Legend item textFormatter.Learn more about using format() method.
Params:
Name | Type | Description |
---|---|---|
value | string | function | Function or string token to format legend item text. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
hAlign
Returns:
anychart.graphics.vector.Text.HAlign | string - The current text horizontal align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.HAlign | string | "start" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconEnabled
Returns:
boolean - IconEnabled settings.Try it:
Params:
Name | Type | Description |
---|---|---|
value | boolean | Whether to show item icon or not. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconFill
Returns:
anychart.graphics.vector.Fill | function - Current fill settings.Params:
Name | Type | Description |
---|---|---|
value | anychart.graphics.vector.Fill | Color as an object or a string. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
color | string | Color as a string. |
opacity | number | Color opacity. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
keys | Array.<(anychart.graphics.vector.GradientKey|string)> | Gradient keys. |
angle | number | Gradient angle. |
mode | boolean | anychart.graphics.vector.Rect | Object | Gradient mode. |
opacity | number | Gradient opacity. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
keys | Array.<(anychart.graphics.vector.GradientKey|string)> | Color-stop gradient keys. |
cx | number | X ratio of center radial gradient. |
cy | number | Y ratio of center radial gradient. |
mode | anychart.graphics.math.Rect | If defined then userSpaceOnUse mode, else objectBoundingBox. |
opacity | number | Gradient opacity. |
fx | number | X ratio of focal point. |
fy | number | Y ratio of focal point. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconHatchFill
Returns:
anychart.graphics.vector.PatternFill | anychart.graphics.vector.HatchFill | function - Current hatch fill.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.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconMarkerFill
Returns:
anychart.graphics.vector.Fill | string - Current fill settings.Params:
Name | Type | Description |
---|---|---|
fillOrColorOrKeys | anychart.graphics.vector.Fill | !Array.<(anychart.graphics.vector.GradientKey|string)> | null | Fill, color or gradient keys. |
opacityOrAngleOrCx | number | Color opacity or X ratio of center radial gradient. |
modeOrCy | number | boolean | anychart.graphics.math.Rect | Object | Gradient mode or Y ratio of center radial gradient. |
opacityOrMode | number | anychart.graphics.math.Rect | Object | null | If defined then userSpaceOnUse mode, else objectBoundingBox. Opacity. |
opacity | number | Opacity of the gradient. |
fx | number | X ratio of focal point. |
fy | number | Y ratio of focal point. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconMarkerStroke
Returns:
anychart.graphics.vector.Stroke | string - Current icon marker stroke settings.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
color | anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null | Stroke settings. | |
thickness | number | 1 | Line thickness. |
dashpattern | string | Controls the pattern of dashes and gaps used to stroke paths. | |
lineJoin | anychart.graphics.vector.StrokeLineJoin | Line join style. | |
lineCap | anychart.graphics.vector.StrokeLineCap | Style of line cap. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconMarkerType
Returns:
anychart.enums.MarkerType | string | function - Current marker type.Try it:
Params:
Name | Type | Description |
---|---|---|
value | anychart.enums.MarkerType | string | function | Marker type. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconSize
Params:
Name | Type | Description |
---|---|---|
value | number | string | Icon size setting. |
Returns:
anychart.core.utils.LegendItemSettings - Self for method chaining.Try it:
iconStroke
Returns:
function | anychart.graphics.vector.Stroke - Current settings item icon.Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | function | null | null | Stroke settings. |
thickness | number | Line thickness. | |
dashpattern | string | Controls the pattern of dashes and gaps used to stroke paths. | |
lineJoin | anychart.graphics.vector.StrokeLineJoin | Line join style. | |
lineCap | anychart.graphics.vector.StrokeLineCap | Line cap style. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconTextSpacing
Returns:
number - Current spacing between icon and text.Try it:
Params:
Name | Type | Description |
---|---|---|
value | number | Value of spacing between icon and text. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
iconType
Returns:
anychart.enums.LegendItemIconType | string | function - Icon type or drawer function.Try it:
Params:
Name | Type | Description |
---|---|---|
value | anychart.enums.LegendItemIconType | string | function | Icon type or custom drawer function. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
letterSpacing
Returns:
string | number - The current letter spacing.Try it:
https://www.w3schools.com/cssref/pr_text_letter-spacing.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | number | "normal" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
lineHeight
Returns:
string | number - The current text line height.Try it:
https://www.w3schools.com/cssref/pr_dim_line-height.asp
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | number | "normal" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
listen
Note Notice that if the existing listener is one-off (added using listenOnce), it will cease to be such after calling the listen() method.
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. Function that looks like function(event){
// event.actualTarget - actual event target
// event.currentTarget - current event target
// event.iterator - event iterator
// event.originalEvent - original event
// event.point - event point
// event.pointIndex - event point index
} . | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
listenOnce
If the event handler being added already exists, listenOnce will do nothing.
Note In particular, if the handler is already registered using listen(), listenOnce() will not make it one-off. Similarly, if a one-off listener already exists, listenOnce will not change it (it wil remain one-off).
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
paperSizeOrOptions | anychart.graphics.vector.PaperSize | Object | Paper size or object with options. | |
landscape | boolean | false | Flag of landscape. |
Try it:
removeAllListeners
Params:
Name | Type | Description |
---|---|---|
type | string | Type of event to remove, default is to remove all types. |
Returns:
number - Number of listeners removed.Try it:
selectable
Returns:
boolean - The current text selectable option.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | false | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
text
Returns:
string - Current legend item text.Try it:
Params:
Name | Type | Description |
---|---|---|
value | string | function | Legend item text. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
textDirection
Returns:
anychart.graphics.vector.Text.Direction | string - Current text direction.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.Direction | string | "ltr" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
textIndent
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0 | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
textOverflow
Returns:
anychart.graphics.vector.Text.TextOverflow | string - The current text overflow settings.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.TextOverflow | string | "" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - 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 the setting.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,
"textWrap": smth,
"textOverflow": smth,
"selectable": smth,
"useHtml": smth
} . |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
Params:
Name | Type | Description |
---|---|---|
name | string | Setting name. |
value | string | number | boolean | function | Settings value. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
textWrap
Returns:
anychart.graphics.vector.Text.TextWrap | string - The current text wrap settings.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.TextWrap | string | "byLetter" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
unlisten
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
boolean - Whether any listener was removed.Try it:
unlistenByKey
Params:
Name | Type | Description |
---|---|---|
key | Object | The key returned by listen() or listenOnce(). |
Returns:
boolean - Whether any listener was removed.Try it:
useHtml
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | false | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
vAlign
Returns:
anychart.graphics.vector.Text.VAlign | string - The current text vertical align.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.graphics.vector.Text.VAlign | string | "top" | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it:
zIndex
Returns:
number - The current zIndex.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0 | Value to set. |
Returns:
anychart.core.utils.LegendItemSettings - Self instance for method chaining.Try it: