Class Legend
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Legend
-
- All Implemented Interfaces:
Serializable,OptionDataListener,org.zkoss.json.JSONAware
public class Legend extends Optionable
The legend is a box containing a symbol and name for each series item or point item in the chart.All the options in this class support
DynamicalAttribute.- Author:
- jumperchen, RaymondChao
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Legend()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LegendAccessibilitygetAccessibility()Accessibility options for the legend, or create a new one.StringgetAlign()Returns the horizontal alignment of the legend box within the chart area.ColorgetBackgroundColor()Returns the background color of the legend, filling the rounded corner border.ColorgetBorderColor()Returns the color of the drawn border around the legend.ObjectgetBorderRadius()Returns the border corner radius of the legend.NumbergetBorderWidth()Returns the width of the drawn border around the legend.BubbleLegendgetBubbleLegend()Returns the bubble legend, which is an additional element in legend which presents the scale of the bubble series.NumbergetItemDistance()Returns in a legend with horizontal layout, the itemDistance defines the pixel distance between each item.<K,V>
Map<K,V>getItemHiddenStyle()Returns CSS styles for each legend item when the corresponding series or point is hidden.<K,V>
Map<K,V>getItemHoverStyle()Returns CSS styles for each legend item in hover mode.NumbergetItemMarginBottom()Returns the pixel bottom margin for each legend item.NumbergetItemMarginTop()Returns the pixel top margin for each legend item.<K,V>
Map<K,V>getItemStyle()Returns CSS styles for each legend item.NumbergetItemWidth()Returns the width for each legend item.StringgetLabelFormat()Returns a format string for each legend label.StringgetLayout()Returns the layout of the legend items.NumbergetMargin()Returns 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.NumbergetMaxHeight()Returns maximum pixel height for the legend.ObjectgetMaxWidth()Returns the maximum width for the legend.LegendNavigationgetNavigation()Returns options for the paging or navigation appearing when the legend is overflown.NumbergetPadding()Returns the inner padding of the legend box.ShadowgetShadow()Returns whether to apply a drop shadow to the legend.NumbergetSymbolHeight()Returns the pixel height of the legend item symbol.NumbergetSymbolPadding()Returns the pixel padding between the legend item symbol and the legend item text.NumbergetSymbolRadius()Returns the pixel radius of the legend item symbol.NumbergetSymbolWidth()Returns the pixel width of the legend item symbol.LegendTitlegetTitle()Returns a title to be added on top of the legend.StringgetVerticalAlign()Returns the vertical alignment of the legend box.NumbergetWidth()Returns the width of the legend box.NumbergetX()Returns the x offset of the legend relative to it's horizontal alignmentalignwithin chart.spacingLeft and chart.spacingRight.NumbergetY()Returns the vertical offset of the legend relative to it's vertical alignmentverticalAlignwithin chart.spacingTop and chart.spacingBottom.booleanisAlignColumns()Returns if the layout is horizontal and the legend items span over two lines or more, whether to align the items into vertical columns.booleanisEnabled()Returns enable or disable the legend.booleanisFloating()Returns when the legend is floating, the plot area ignores it and is allowed to be placed below it.booleanisReversed()Returns whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object.booleanisRtl()Returns whether to show the symbol on the right side of the text rather than the left side.booleanisShadow()Returns whether to apply a drop shadow to the legend.booleanisSquareSymbol()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.booleanisUseHTML()Returns whether to use HTML to render the legend item texts.voidsetAccessibility(LegendAccessibility accessibility)Accessibility options for the legend, or create a new one.voidsetAlign(String align)Sets the horizontal alignment of the legend box within the chart area.voidsetAlignColumns(boolean alignColumns)Sets if the layout is horizontal and the legend items span over two lines or more, whether to align the items into vertical columns.voidsetBackgroundColor(String color)Sets the background color of the legend, filling the rounded corner border.voidsetBackgroundColor(Color color)Sets the background color of the legend, filling the rounded corner border.voidsetBackgroundColor(LinearGradient color)Sets the background color of the legend, filling the rounded corner border.voidsetBackgroundColor(RadialGradient color)Sets the background color of the legend, filling the rounded corner border.voidsetBorderColor(String color)Sets the color of the drawn border around the legend.voidsetBorderColor(Color color)Sets the color of the drawn border around the legend.voidsetBorderColor(LinearGradient color)Sets the color of the drawn border around the legend.voidsetBorderColor(RadialGradient color)Sets the color of the drawn border around the legend.voidsetBorderRadius(Number borderRadius)Sets the border corner radius of the legend.voidsetBorderRadius(String borderRadius)Sets the border corner radius of the legend.voidsetBorderWidth(Number borderWidth)Sets the width of the drawn border around the legend.voidsetBubbleLegend(BubbleLegend bubbleLegend)Sets the bubble legend, which is an additional element in legend which presents the scale of the bubble series.voidsetEnabled(boolean enabled)Sets enable or disable the legend.voidsetFloating(boolean floating)Sets when the legend is floating, the plot area ignores it and is allowed to be placed below it.voidsetItemDistance(Number itemDistance)Sets in a legend with horizontal layout, the itemDistance defines the pixel distance between each item.voidsetItemHiddenStyle(String itemHiddenStyle)Sets CSS styles for each legend item when the corresponding series or point is hidden.<K,V>
voidsetItemHiddenStyle(Map<K,V> itemHiddenStyle)Sets CSS styles for each legend item when the corresponding series or point is hidden.voidsetItemHoverStyle(String itemHoverStyle)Sets CSS styles for each legend item in hover mode.<K,V>
voidsetItemHoverStyle(Map<K,V> itemHoverStyle)Sets CSS styles for each legend item in hover mode.voidsetItemMarginBottom(Number itemMarginBottom)Sets the pixel bottom margin for each legend item.voidsetItemMarginTop(Number itemMarginTop)Sets the pixel top margin for each legend item.voidsetItemStyle(String itemStyle)Sets CSS styles for each legend item.<K,V>
voidsetItemStyle(Map<K,V> itemStyle)Sets CSS styles for each legend item.voidsetItemWidth(Number itemWidth)Sets the width for each legend item.voidsetLabelFormat(String labelFormat)Sets a format string for each legend label.voidsetLayout(String layout)Sets the layout of the legend items.voidsetMargin(Number margin)Sets 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.voidsetMaxHeight(Number maxHeight)Sets maximum pixel height for the legend.voidsetMaxWidth(Number maxWidth)Sets the maximum width for the legend in pixels.voidsetMaxWidth(String maxWidth)Sets the maximum width for the legend as a percentage of the chart width (e.g.voidsetNavigation(LegendNavigation navigation)Sets options for the paging or navigation appearing when the legend is overflown.voidsetPadding(Number padding)Sets the inner padding of the legend box.voidsetReversed(boolean reversed)Sets whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object.voidsetRtl(boolean rtl)Sets whether to show the symbol on the right side of the text rather than the left side.voidsetShadow(boolean shadow)Sets whether to apply a drop shadow to the legend.voidsetShadow(Shadow shadow)Sets whether to apply a drop shadow to the legend.voidsetSquareSymbol(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.voidsetSymbolHeight(Number symbolHeight)Sets the pixel height of the legend item symbol.voidsetSymbolPadding(Number symbolPadding)Sets the pixel padding between the legend item symbol and the legend item text.voidsetSymbolRadius(Number symbolRadius)Sets the pixel radius of the legend item symbol.voidsetSymbolWidth(Number symbolWidth)Sets the pixel width of the legend item symbol.voidsetTitle(LegendTitle title)Sets a title to be added on top of the legend.voidsetUseHTML(boolean useHTML)Sets whether to use HTML to render the legend item texts.voidsetVerticalAlign(String verticalAlign)Sets the vertical alignment of the legend box.voidsetWidth(Number width)Sets the width of the legend box.voidsetX(Number x)Sets the x offset of the legend relative to it's horizontal alignmentalignwithin chart.spacingLeft and chart.spacingRight.voidsetY(Number y)Sets the vertical offset of the legend relative to it's vertical alignmentverticalAlignwithin chart.spacingTop and chart.spacingBottom.-
Methods inherited from class org.zkoss.chart.Optionable
addExtraAttr, addOptionDataListener, clearOptonDataListener, clone, containsKey, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getAttr, getAttr, getClientState, getExtraAttr, merge, onChange, removeExtraAttr, removeKey, removeOptionDataListener, setAttr, setAttr, setAttr, setAttr, toJSONString, toString
-
-
-
-
Method Detail
-
getAccessibility
public LegendAccessibility getAccessibility()
Accessibility options for the legend, or create a new one.Default: an instance of
LegendAccessibility- Since:
- 10.2.1.0
-
setAccessibility
public void setAccessibility(LegendAccessibility accessibility)
Accessibility options for the legend, or create a new one.Default: an instance of
LegendAccessibility- Since:
- 10.2.1.0
-
getAlign
public String getAlign()
Returns the horizontal alignment of the legend box within the chart area. Valid values are"left","center"and"right".Default: "center".
-
setAlign
public void setAlign(String align)
Sets the horizontal alignment of the legend box within the chart area. Valid values are"left","center"and"right".
-
isAlignColumns
public boolean isAlignColumns()
Returns if the layout is horizontal and the legend items span over two lines or more, whether to align the items into vertical columns. Setting this to false makes room for more items, but will look more messy.Default: true
- Since:
- 7.2.1.0
-
setAlignColumns
public void setAlignColumns(boolean alignColumns)
Sets if the layout is horizontal and the legend items span over two lines or more, whether to align the items into vertical columns. Setting this to false makes room for more items, but will look more messy.- Since:
- 7.2.1.0
-
getBackgroundColor
public Color getBackgroundColor()
Returns the background color of the legend, filling the rounded corner border.Default: null.
-
setBackgroundColor
public void setBackgroundColor(Color color)
Sets the background color of the legend, filling the rounded corner border.
-
setBackgroundColor
public void setBackgroundColor(String color)
Sets the background color of the legend, filling the rounded corner border.
-
setBackgroundColor
public void setBackgroundColor(LinearGradient color)
Sets the background color of the legend, filling the rounded corner border.
-
setBackgroundColor
public void setBackgroundColor(RadialGradient color)
Sets the background color of the legend, filling the rounded corner border.
-
getBorderColor
public Color getBorderColor()
Returns the color of the drawn border around the legend.Default: "#909090".
-
setBorderColor
public void setBorderColor(Color color)
Sets the color of the drawn border around the legend.
-
setBorderColor
public void setBorderColor(String color)
Sets the color of the drawn border around the legend.
-
setBorderColor
public void setBorderColor(LinearGradient color)
Sets the color of the drawn border around the legend.
-
setBorderColor
public void setBorderColor(RadialGradient color)
Sets the color of the drawn border around the legend.
-
getBorderRadius
public Object getBorderRadius()
Returns the border corner radius of the legend.Default: 0.
- Returns:
- borderRadius the border corner radius of the legend
-
setBorderRadius
public void setBorderRadius(Number borderRadius)
Sets the border corner radius of the legend.- Parameters:
borderRadius- the border corner radius of the legend
-
setBorderRadius
public void setBorderRadius(String borderRadius)
Sets the border corner radius of the legend.- Parameters:
borderRadius- the border corner radius of the legend
-
getBorderWidth
public Number getBorderWidth()
Returns the width of the drawn border around the legend.Default: 0.
- Returns:
- borderWidth the width of the drawn border around the legend
-
setBorderWidth
public void setBorderWidth(Number borderWidth)
Sets the width of the drawn border around the legend.
-
isEnabled
public boolean isEnabled()
Returns enable or disable the legend.Default: true.
- Returns:
- enabled enable or disable the legend
-
setEnabled
public void setEnabled(boolean enabled)
Sets enable or disable the legend.- Parameters:
enabled- enable or disable the legend
-
getBubbleLegend
public BubbleLegend getBubbleLegend()
Returns the bubble legend, which is an additional element in legend which presents the scale of the bubble series. Creates a new one if none is set. Individual bubble ranges can be defined by user or calculated from series. In the case of automatically calculated ranges, a 1px margin of error is permitted.- Since:
- 7.2.1.0
-
setBubbleLegend
public void setBubbleLegend(BubbleLegend bubbleLegend)
Sets the bubble legend, which is an additional element in legend which presents the scale of the bubble series. Individual bubble ranges can be defined by user or calculated from series. In the case of automatically calculated ranges, a 1px margin of error is permitted.- Since:
- 7.2.1.0
-
isFloating
public boolean isFloating()
Returns when the legend is floating, the plot area ignores it and is allowed to be placed below it.Default: false.
- Returns:
- floating when the legend is floating, the plot area ignores it and is allowed to be placed below it
-
setFloating
public void setFloating(boolean floating)
Sets when the legend is floating, the plot area ignores it and is allowed to be placed below it.- Parameters:
floating- when the legend is floating, the plot area ignores it and is allowed to be placed below it
-
getItemDistance
public Number getItemDistance()
Returns in a legend with horizontal layout, the itemDistance defines the pixel distance between each item.Default: 8.
- Returns:
- itemDistance in a legend with horizontal layout, the itemDistance defines the pixel distance between each item
-
setItemDistance
public void setItemDistance(Number itemDistance)
Sets in a legend with horizontal layout, the itemDistance defines the pixel distance between each item.- Parameters:
itemDistance- in a legend with horizontal layout, the itemDistance defines the pixel distance between each item
-
getItemHiddenStyle
public <K,V> Map<K,V> getItemHiddenStyle()
Returns 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:color: #CCC;
- Type Parameters:
K- type for the keyif style was set using
setItemHiddenStyle(String), type will be Stringif style was set using
setItemHiddenStyle(Map), type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
V- type for the valueif style was set using
setItemHiddenStyle(String), type will be Stringif style was set using
setItemHiddenStyle(Map), type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
-
setItemHiddenStyle
public void setItemHiddenStyle(String itemHiddenStyle)
Sets 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.This method allows simple settings like
label.setStyle("fontWeight: 'bold'; color: 'white'; textShadow: '0px 1px 2px black'");In the format of CSS key:value, and ";" separating multiple key:value pairs, if you have more a complex CSS styling, we recommend using
setItemHiddenStyle(Map)- Parameters:
itemHiddenStyle- one or many CSS key:value pairs in a single line string format
-
setItemHiddenStyle
public <K,V> void setItemHiddenStyle(Map<K,V> itemHiddenStyle)
Sets 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.This method allows complex styling like:
which will generate the final results like:Map<String, Object> styles = new HashMap<String, Object>(); styles.put("fill", "#E8E8EA"); styles.put("stroke", "#6E6E78"); styles.put("stroke-width", "1"); styles.put("r", "0"); Map<String, Object> states = new HashMap<String, Object>(); Map<String, String> hover = new HashMap<String, String>(); hover.put("fill", "#F4F4F6"); hover.put("stroke", "#6E6E78"); hover.put("stroke-width", "1"); hover.put("r", "0"); states.put("hover", hover); styles.put("states", states); Map<String, String> style = new HashMap<String, String>(); style.put("color", "#4D5663"); style.put("fontSize", "12px"); style.put("fontFamily", "'Arial'"); style.put("fontWeight", "normal"); style.put("padding", "10px"); styles.put("style", style);{ "fill": "#E8E8EA", "stroke": "#6E6E78", "stroke-width": "1", "r": "0", "states": { "hover": { "fill": "#F4F4F6", "stroke": "#6E6E78", "stroke-width": "1", "r": "0" } }, "style": { "color": "#4D5663", "fontSize": "12px", "fontFamily": "'Arial'", "fontWeight": "normal", "padding": "10px" } }- Type Parameters:
K- Type for the key, usually StringV- Type for the value, usually String. For nested maps, use Object or any other type.- Parameters:
itemHiddenStyle- the style object
-
getItemHoverStyle
public <K,V> Map<K,V> getItemHoverStyle()
Returns 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:color: #000;
- Type Parameters:
K- type for the keyif style was set using
setItemHoverStyle(String), type will be Stringif style was set using
setItemHoverStyle(Map), type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
V- type for the valueif style was set using
setItemHoverStyle(String), type will be Stringif style was set using
setItemHoverStyle(Map), type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
-
setItemHoverStyle
public void setItemHoverStyle(String itemHoverStyle)
Sets 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.This method allows simple settings like
label.setStyle("fontWeight: 'bold'; color: 'white'; textShadow: '0px 1px 2px black'");In the format of CSS key:value, and ";" separating multiple key:value pairs, if you have more a complex CSS styling, we recommend using
setItemHoverStyle(Map)- Parameters:
itemHoverStyle- one or many CSS key:value pairs in a single line string format
-
setItemHoverStyle
public <K,V> void setItemHoverStyle(Map<K,V> itemHoverStyle)
Sets 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.This method allows complex styling like:
which will generate the final results like:Map<String, Object> styles = new HashMap<String, Object>(); styles.put("fill", "#E8E8EA"); styles.put("stroke", "#6E6E78"); styles.put("stroke-width", "1"); styles.put("r", "0"); Map<String, Object> states = new HashMap<String, Object>(); Map<String, String> hover = new HashMap<String, String>(); hover.put("fill", "#F4F4F6"); hover.put("stroke", "#6E6E78"); hover.put("stroke-width", "1"); hover.put("r", "0"); states.put("hover", hover); styles.put("states", states); Map<String, String> style = new HashMap<String, String>(); style.put("color", "#4D5663"); style.put("fontSize", "12px"); style.put("fontFamily", "'Arial'"); style.put("fontWeight", "normal"); style.put("padding", "10px"); styles.put("style", style);{ "fill": "#E8E8EA", "stroke": "#6E6E78", "stroke-width": "1", "r": "0", "states": { "hover": { "fill": "#F4F4F6", "stroke": "#6E6E78", "stroke-width": "1", "r": "0" } }, "style": { "color": "#4D5663", "fontSize": "12px", "fontFamily": "'Arial'", "fontWeight": "normal", "padding": "10px" } }- Type Parameters:
K- Type for the key, usually StringV- Type for the value, usually String. For nested maps, use Object or any other type.- Parameters:
itemHoverStyle- the style object
-
getItemMarginBottom
public Number getItemMarginBottom()
Returns the pixel bottom margin for each legend item.Default: 0
-
setItemMarginBottom
public void setItemMarginBottom(Number itemMarginBottom)
Sets the pixel bottom margin for each legend item.
-
getItemMarginTop
public Number getItemMarginTop()
Returns the pixel top margin for each legend item.Default: 0
-
setItemMarginTop
public void setItemMarginTop(Number itemMarginTop)
Sets the pixel top margin for each legend item.
-
getItemStyle
public <K,V> Map<K,V> getItemStyle()
Returns CSS styles for each legend item. Only a subset of CSS is supported, notably those options related to text. Defaults to:cursor: pointer; color: #274b6d; fontSize: 12px;
- Type Parameters:
K- type for the keyif style was set using
setItemStyle(String), type will be Stringif style was set using
setItemStyle(Map), type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
V- type for the valueif style was set using
setItemStyle(String), type will be Stringif style was set using
setItemStyle(Map), type will be the same as the type from the key of the mapif style was not set, default style will be applied, and type will be String
-
setItemStyle
public void setItemStyle(String itemStyle)
Sets CSS styles for each legend item. Only a subset of CSS is supported, notably those options related to text.This method allows simple settings like
label.setStyle("fontWeight: 'bold'; color: 'white'; textShadow: '0px 1px 2px black'");In the format of CSS key:value, and ";" separating multiple key:value pairs, if you have more a complex CSS styling, we recommend using
setItemStyle(Map)- Parameters:
itemStyle- one or many CSS key:value pairs in a single line string format
-
setItemStyle
public <K,V> void setItemStyle(Map<K,V> itemStyle)
Sets CSS styles for each legend item. Only a subset of CSS is supported, notably those options related to text.This method allows complex styling like:
which will generate the final results like:Map<String, Object> styles = new HashMap<String, Object>(); styles.put("fill", "#E8E8EA"); styles.put("stroke", "#6E6E78"); styles.put("stroke-width", "1"); styles.put("r", "0"); Map<String, Object> states = new HashMap<String, Object>(); Map<String, String> hover = new HashMap<String, String>(); hover.put("fill", "#F4F4F6"); hover.put("stroke", "#6E6E78"); hover.put("stroke-width", "1"); hover.put("r", "0"); states.put("hover", hover); styles.put("states", states); Map<String, String> style = new HashMap<String, String>(); style.put("color", "#4D5663"); style.put("fontSize", "12px"); style.put("fontFamily", "'Arial'"); style.put("fontWeight", "normal"); style.put("padding", "10px"); styles.put("style", style);{ "fill": "#E8E8EA", "stroke": "#6E6E78", "stroke-width": "1", "r": "0", "states": { "hover": { "fill": "#F4F4F6", "stroke": "#6E6E78", "stroke-width": "1", "r": "0" } }, "style": { "color": "#4D5663", "fontSize": "12px", "fontFamily": "'Arial'", "fontWeight": "normal", "padding": "10px" } }- Type Parameters:
K- Type for the key, usually StringV- Type for the value, usually String. For nested maps, use Object or any other type.- Parameters:
itemStyle- the style object
-
getItemWidth
public Number getItemWidth()
Returns the width for each legend item. This is useful in a horizontal layout with many items when you want the items to align vertically. .Default: null.
-
setItemWidth
public void setItemWidth(Number itemWidth)
Sets 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- the width for each legend item
-
getLabelFormat
public String getLabelFormat()
Returns a format string for each legend label. Available variables relates to properties on the series, or the point in case of pies.Default: "{name}".
-
setLabelFormat
public void setLabelFormat(String labelFormat)
Sets a format string for each legend label. Available variables relates to properties on the series, or the point in case of pies.
-
getLayout
public String getLayout()
Returns the layout of the legend items. Can be one of "horizontal" or "vertical" or "proximate".Default: "horizontal".
-
setLayout
public void setLayout(String layout)
Sets the layout of the legend items. Can be one of "horizontal" or "vertical" or "proximate".- Parameters:
layout- the layout of the legend items
-
getMargin
public Number getMargin()
Returns 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.Default: 15.
-
setMargin
public void setMargin(Number margin)
Sets 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.
-
getMaxHeight
public Number getMaxHeight()
Returns maximum pixel height for the legend. When the maximum height is extended, navigation will show.- Returns:
- maxHeight maximum pixel height for the legend
-
setMaxHeight
public void setMaxHeight(Number maxHeight)
Sets maximum pixel height for the legend. When the maximum height is extended, navigation will show.- Parameters:
maxHeight- maximum pixel height for the legend
-
getMaxWidth
public Object getMaxWidth()
Returns the maximum width for the legend. The value may be either a pixel count (Number) or a percentage of the chart width expressed as a String (e.g. "50%").Default: null.
- Since:
- 12.5.0.0
-
setMaxWidth
public void setMaxWidth(String maxWidth)
Sets the maximum width for the legend as a percentage of the chart width (e.g. "50%").- Parameters:
maxWidth- maximum width expressed as a percentage string- Since:
- 12.5.0.0
-
setMaxWidth
public void setMaxWidth(Number maxWidth)
Sets the maximum width for the legend in pixels.- Parameters:
maxWidth- maximum pixel width for the legend- Since:
- 12.5.0.0
-
getNavigation
public LegendNavigation getNavigation()
Returns options for the paging or navigation appearing when the legend is overflown. WhensetUseHTML(boolean)is enabled, navigation is disabled.Default: an instance of
LegendNavigation- See Also:
LegendNavigation
-
setNavigation
public void setNavigation(LegendNavigation navigation)
Sets options for the paging or navigation appearing when the legend is overflown. WhensetUseHTML(boolean)is enabled, navigation is disabled.- See Also:
LegendNavigation
-
getPadding
public Number getPadding()
Returns the inner padding of the legend box.Default: 8.
- Returns:
- padding the inner padding of the legend box
-
setPadding
public void setPadding(Number padding)
Sets the inner padding of the legend box.- Parameters:
padding- the inner padding of the legend box
-
isReversed
public boolean isReversed()
Returns whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object.Default: false.
-
setReversed
public void setReversed(boolean reversed)
Sets whether to reverse the order of the legend items compared to the order of the series or points as defined in the configuration object.
-
isRtl
public boolean isRtl()
Returns whether to show the symbol on the right side of the text rather than the left side. This is common in Arabic and Hebraic.Default: false.
-
setRtl
public void setRtl(boolean rtl)
Sets whether to show the symbol on the right side of the text rather than the left side. This is common in Arabic and Hebraic.
-
isShadow
public boolean isShadow()
Returns whether to apply a drop shadow to the legend. Requires that backgroundColor be set.Default: false.
- See Also:
Shadow
-
getShadow
public Shadow getShadow()
Returns whether to apply a drop shadow to the legend. Requires that backgroundColor be set.Default:
Shadow.NONE.- See Also:
Shadow
-
setShadow
public void setShadow(boolean shadow)
Sets whether to apply a drop shadow to the legend. Requires that backgroundColor be set.
-
setShadow
public void setShadow(Shadow shadow)
Sets whether to apply a drop shadow to the legend. Requires that backgroundColor be set.- See Also:
Shadow
-
isSquareSymbol
public boolean isSquareSymbol()
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.Default: true
- Since:
- 7.2.1.0
-
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.- Since:
- 7.2.1.0
-
getSymbolHeight
public Number getSymbolHeight()
Returns the pixel height of the legend item symbol.Default: 12.
-
setSymbolHeight
public void setSymbolHeight(Number symbolHeight)
Sets the pixel height of the legend item symbol.
-
getSymbolPadding
public Number getSymbolPadding()
Returns the pixel padding between the legend item symbol and the legend item text.Default: 5.
-
setSymbolPadding
public void setSymbolPadding(Number symbolPadding)
Sets the pixel padding between the legend item symbol and the legend item text.
-
getSymbolRadius
public Number getSymbolRadius()
Returns the pixel radius of the legend item symbol.Default: 2.
-
setSymbolRadius
public void setSymbolRadius(Number symbolRadius)
Sets the pixel radius of the legend item symbol.
-
getSymbolWidth
public Number getSymbolWidth()
Returns the pixel width of the legend item symbol.Default: 16.
- Returns:
- symbolWidth the pixel width of the legend item symbol
-
setSymbolWidth
public void setSymbolWidth(Number symbolWidth)
Sets the pixel width of the legend item symbol.
-
getTitle
public LegendTitle getTitle()
Returns a title to be added on top of the legend.Default: .
- Returns:
- title a title to be added on top of the legend
-
setTitle
public void setTitle(LegendTitle title)
Sets a title to be added on top of the legend.- Parameters:
title- a title to be added on top of the legend
-
isUseHTML
public boolean isUseHTML()
Returns whether to use HTML to render the legend item texts. When using HTML,setNavigation(LegendNavigation)is disabled.Default: false.
-
setUseHTML
public void setUseHTML(boolean useHTML)
Sets whether to use HTML to render the legend item texts. When using HTML,setNavigation(LegendNavigation)is disabled.
-
getVerticalAlign
public String getVerticalAlign()
Returns the vertical alignment of the legend box. Can be one of "top", "middle" or "bottom". Vertical position can be further determined by theyoption.Default: "bottom".
-
setVerticalAlign
public void setVerticalAlign(String verticalAlign)
Sets the vertical alignment of the legend box. Can be one of "top", "middle" or "bottom". Vertical position can be further determined by theyoption.
-
getWidth
public Number getWidth()
Returns the width of the legend box.Default: null.
- Returns:
- the width of the legend box
-
setWidth
public void setWidth(Number width)
Sets the width of the legend box.
-
getX
public Number getX()
Returns the x offset of the legend relative to it's horizontal alignmentalignwithin chart.spacingLeft and chart.spacingRight. Negative x moves it to the left, positive x moves it to the right.Default: 0.
-
setX
public void setX(Number x)
Sets the x offset of the legend relative to it's horizontal alignmentalignwithin chart.spacingLeft and chart.spacingRight. Negative x moves it to the left, positive x moves it to the right.
-
getY
public Number getY()
Returns 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.Default: 0.
-
setY
public void setY(Number y)
Sets 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.
-
-