com.vaadin.flow.component.charts.model.
Class Legend
- java.lang.Object
-
- com.vaadin.flow.component.charts.model.AbstractConfigurationObject
-
- com.vaadin.flow.component.charts.model.Legend
-
All Implemented Interfaces:
Direct Known Subclasses:
@Generated(value="This class is generated and shouldn\'t be modified", comments="Incorrect and missing API should be reported to https://github.com/vaadin/vaadin-charts-flow/issues/new") public class Legend extends AbstractConfigurationObject
The legend is a box containing a symbol and name for each series item or point item in the chart.
See Also:
-
-
Method Summary
All Methods Modifier and Type Method and Description HorizontalAlign
getAlign()
Color
getBackgroundColor()
Color
getBorderColor()
Number
getBorderRadius()
Number
getBorderWidth()
Boolean
getEnabled()
Boolean
getFloating()
Number
getItemDistance()
Style
getItemHiddenStyle()
Style
getItemHoverStyle()
Number
getItemMarginBottom()
Number
getItemMarginTop()
Style
getItemStyle()
Number
getItemWidth()
String
getLabelFormat()
String
getLabelFormatter()
LayoutDirection
getLayout()
Number
getLineHeight()
Number
getMargin()
Number
getMaxHeight()
LegendNavigation
getNavigation()
Number
getPadding()
Boolean
getReversed()
Boolean
getRtl()
Boolean
getShadow()
Boolean
getSquareSymbol()
Number
getSymbolHeight()
Number
getSymbolPadding()
Number
getSymbolRadius()
Number
getSymbolWidth()
LegendTitle
getTitle()
Boolean
getUseHTML()
VerticalAlign
getVerticalAlign()
Number
getWidth()
Number
getX()
Number
getY()
void
setAlign(HorizontalAlign align)
The horizontal alignment of the legend box within the chart area.
void
setBackgroundColor(Color backgroundColor)
The background color of the legend.
void
setBorderColor(Color borderColor)
The color of the drawn border around the legend.
void
setBorderRadius(Number borderRadius)
The border corner radius of the legend.
void
setBorderWidth(Number borderWidth)
The width of the drawn border around the legend.
void
setEnabled(Boolean enabled)
Enable or disable the legend.
void
setFloating(Boolean floating)
When the legend is floating, the plot area ignores it and is allowed to be placed below it.
void
setItemDistance(Number itemDistance)
In a legend with horizontal layout, the itemDistance defines the pixel distance between each item.
void
setItemHiddenStyle(Style itemHiddenStyle)
CSS styles for each legend item when the corresponding series or point is hidden.
void
setItemHoverStyle(Style itemHoverStyle)
CSS styles for each legend item in hover mode.
void
setItemMarginBottom(Number itemMarginBottom)
The pixel bottom margin for each legend item.
void
setItemMarginTop(Number itemMarginTop)
The pixel top margin for each legend item.
void
setItemStyle(Style itemStyle)
CSS styles for each legend item.
void
setItemWidth(Number itemWidth)
The width for each legend item.
void
setLabelFormat(String labelFormat)
A format string for each legend label.
void
setLabelFormatter(String _fn_labelFormatter)
void
setLayout(LayoutDirection layout)
The layout of the legend items.
void
setLineHeight(Number lineHeight)
Line height for the legend items.
void
setMargin(Number margin)
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.
void
setMaxHeight(Number maxHeight)
Maximum pixel height for the legend.
void
setNavigation(LegendNavigation navigation)
Options for the paging or navigation appearing when the legend is overflown.
void
setPadding(Number padding)
The inner padding of the legend box.
void
setReversed(Boolean reversed)
Whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object.
void
setRtl(Boolean rtl)
Whether to show the symbol on the right side of the text rather than the left side.
void
setShadow(Boolean shadow)
Whether to apply a drop shadow to the legend.
void
setSquareSymbol(Boolean squareSymbol)
When this is true, the legend symbol width will be the same as the symbol height, which in turn defaults to the font size of the legend items.
void
setSymbolHeight(Number symbolHeight)
The pixel height of the symbol for series types that use a rectangle in the legend.
void
setSymbolPadding(Number symbolPadding)
The pixel padding between the legend item symbol and the legend item text.
void
setSymbolRadius(Number symbolRadius)
The border radius of the symbol for series types that use a rectangle in the legend.
void
setSymbolWidth(Number symbolWidth)
The pixel width of the legend item symbol.
void
setTitle(LegendTitle title)
A title to be added on top of the legend.
void
setUseHTML(Boolean useHTML)
Whether to use HTML to render the legend item texts.
void
setVerticalAlign(VerticalAlign verticalAlign)
The vertical alignment of the legend box.
void
setWidth(Number width)
The width of the legend box.
void
setX(Number x)
The x offset of the legend relative to its horizontal alignment
align
within chart.spacingLeft and chart.spacingRight.void
setY(Number y)
The vertical offset of the legend relative to it's vertical alignment
verticalAlign
within chart.spacingTop and chart.spacingBottom.
-
-
-
Constructor Detail
-
Legend
public Legend()
-
Legend
public Legend(Boolean enabled)
-
-
Method Detail
-
getAlign
public HorizontalAlign getAlign()
See Also:
-
setAlign
public void setAlign(HorizontalAlign align)
The horizontal alignment of the legend box within the chart area. Valid values are
left
,center
andright
.In the case that the legend is aligned in a corner position, the
layout
option will determine whether to place it above/below or on the side of the plot area.Defaults to: center
-
getBackgroundColor
public Color getBackgroundColor()
See Also:
-
setBackgroundColor
public void setBackgroundColor(Color backgroundColor)
The background color of the legend.
-
getBorderColor
public Color getBorderColor()
See Also:
-
setBorderColor
public void setBorderColor(Color borderColor)
The color of the drawn border around the legend.
Defaults to: #999999
-
getBorderRadius
public Number getBorderRadius()
See Also:
-
setBorderRadius
public void setBorderRadius(Number borderRadius)
The border corner radius of the legend.
Defaults to: 0
-
getBorderWidth
public Number getBorderWidth()
See Also:
-
setBorderWidth
public void setBorderWidth(Number borderWidth)
The width of the drawn border around the legend.
Defaults to: 0
-
getEnabled
public Boolean getEnabled()
See Also:
-
setEnabled
public void setEnabled(Boolean enabled)
Enable or disable the legend.
Defaults to: true
-
getFloating
public Boolean getFloating()
See Also:
-
setFloating
public void setFloating(Boolean floating)
When the legend is floating, the plot area ignores it and is allowed to be placed below it.
Defaults to: false
-
getItemDistance
public Number getItemDistance()
See Also:
-
setItemDistance
public void setItemDistance(Number itemDistance)
In a legend with horizontal layout, the itemDistance defines the pixel distance between each item.
Defaults to: 20
-
getItemHiddenStyle
public Style getItemHiddenStyle()
See Also:
-
setItemHiddenStyle
public void setItemHiddenStyle(Style itemHiddenStyle)
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 from
style
unless overridden here.Defaults to: { "color": "#cccccc" }
-
getItemHoverStyle
public Style getItemHoverStyle()
See Also:
-
setItemHoverStyle
public void setItemHoverStyle(Style itemHoverStyle)
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 from
style
unless overridden here.Defaults to: { "color": "#000000" }
-
getItemMarginBottom
public Number getItemMarginBottom()
See Also:
-
setItemMarginBottom
public void setItemMarginBottom(Number itemMarginBottom)
The pixel bottom margin for each legend item.
Defaults to: 0
-
getItemMarginTop
public Number getItemMarginTop()
See Also:
-
setItemMarginTop
public void setItemMarginTop(Number itemMarginTop)
The pixel top margin for each legend item.
Defaults to: 0
-
getItemStyle
public Style getItemStyle()
See Also:
-
setItemStyle
public void setItemStyle(Style itemStyle)
CSS styles for each legend item. Only a subset of CSS is supported, notably those options related to text. The default
textOverflow
property makes long texts truncate. Set it tonull
to wrap text instead. Awidth
property can be added to control the text width.Defaults to: { "color": "#333333", "cursor": "pointer", "fontSize": "12px", "fontWeight": "bold", "textOverflow": "ellipsis" }
-
getItemWidth
public Number getItemWidth()
See Also:
-
setItemWidth
public void setItemWidth(Number itemWidth)
The width for each legend item. This is useful in a horizontal layout with many items when you want the items to align vertically. .
-
getLabelFormat
public String getLabelFormat()
See Also:
-
setLabelFormat
public void setLabelFormat(String labelFormat)
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}
-
getLabelFormatter
public String getLabelFormatter()
-
setLabelFormatter
public void setLabelFormatter(String _fn_labelFormatter)
-
getLayout
public LayoutDirection getLayout()
See Also:
-
setLayout
public void setLayout(LayoutDirection layout)
The layout of the legend items. Can be one of "horizontal" or "vertical".
Defaults to: horizontal
-
getLineHeight
public Number getLineHeight()
See Also:
-
setLineHeight
public void setLineHeight(Number lineHeight)
Line height for the legend items. Deprecated as of 2.1. Instead, the line height for each item can be set using itemStyle.lineHeight, and the padding between items using itemMarginTop and itemMarginBottom.
Defaults to: 16
-
getMargin
public Number getMargin()
See Also:
-
setMargin
public void setMargin(Number margin)
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
-
getMaxHeight
public Number getMaxHeight()
See Also:
-
setMaxHeight
public void setMaxHeight(Number maxHeight)
Maximum pixel height for the legend. When the maximum height is extended, navigation will show.
-
getNavigation
public LegendNavigation getNavigation()
See Also:
-
setNavigation
public void setNavigation(LegendNavigation navigation)
Options for the paging or navigation appearing when the legend is overflown. Navigation works well on screen, but not in static exported images. One way of working around that is to increase the chart height in export.
-
getPadding
public Number getPadding()
See Also:
-
setPadding
public void setPadding(Number padding)
The inner padding of the legend box.
Defaults to: 8
-
getReversed
public Boolean getReversed()
See Also:
-
setReversed
public void setReversed(Boolean reversed)
Whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object.
Defaults to: false
-
getRtl
public Boolean getRtl()
See Also:
-
setRtl
public void setRtl(Boolean rtl)
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
-
getShadow
public Boolean getShadow()
See Also:
-
setShadow
public void setShadow(Boolean shadow)
Whether to apply a drop shadow to the legend. A
backgroundColor
also needs to be applied for this to take effect. Since 2.3 the shadow can be an object configuration containingcolor
,offsetX
,offsetY
,opacity
andwidth
.Defaults to: false
-
getSquareSymbol
public Boolean getSquareSymbol()
See Also:
-
setSquareSymbol
public void setSquareSymbol(Boolean squareSymbol)
When this is true, the legend symbol width will be the same as the symbol height, which in turn defaults to the font size of the legend items.
Defaults to: true
-
getSymbolHeight
public Number getSymbolHeight()
See Also:
-
setSymbolHeight
public void setSymbolHeight(Number symbolHeight)
The pixel height of the symbol for series types that use a rectangle in the legend. Defaults to the font size of legend items.
-
getSymbolPadding
public Number getSymbolPadding()
See Also:
-
setSymbolPadding
public void setSymbolPadding(Number symbolPadding)
The pixel padding between the legend item symbol and the legend item text.
Defaults to: 5
-
getSymbolRadius
public Number getSymbolRadius()
See Also:
-
setSymbolRadius
public void setSymbolRadius(Number symbolRadius)
The border radius of the symbol for series types that use a rectangle in the legend. Defaults to half the
symbolHeight
.
-
getSymbolWidth
public Number getSymbolWidth()
See Also:
-
setSymbolWidth
public void setSymbolWidth(Number symbolWidth)
The pixel width of the legend item symbol. When the
squareSymbol
option is set, this defaults to thesymbolHeight
, otherwise 16.
-
getTitle
public LegendTitle getTitle()
See Also:
-
setTitle
public void setTitle(LegendTitle title)
A title to be added on top of the legend.
-
getUseHTML
public Boolean getUseHTML()
See Also:
-
setUseHTML
public void setUseHTML(Boolean useHTML)
Whether to use HTML to render the legend item texts. Prior to 4.1.7, when using HTML, legend.navigation was disabled.
Defaults to: false
-
getVerticalAlign
public VerticalAlign getVerticalAlign()
See Also:
-
setVerticalAlign
public void setVerticalAlign(VerticalAlign verticalAlign)
The vertical alignment of the legend box. Can be one of
top
,middle
orbottom
. Vertical position can be further determined by they
option.In the case that the legend is aligned in a corner position, the
layout
option will determine whether to place it above/below or on the side of the plot area.Defaults to: bottom
-
getWidth
public Number getWidth()
See Also:
-
setWidth
public void setWidth(Number width)
The width of the legend box.
-
getX
public Number getX()
See Also:
-
setX
public void setX(Number x)
The x offset of the legend relative to its horizontal alignment
align
within chart.spacingLeft and chart.spacingRight. Negative x moves it to the left, positive x moves it to the right.Defaults to: 0
-
getY
public Number getY()
See Also:
-
setY
public void setY(Number y)
The vertical offset of the legend relative to it's vertical alignment
verticalAlign
within chart.spacingTop and chart.spacingBottom. Negative y moves it up, positive y moves it down.Defaults to: 0
-
-