public class Legend extends AbstractConfigurationObject
Modifier and Type | Method and Description |
---|---|
HorizontalAlign |
getAlign() |
Number |
getBorderRadius() |
Boolean |
getEnabled() |
Boolean |
getFloating() |
Number |
getItemDistance() |
Number |
getItemMarginBottom() |
Number |
getItemMarginTop() |
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 |
setBorderRadius(Number borderRadius)
The border corner radius of 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 |
setItemMarginBottom(Number itemMarginBottom)
The pixel bottom margin for each legend item.
|
void |
setItemMarginTop(Number itemMarginTop)
The pixel top margin 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. |
public Legend()
public Legend(Boolean enabled)
public HorizontalAlign getAlign()
setAlign(HorizontalAlign)
public void setAlign(HorizontalAlign align)
The horizontal alignment of the legend box within the chart area. Valid
values are left
, center
and right
.
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
public Number getBorderRadius()
setBorderRadius(Number)
public void setBorderRadius(Number borderRadius)
Defaults to: 0
public Boolean getEnabled()
setEnabled(Boolean)
public void setEnabled(Boolean enabled)
Defaults to: true
public Boolean getFloating()
setFloating(Boolean)
public void setFloating(Boolean floating)
Defaults to: false
public Number getItemDistance()
setItemDistance(Number)
public void setItemDistance(Number itemDistance)
Defaults to: 20
public Number getItemMarginBottom()
setItemMarginBottom(Number)
public void setItemMarginBottom(Number itemMarginBottom)
Defaults to: 0
public Number getItemMarginTop()
setItemMarginTop(Number)
public void setItemMarginTop(Number itemMarginTop)
Defaults to: 0
public Number getItemWidth()
setItemWidth(Number)
public void setItemWidth(Number itemWidth)
public String getLabelFormat()
setLabelFormat(String)
public void setLabelFormat(String labelFormat)
Defaults to: {name}
public String getLabelFormatter()
public void setLabelFormatter(String _fn_labelFormatter)
public LayoutDirection getLayout()
setLayout(LayoutDirection)
public void setLayout(LayoutDirection layout)
Defaults to: horizontal
public Number getLineHeight()
setLineHeight(Number)
public void setLineHeight(Number lineHeight)
Defaults to: 16
public Number getMargin()
setMargin(Number)
public void setMargin(Number margin)
Defaults to: 12
public Number getMaxHeight()
setMaxHeight(Number)
public void setMaxHeight(Number maxHeight)
public LegendNavigation getNavigation()
setNavigation(LegendNavigation)
public void setNavigation(LegendNavigation navigation)
public Number getPadding()
setPadding(Number)
public void setPadding(Number padding)
Defaults to: 8
public Boolean getReversed()
setReversed(Boolean)
public void setReversed(Boolean reversed)
Defaults to: false
public Boolean getRtl()
setRtl(Boolean)
public void setRtl(Boolean rtl)
Defaults to: false
public Boolean getShadow()
setShadow(Boolean)
public void setShadow(Boolean shadow)
backgroundColor
also needs to be applied for this to take
effect. Since 2.3 the shadow can be an object configuration containing
color
, offsetX
, offsetY
,
opacity
and width
.
Defaults to: false
public Boolean getSquareSymbol()
setSquareSymbol(Boolean)
public void setSquareSymbol(Boolean squareSymbol)
Defaults to: true
public Number getSymbolHeight()
setSymbolHeight(Number)
public void setSymbolHeight(Number symbolHeight)
public Number getSymbolPadding()
setSymbolPadding(Number)
public void setSymbolPadding(Number symbolPadding)
Defaults to: 5
public Number getSymbolRadius()
setSymbolRadius(Number)
public void setSymbolRadius(Number symbolRadius)
symbolHeight
.public Number getSymbolWidth()
setSymbolWidth(Number)
public void setSymbolWidth(Number symbolWidth)
squareSymbol
option is set, this defaults to the
symbolHeight
, otherwise 16.public LegendTitle getTitle()
setTitle(LegendTitle)
public void setTitle(LegendTitle title)
public Boolean getUseHTML()
setUseHTML(Boolean)
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
public VerticalAlign getVerticalAlign()
setVerticalAlign(VerticalAlign)
public void setVerticalAlign(VerticalAlign verticalAlign)
The vertical alignment of the legend box. Can be one of top
,
middle
or bottom
. Vertical position can be
further determined by the y
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
public Number getWidth()
setWidth(Number)
public void setWidth(Number width)
public Number getX()
setX(Number)
public void setX(Number x)
align
within chart.spacingLeft and chart.spacingRight.
Negative x moves it to the left, positive x moves it to the right.
Defaults to: 0
public Number getY()
setY(Number)
public void setY(Number y)
verticalAlign
within chart.spacingTop and
chart.spacingBottom. Negative y moves it up, positive y moves it down.
Defaults to: 0
Copyright © 2023. All rights reserved.