Class Legend
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LegendStyle
- Version:
- $Id: $Id
- Author:
- Vaadin
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlign()Getter for the fieldalign.Getter for the fieldbackgroundColor.Getter for the fieldborderColor.Getter for the fieldborderRadius.Getter for the fieldborderWidth.Getter for the fieldenabled.Getter for the fieldfloating.Getter for the fielditemDistance.Getter for the fielditemHiddenStyle.Getter for the fielditemHoverStyle.Getter for the fielditemMarginBottom.Getter for the fielditemMarginTop.Getter for the fielditemStyle.Getter for the fielditemWidth.Getter for the fieldlabelFormat.getLabelFormatter.Getter for the fieldlayout.Getter for the fieldmargin.Getter for the fieldmaxHeight.Getter for the fieldnavigation.Getter for the fieldpadding.Getter for the fieldreversed.getRtl()Getter for the fieldrtl.Getter for the fieldshadow.Getter for the fieldsymbolHeight.Getter for the fieldsymbolPadding.Getter for the fieldsymbolRadius.Getter for the fieldsymbolWidth.getTitle()Getter for the fieldtitle.Getter for the fielduseHTML.Getter for the fieldverticalAlign.getWidth()Getter for the fieldwidth.getX()Getter for the fieldx.getY()Getter for the fieldy.voidsetAlign(HorizontalAlign align) The horizontal alignment of the legend box within the chart area.voidsetBackgroundColor(Color backgroundColor) The background color of the legend.voidsetBorderColor(Color borderColor) The color of the drawn border around the legend.voidsetBorderRadius(Number borderRadius) The border corner radius of the legend.voidsetBorderWidth(Number borderWidth) The width of the drawn border around the legend.voidsetEnabled(Boolean enabled) Enable or disable the legend.voidsetFloating(Boolean floating) When the legend is floating, the plot area ignores it and is allowed to be placed below it.voidsetItemDistance(Number itemDistance) In a legend with horizontal layout, the itemDistance defines the pixel distance between each item.voidsetItemHiddenStyle(Style itemHiddenStyle) CSS styles for each legend item when the corresponding series or point is hidden.voidsetItemHoverStyle(Style itemHoverStyle) CSS styles for each legend item in hover mode.voidsetItemMarginBottom(Number itemMarginBottom) The pixel bottom margin for each legend item.voidsetItemMarginTop(Number itemMarginTop) The pixel top margin for each legend item.voidsetItemStyle(Style itemStyle) CSS styles for each legend item.voidsetItemWidth(Number itemWidth) The width for each legend item.voidsetLabelFormat(String labelFormat) A format string for each legend label.voidsetLabelFormatter(String _fn_labelFormatter) setLabelFormatter.voidsetLayout(LayoutDirection layout) The layout of the legend items.voidIf the plot area sized is calculated automatically and the legend is not floating, the legend margin is the space between the legend and the axis labels or plot area.voidsetMaxHeight(Number maxHeight) Maximum pixel height for the legend.voidsetNavigation(LegendNavigation navigation) Options for the paging or navigation appearing when the legend is overflown.voidsetPadding(Number padding) The inner padding of the legend box.voidsetReversed(Boolean reversed) Whether to reverse the order of the legend items compared to the order of the series or data classes as defined in the configuration object.voidWhether to show the symbol on the right side of the text rather than the left side.voidWhether to apply a drop shadow to the legend.voidsetSymbolHeight(Number symbolHeight) The pixel height of the legend item symbol.voidsetSymbolPadding(Number symbolPadding) The pixel padding between the legend item symbol and the legend item text.voidsetSymbolRadius(Number symbolRadius) The border radius of the symbol for series types that use a rectangle in the legend.voidsetSymbolWidth(Number symbolWidth) The pixel width of the legend item symbol.voidsetTitle(LegendTitle title) A title to be added on top of the legend.voidsetUseHTML(Boolean useHTML) Whether to use HTML to render the legend item texts.voidsetVerticalAlign(VerticalAlign verticalAlign) The vertical alignment of the legend box.voidThe width of the legend box.voidThe x offset of the legend relative to its horizontal alignmentalignwithin chart.spacingLeft and chart.spacingRight.voidThe vertical offset of the legend relative to it's vertical alignmentverticalAlignwithin chart.spacingTop and chart.spacingBottom.
-
Constructor Details
-
Legend
public Legend()Constructor for Legend.
-
Legend
Constructor for Legend.
- Parameters:
enabled- aBooleanobject.
-
-
Method Details
-
getAlign
Getter for the field
align.- Returns:
- a
HorizontalAlignobject. - See Also:
-
setAlign
The horizontal alignment of the legend box within the chart area. Valid values are
left,centerandright.In the case that the legend is aligned in a corner position, the
layoutoption will determine whether to place it above/below or on the side of the plot area.Defaults to: center
- Parameters:
align- aHorizontalAlignobject.
-
getBackgroundColor
Getter for the field
backgroundColor.- Returns:
- a
Colorobject. - See Also:
-
setBackgroundColor
The background color of the legend.- Parameters:
backgroundColor- aColorobject.
-
getBorderColor
Getter for the field
borderColor.- Returns:
- a
Colorobject. - See Also:
-
setBorderColor
The color of the drawn border around the legend.Defaults to: #909090
- Parameters:
borderColor- aColorobject.
-
getBorderRadius
Getter for the field
borderRadius.- Returns:
- a
Numberobject. - See Also:
-
setBorderRadius
The border corner radius of the legend.Defaults to: 0
- Parameters:
borderRadius- aNumberobject.
-
getBorderWidth
Getter for the field
borderWidth.- Returns:
- a
Numberobject. - See Also:
-
setBorderWidth
The width of the drawn border around the legend.Defaults to: 0
- Parameters:
borderWidth- aNumberobject.
-
getEnabled
Getter for the field
enabled.- Returns:
- a
Booleanobject. - See Also:
-
setEnabled
Enable or disable the legend.Defaults to: true
- Parameters:
enabled- aBooleanobject.
-
getFloating
Getter for the field
floating.- Returns:
- a
Booleanobject. - See Also:
-
setFloating
When the legend is floating, the plot area ignores it and is allowed to be placed below it.Defaults to: false
- Parameters:
floating- aBooleanobject.
-
getItemDistance
Getter for the field
itemDistance.- Returns:
- a
Numberobject. - See Also:
-
setItemDistance
In a legend with horizontal layout, the itemDistance defines the pixel distance between each item.Defaults to: 8
- Parameters:
itemDistance- aNumberobject.
-
getItemHiddenStyle
Getter for the field
itemHiddenStyle.- Returns:
- a
Styleobject. - See Also:
-
setItemHiddenStyle
CSS styles for each legend item when the corresponding series or point is hidden. Only a subset of CSS is supported, notably those options related to text. Properties are inherited fromstyleunless overridden here. Defaults to:itemHiddenStyle: { color: '#CCC' }- Parameters:
itemHiddenStyle- aStyleobject.
-
getItemHoverStyle
Getter for the field
itemHoverStyle.- Returns:
- a
Styleobject. - See Also:
-
setItemHoverStyle
CSS styles for each legend item in hover mode. Only a subset of CSS is supported, notably those options related to text. Properties are inherited fromstyleunless overridden here. Defaults to:itemHoverStyle: { color: '#000' }- Parameters:
itemHoverStyle- aStyleobject.
-
getItemMarginBottom
Getter for the field
itemMarginBottom.- Returns:
- a
Numberobject. - See Also:
-
setItemMarginBottom
The pixel bottom margin for each legend item.Defaults to: 0
- Parameters:
itemMarginBottom- aNumberobject.
-
getItemMarginTop
Getter for the field
itemMarginTop.- Returns:
- a
Numberobject. - See Also:
-
setItemMarginTop
The pixel top margin for each legend item.Defaults to: 0
- Parameters:
itemMarginTop- aNumberobject.
-
getItemStyle
Getter for the field
itemStyle.- Returns:
- a
Styleobject. - See Also:
-
setItemStyle
CSS styles for each legend item. Only a subset of CSS is supported, notably those options related to text.Defaults to: { "color": "#333333", "cursor": "pointer", "fontSize": "12px", "fontWeight": "bold" }
- Parameters:
itemStyle- aStyleobject.
-
getItemWidth
Getter for the field
itemWidth.- Returns:
- a
Numberobject. - See Also:
-
setItemWidth
The width for each legend item. This is useful in a horizontal layout with many items when you want the items to align vertically. .- Parameters:
itemWidth- aNumberobject.
-
getLabelFormat
Getter for the field
labelFormat.- Returns:
- a
Stringobject. - See Also:
-
setLabelFormat
A format string for each legend label. Available variables relates to properties on the series, or the point in case of pies.Defaults to: {name}
- Parameters:
labelFormat- aStringobject.
-
getLabelFormatter
getLabelFormatter.
- Returns:
- a
Stringobject.
-
setLabelFormatter
setLabelFormatter.
- Parameters:
_fn_labelFormatter- aStringobject.
-
getLayout
Getter for the field
layout.- Returns:
- a
LayoutDirectionobject. - See Also:
-
setLayout
The layout of the legend items. Can be one of "horizontal" or "vertical".Defaults to: horizontal
- Parameters:
layout- aLayoutDirectionobject.
-
getMargin
Getter for the field
margin.- Returns:
- a
Numberobject. - See Also:
-
setMargin
If the plot area sized is calculated automatically and the legend is not floating, the legend margin is the space between the legend and the axis labels or plot area.Defaults to: 12
- Parameters:
margin- aNumberobject.
-
getMaxHeight
Getter for the field
maxHeight.- Returns:
- a
Numberobject. - See Also:
-
setMaxHeight
Maximum pixel height for the legend. When the maximum height is extended, navigation will show.- Parameters:
maxHeight- aNumberobject.
-
getPadding
Getter for the field
padding.- Returns:
- a
Numberobject. - See Also:
-
setPadding
The inner padding of the legend box.Defaults to: 8
- Parameters:
padding- aNumberobject.
-
getReversed
Getter for the field
reversed.- Returns:
- a
Booleanobject. - See Also:
-
setReversed
Whether to reverse the order of the legend items compared to the order of the series or data classes as defined in the configuration object.Defaults to: false
- Parameters:
reversed- aBooleanobject.
-
getRtl
Getter for the field
rtl.- Returns:
- a
Booleanobject. - See Also:
-
setRtl
Whether to show the symbol on the right side of the text rather than the left side. This is common in Arabic and Hebraic.Defaults to: false
- Parameters:
rtl- aBooleanobject.
-
getShadow
Getter for the field
shadow.- Returns:
- a
Booleanobject. - See Also:
-
setShadow
Whether to apply a drop shadow to the legend. AbackgroundColoralso needs to be applied for this to take effect. The shadow can also be an object configuration containingcolor,offsetX,offsetY,opacityandwidth.Defaults to: false
- Parameters:
shadow- aBooleanobject.
-
getSymbolHeight
Getter for the field
symbolHeight.- Returns:
- a
Numberobject. - See Also:
-
setSymbolHeight
The pixel height of the legend item symbol. Defaults to font size for regular item symbols as well as for gradient symbols on horizontal color axis and200for gradient symbols on vertical color axis.- Parameters:
symbolHeight- aNumberobject.
-
getSymbolPadding
Getter for the field
symbolPadding.- Returns:
- a
Numberobject. - See Also:
-
setSymbolPadding
The pixel padding between the legend item symbol and the legend item text.Defaults to: 5
- Parameters:
symbolPadding- aNumberobject.
-
getSymbolRadius
Getter for the field
symbolRadius.- Returns:
- a
Numberobject. - See Also:
-
setSymbolRadius
The border radius of the symbol for series types that use a rectangle in the legend.Defaults to: 0
- Parameters:
symbolRadius- aNumberobject.
-
getSymbolWidth
Getter for the field
symbolWidth.- Returns:
- a
Numberobject. - See Also:
-
setSymbolWidth
The pixel width of the legend item symbol. Defaults to16for regular item symbols,200for gradient symbols on horizontal color axis and12for gradient symbols on vertical color axis.- Parameters:
symbolWidth- aNumberobject.
-
getTitle
Getter for the field
title.- Returns:
- a
LegendTitleobject. - See Also:
-
setTitle
A title to be added on top of the legend.- Parameters:
title- aLegendTitleobject.
-
getUseHTML
Getter for the field
useHTML.- Returns:
- a
Booleanobject. - See Also:
-
setUseHTML
Whether to use HTML to render the legend item texts. Prior to 1.1.7, when using HTML, legend.navigation was disabled.
Defaults to: false
- Parameters:
useHTML- aBooleanobject.
-
getVerticalAlign
Getter for the field
verticalAlign.- Returns:
- a
VerticalAlignobject. - See Also:
-
setVerticalAlign
The vertical alignment of the legend box. Can be one of
top,middleorbottom. Vertical position can be further determined by theyoption.In the case that the legend is aligned in a corner position, the
layoutoption will determine whether to place it above/below or on the side of the plot area.Defaults to: bottom
- Parameters:
verticalAlign- aVerticalAlignobject.
-
getWidth
Getter for the field
width.- Returns:
- a
Numberobject. - See Also:
-
setWidth
The width of the legend box.- Parameters:
width- aNumberobject.
-
getX
Getter for the field
x.- Returns:
- a
Numberobject. - See Also:
-
setX
The x offset of the legend relative to its horizontal alignmentalignwithin chart.spacingLeft and chart.spacingRight. Negative x moves it to the left, positive x moves it to the right.Defaults to: 0
- Parameters:
x- aNumberobject.
-
getY
Getter for the field
y.- Returns:
- a
Numberobject. - See Also:
-
setY
The vertical offset of the legend relative to it's vertical alignmentverticalAlignwithin chart.spacingTop and chart.spacingBottom. Negative y moves it up, positive y moves it down.Defaults to: 0
- Parameters:
y- aNumberobject.
-