|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.moxieapps.gwt.highcharts.client.Configurable<Legend> org.moxieapps.gwt.highcharts.client.Legend
public class Legend
A configurable class that can be used to represent custom legend options for the
chart, which can then be set on the chart (via the BaseChart.setLegend(Legend)
method.)
The legend is a box containing a symbol and name for each series item or point item in the chart.
Example usage:
chart.setLegend(
new Legend()
.setBorderColor("#CC0000")
.setLayout(Legend.Layout.HORIZONTAL)
);
Nested Class Summary | |
---|---|
static class |
Legend.Align
An enumeration of supported legend horizontal alignment types, which can be passed to methods like setAlign(Legend.Align) method. |
static class |
Legend.Layout
An enumeration of supported legend layout types, which can be passed to methods like setLayout(Layout) method. |
static class |
Legend.VerticalAlign
An enumeration of supported legend vertical alignment types, which can be passed to methods like setVerticalAlign(Legend.VerticalAlign) method. |
Constructor Summary | |
---|---|
Legend()
|
Method Summary | |
---|---|
LegendLabelsFormatter |
getLabelsFormatter()
Returns the custom labels formatter that has been applied to the legend, or null if the built-in generic formatter is being used instead. |
Legend |
setAlign(Legend.Align align)
Convenience method for setting the 'align' option of the legend. |
Legend |
setBackgroundColor(String backgroundColor)
Convenience method for setting the 'backgroundColor' option of the legend. |
Legend |
setBorderColor(String borderColor)
Convenience method for setting the 'borderColor' option of the legend. |
Legend |
setBorderRadius(Number borderRadius)
Convenience method for setting the 'borderRadius' option of the legend. |
Legend |
setBorderWidth(Number borderWidth)
Convenience method for setting the 'borderWidth' option of the legend. |
Legend |
setEnabled(boolean enabled)
Convenience method for setting the 'enabled' option for the legend. |
Legend |
setFloating(boolean floating)
Convenience method for setting the 'floating' option of the legend. |
Legend |
setItemHiddenStyle(Style itemHiddenStyle)
Convenience method for setting the 'itemHiddenStyle' options of the legend. |
Legend |
setItemHoverStyle(Style itemHoverStyle)
Convenience method for setting the 'itemHoverStyle' options of the legend. |
Legend |
setItemMarginBottom(Number itemMarginBottom)
Convenience method for setting the 'itemMarginBottom' options of the legend. |
Legend |
setItemMarginTop(Number itemMarginTop)
Convenience method for setting the 'itemMarginTop' options of the legend. |
Legend |
setItemStyle(Style itemStyle)
Convenience method for setting the 'itemStyle' options of the legend. |
Legend |
setItemWidth(Number itemWidth)
Convenience method for setting the 'itemWidth' option of the legend. |
Legend |
setLabelsFormatter(LegendLabelsFormatter legendLabelsFormatter)
Sets a custom formatter for the labels that can be used to control how the text of the legend labels will be displayed. |
Legend |
setLayout(Legend.Layout layout)
Convenience method for setting the 'layout' option of the legend. |
Legend |
setMargin(Number margin)
Convenience method for setting the 'margin' option of the legend. |
Legend |
setMaxHeight(Number maxHeight)
Convenience method for setting the 'reversed' option of the legend. |
Legend |
setNavigationActiveColor(Color activeColor)
Convenience method for setting the "activeColor" option for the legend navigation. |
Legend |
setNavigationActiveColor(Number color)
Convenience method for setting the "activeColor" option for the legend navigation. |
Legend |
setNavigationAnimation(Animation animation)
Convenience method for setting the "animation" option for the legend navigation. |
Legend |
setNavigationAnimation(boolean animation)
Convenience method for setting the "animation" option for the legend navigation. |
Legend |
setNavigationArrowSize(Number arrowSize)
Convenience method for setting the "arrowSize" option for the legend navigation. |
Legend |
setNavigationInactiveColor(Color inactiveColor)
Convenience method for setting the "inactiveColor" option for the legend navigation. |
Legend |
setNavigationInactiveColor(Number inactiveColor)
Convenience method for setting the "inactiveColor" option for the legend navigation. |
Legend |
setNavigationStyle(Style style)
Convenience method for setting the "style" option for the legend navigation. |
Legend |
setPadding(Number padding)
Convenience method for setting the 'reversed' option of the legend. |
Legend |
setReversed(boolean reversed)
Convenience method for setting the 'reversed' option of the legend. |
Legend |
setRtl(boolean rtl)
Convenience method for setting the 'reversed' option of the legend. |
Legend |
setShadow(boolean shadow)
Convenience method for setting the 'shadow' option of the legend. |
Legend |
setStyle(Style style)
Convenience method for setting the 'style' options of the legend. |
Legend |
setSymbolHeight(Number symbolHeight)
Convenience method for setting the 'symbolHeight' option of the lagend. |
Legend |
setSymbolPadding(Number symbolPadding)
Convenience method for setting the 'symbolPadding' option of the legend. |
Legend |
setSymbolRadius(Number symbolRadius)
Convenience method for setting the 'symbolHeight' option of the lagend. |
Legend |
setSymbolWidth(Number symbolWidth)
Convenience method for setting the 'symbolWidth' option of the legend. |
Legend |
setTitleStyle(Style style)
Convenience method for setting the "style" option for the legend title. |
Legend |
setTitleText(String text)
Convenience method for setting the "text" option for the legend title. |
Legend |
setUseHTML(boolean useHTML)
Convenience method for setting the 'useHTML' option of the legend. |
Legend |
setVerticalAlign(Legend.VerticalAlign verticalAlign)
Convenience method for setting the 'verticalAlign' option of the legend. |
Legend |
setWidth(Number width)
Convenience method for setting the 'width' option of the legend. |
Legend |
setX(Number x)
Convenience method for setting the 'x' position option of the legend. |
Legend |
setY(Number y)
Convenience method for setting the 'y' position option of the legend. |
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable |
---|
getOptions, setOption |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Legend()
Method Detail |
---|
public Legend setAlign(Legend.Align align)
legend.setOption("align", Legend.Align.LEFT);
The horizontal alignment of the legend box within the chart area. Can be one of "left", "center" and "right".
Defaults to Legend.Align.CENTER
.
align
- The horizontal alignment of the legend box within the chart area.
Legend
instance for convenient method chaining.public Legend setBackgroundColor(String backgroundColor)
legend.setOption("backgroundColor", "#CCCCCC");
The background color of the legend, filling the rounded corner border. Defaults to null.
backgroundColor
- The value to set as the 'backgroundColor' option on the legend.
Legend
instance for convenient method chaining.public Legend setBorderColor(String borderColor)
legend.setOption("borderColor", "#CCCCCC");
The color of the drawn border around the legend. Defaults to #909090.
borderColor
- The color of the drawn border around the legend.
Legend
instance for convenient method chaining.public Legend setBorderRadius(Number borderRadius)
legend.setOption("borderRadius", 8);
The border corner radius of the legend. Defaults to 5.
borderRadius
- The border corner radius of the legend.
Legend
instance for convenient method chaining.public Legend setBorderWidth(Number borderWidth)
legend.setOption("borderWidth", 3);
The width of the drawn border around the legend. Defaults to 1.
borderWidth
- The width of the drawn border around the legend.
Legend
instance for convenient method chaining.public Legend setFloating(boolean floating)
legend.setOption("floating", true);
When the legend is floating, the plot area ignores it and is allowed to be placed below it. Defaults to false.
floating
- 'true' to float the legend above the plot area, or 'false' (the default) to make space for it.
Legend
instance for convenient method chaining.public Legend setEnabled(boolean enabled)
legend.setOption("enabled", true);
Enable or disable the legend. Defaults to true.
enabled
- Whether or not to enable or disable the legend.
Legend
instance for convenient method chaining.public Legend setItemHiddenStyle(Style itemHiddenStyle)
legend.setOption("/itemHiddenStyle/fontWeight", "bold");
legend.setOption("/itemHiddenStyle/fontFamily", "serif");
etc.
CSS styles for each legend item when the corresponding series or point is hidden. Properties are inherited
from setStyle(Style)
unless overridden here. Defaults to:
itemHiddenStyle
- CSS styles for each legend item when the corresponding series or point is hidden.
Legend
instance for convenient method chaining.public Legend setItemHoverStyle(Style itemHoverStyle)
legend.setOption("/itemHoverStyle/fontWeight", "bold");
legend.setOption("/itemHoverStyle/fontFamily", "serif");
etc.
CSS styles for each legend item in hover mode. Properties are inherited from setStyle(Style)
unless overridden here. Defaults to:
itemHoverStyle
- CSS styles for each legend item in hover mode.
Legend
instance for convenient method chaining.public Legend setItemMarginBottom(Number itemMarginBottom)
legend.setOption("itemMarginBottom", 0);
The pixel bottom margin for each legend item. Defaults to 0.
itemMarginBottom
- The distance in pixels from the last legend item to the bottom border of the legend.
Legend
instance for convenient method chaining.public Legend setItemMarginTop(Number itemMarginTop)
legend.setOption("itemMarginTop", 0);
The pixel top margin for each legend item. Defaults to 0.
itemMarginTop
- The distance in pixels from the top border of the legend to the first legend item.
Legend
instance for convenient method chaining.public Legend setItemStyle(Style itemStyle)
legend.setOption("/itemStyle/fontWeight", "bold");
legend.setOption("/itemStyle/fontFamily", "serif");
etc.
CSS styles for each legend item. Defaults to:
itemStyle
- CSS styles for each legend item.
Legend
instance for convenient method chaining.public Legend setItemWidth(Number itemWidth)
legend.setOption("itemWidth", 150);
The width for each legend item. This is useful in a horizontal layout with many items
when you want the items to align vertically. Defaults to null.
itemWidth
- The width for each legend item, or null to automatically calculate.
Legend
instance for convenient method chaining.public Legend setLayout(Legend.Layout layout)
legend.setOption("layout", Layout.VERTICAL);
The layout of the legend items. Can be one of "horizontal" or "vertical".
Defaults to Legend.Layout.HORIZONTAL
.
layout
- The layout of the legend items.
Legend
instance for convenient method chaining.public Legend setLabelsFormatter(LegendLabelsFormatter legendLabelsFormatter)
LegendLabelsFormatter
interface, and
in particular the LegendLabelsFormatter.format(org.moxieapps.gwt.highcharts.client.labels.LegendLabelsData)
method for more details on the capabilities available to custom legend formatters.
legendLabelsFormatter
- The custom formatter to use for the labels (if not given a built-in
generic formatter is used which simply returns the name of the series
or, for pie charts, the name of the point).
Legend
instance for convenient method chaining.public LegendLabelsFormatter getLabelsFormatter()
public Legend setMargin(Number margin)
legend.setOption("margin", 60);
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 15.
margin
- The space between the legend and the axis labels or plot area.
Legend
instance for convenient method chaining.public Legend setMaxHeight(Number maxHeight)
legend.setOption("maxHeight", 60);
Maximum pixel height for the legend. When the maximum height is extended, navigation will show.
maxHeight
- The Maximum height of the Legend
Legend
instance for convenient method chaining.public Legend setNavigationActiveColor(Color activeColor)
legend.setOption("/navigation/activeColor", #3E576F);
The color for the active up or down arrow in the legend page navigation. Defaults to #3E576F
activeColor
-
Legend
instance for convenient method chaining.public Legend setNavigationActiveColor(Number color)
legend.setOption("/navigation/activeColor", );
The color for the active up or down arrow in the legend page navigation. Defaults to #3E576F
color
-
Legend
instance for convenient method chaining.public Legend setNavigationAnimation(boolean animation)
legend.setOption(("/navigation/animation", true);
How to animate the pages when navigating up or down. A value of true applies the default navigation given in the chart.
animation option. Additional options can be given as an object containing values for easing and duration. Defaults to true.
animation
-
Legend
instance for convenient method chaining.public Legend setNavigationAnimation(Animation animation)
legend.setOption("/navigation/animation", );
How to animate the pages when navigating up or down. A value of true applies the default navigation given in the chart.
animation option. Additional options can be given as an object containing values for easing and duration. Defaults to true.
animation
-
Legend
instance for convenient method chaining.public Legend setNavigationArrowSize(Number arrowSize)
legend.setOption("/navigation/arrowSize", 12);
The pixel size of the up and down arrows in the legend paging navigation. . Defaults to 12.
arrowSize
-
Legend
instance for convenient method chaining.public Legend setNavigationInactiveColor(Color inactiveColor)
legend.setOption("/navigation/inactiveColor", #CCC);
The color of the inactive up or down arrow in the legend page navigation. . Defaults to #CCC.
inactiveColor
-
Legend
instance for convenient method chaining.public Legend setNavigationInactiveColor(Number inactiveColor)
legend.setOption("/navigation/inactiveColor", );
The color of the inactive up or down arrow in the legend page navigation. . Defaults to #CCC.
inactiveColor
-
Legend
instance for convenient method chaining.public Legend setNavigationStyle(Style style)
legend.setOption("/navigation/style", null);
Text styles for the legend page navigation.
style
-
Legend
instance for convenient method chaining.public Legend setPadding(Number padding)
legend.setOption("padding", 8);
The inner padding of the legend box. Defaults to 8.
padding
- the distance in pixels of legend items to the legend border.
Legend
instance for convenient method chaining.public Legend setReversed(boolean reversed)
legend.setOption("reversed", true);
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.
reversed
- 'true' to reverse the order of the legend items.
Legend
instance for convenient method chaining.public Legend setRtl(boolean rtl)
legend.setOption("rtl", true);
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
rtl
- 'true' to show the symbol to the right of the text of the legend item.
Legend
instance for convenient method chaining.public Legend setShadow(boolean shadow)
legend.setOption("shadow", true);
Whether to apply a drop shadow to the legend. A setBackgroundColor(String)
also needs to be applied for this to take effect. Defaults to false.
shadow
- 'true' to apply a drop shadow to the legend.
Legend
instance for convenient method chaining.public Legend setStyle(Style style)
legend.setOption("/style/fontWeight", "bold");
legend.setOption("/style/fontFamily", "serif");
etc.
CSS styles for the legend area. In the 1.x versions the position of the legend area was
determined by CSS. In 2.x, the position is determined by properties like
setAlign(org.moxieapps.gwt.highcharts.client.Legend.Align)
,
setVerticalAlign(org.moxieapps.gwt.highcharts.client.Legend.VerticalAlign)
,
setX(Number)
and setY(Number)
, but the styles are still parsed for backwards compatibility.
style
- CSS styles for the legend area.
Legend
instance for convenient method chaining.public Legend setSymbolHeight(Number symbolHeight)
legend.setOption("symbolHeight", 25);
The pixel height of the symbol for series types that use a rectangle in the legend. Defaults to 12.
symbolHeight
- The pixel height of the symbol.
Legend
instance for convenient method chaining.public Legend setSymbolPadding(Number symbolPadding)
legend.setOption("symbolPadding", 4);
The pixel padding between the legend item symbol and the legend item text. Defaults to 5.
symbolPadding
- The pixel padding between the legend item symbol and the legend item text.
Legend
instance for convenient method chaining.public Legend setSymbolRadius(Number symbolRadius)
legend.setOption("symbolRadius", 5);
The border radius of the symbol for series types that use a rectangle in the legend. Defaults to 2.
symbolRadius
- The border radius of the symbol.
Legend
instance for convenient method chaining.public Legend setSymbolWidth(Number symbolWidth)
legend.setOption("symbolWidth", 40);
The pixel width of the legend item symbol. Defaults to 30.
symbolWidth
- The pixel width of the legend item symbol.
Legend
instance for convenient method chaining.public Legend setTitleStyle(Style style)
legend.setOption("/title/style", "fontWeight: 'bold'");
Generic CSS styles for the legend title. Defaults to:
style: {
fontWeight: 'bold'
}
style
-
Legend
instance for convenient method chaining.public Legend setTitleText(String text)
legend.setOption("/title/text", null);
A text or HTML string for the title. Defaults to null.
text
-
Legend
instance for convenient method chaining.public Legend setUseHTML(boolean useHTML)
legend.setOption("useHTML", false);
Whether to use HTML to render the legend item texts.
Using HTML allows for advanced formatting, images and reliable bi-directional text rendering.
Note that exported images won't respect the HTML, and that HTML won't respect Z-index settings.
When using HTML, legend.navigation is disabled.
useHTML
- 'true' to use HTML to render Legend texts.
Legend
instance for convenient method chaining.public Legend setVerticalAlign(Legend.VerticalAlign verticalAlign)
legend.setOption("verticalAlign", Legend.VerticalAlign.BOTTOM);
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.
Defaults to Legend.VerticalAlign.BOTTOM
.
verticalAlign
- The vertical alignment of the legend.
Legend
instance for convenient method chaining.public Legend setWidth(Number width)
legend.setOption("width", 150);
The width of the legend box, not including and padding set on the style. Defaults to null.
width
- The width of the legend box (not including padding).
Legend
instance for convenient method chaining.public Legend setX(Number x)
legend.setOption("x", 70);
The x offset of the legend relative to it's horizontal alignment align within
BaseChart.setSpacingLeft(Number)
and BaseChart.setSpacingRight(Number)
. Negative x
moves it to the left, positive x moves it to the right. The default value of 15 together
with Legend.Align.CENTER
puts it in the center of the plot area. Defaults to 15.
x
- The x offset of the legend, relative to the chart's spacing.
Legend
instance for convenient method chaining.public Legend setY(Number y)
legend.setOption("y", -20);
The vertical offset of the legend relative to it's vertical alignment (@link VerticalAlign}
within BaseChart.setSpacingTop(Number)
and BaseChart.setSpacingBottom(Number)
.
Negative y moves it up, positive y moves it down. Defaults to 0.
y
- The y position of the legend, relative to the chart's spacing.
Legend
instance for convenient method chaining.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |