Class Legend
- java.lang.Object
-
- org.pepstock.charba.client.configuration.Legend
-
- All Implemented Interfaces:
AddHandlerEventHandler,EventHandler,RemoveHandlerEventHandler
public class Legend extends Object
The chart legend displays data about the datasets that area appearing on the chart.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementAligngetAlign()Returns the alignment of the legend.IsChartgetChart()Returns the chart instanceprotected ExtendedOptionsgetConfiguration()Returns the configuration element.Set<Event>getEvents()Returns the browser events that the legend should listen to.LegendLabelsgetLabels()Returns the legend labels element.intgetMaxHeight()Returns the maximum width of the legend, in pixels.intgetMaxWidth()Returns the maximum width of the legend, in pixels.protected ConfigurationOptionsgetOptions()Returns the configuration options.PositiongetPosition()Returns the position of the legend.TextDirectiongetTextDirection()Returns the text direction of the legend that will force the text direction on the canvas for rendering the legend, regardless of the CSS specified on the canvas.LegendTitlegetTitle()Returns the legend title element.booleanhasClickHandlers()Returnstrueif there is any legend click handler, otherwisefalse.booleanhasHoverHandlers()Returnstrueif there is any legend hover handler, otherwisefalse.booleanhasLeaveHandlers()Returnstrueif there is any legend leave handler, otherwisefalse.booleanisDisplay()Returns if the legend is shown.booleanisFullSize()Returns if marks that this box should take the full width/height of the canvas (moving other boxes).booleanisReverse()Returns if the legend will show datasets in reverse order.booleanisRtl()Returnstruefor rendering the legends from right to left.voidonAdd(AddHandlerEvent event)Invoked when a new event handler is added.voidonRemove(RemoveHandlerEvent event)Invoked when a chart event handler is removed.voidsetAlign(ElementAlign alignment)Sets the alignment of the legend.voidsetDisplay(boolean display)Sets if the legend is shown.voidsetEvents(Event... events)Sets the browser events that the legend should listen to.voidsetFullSize(boolean fullSize)Marks that this box should take the full width/height of the canvas (moving other boxes).voidsetMaxHeight(int maxHeight)Sets the maximum height of the legend, in pixels.voidsetMaxWidth(int maxWidth)Sets the maximum width of the legend, in pixels.voidsetPosition(Position position)Sets the position of the legend.voidsetReverse(boolean reverse)Sets the legend will show datasets in reverse order.voidsetRtl(boolean rtl)Setstruefor rendering the legends from right to left.voidsetTextDirection(TextDirection textDirection)Sets the text direction of the legend that will force the text direction on the canvas for rendering the legend, regardless of the CSS specified on the canvas.
-
-
-
Method Detail
-
getLabels
public LegendLabels getLabels()
Returns the legend labels element.- Returns:
- the labels
-
getTitle
public LegendTitle getTitle()
Returns the legend title element.- Returns:
- the title
-
setEvents
public void setEvents(Event... events)
Sets the browser events that the legend should listen to.- Parameters:
events- the browser events that the legend should listen to.
-
getEvents
public Set<Event> getEvents()
Returns the browser events that the legend should listen to.- Returns:
- the browser events that the legend should listen to.
-
onAdd
public final void onAdd(AddHandlerEvent event)
Description copied from interface:AddHandlerEventHandlerInvoked when a new event handler is added.- Specified by:
onAddin interfaceAddHandlerEventHandler- Parameters:
event- event to be consumed
-
onRemove
public final void onRemove(RemoveHandlerEvent event)
Description copied from interface:RemoveHandlerEventHandlerInvoked when a chart event handler is removed.- Specified by:
onRemovein interfaceRemoveHandlerEventHandler- Parameters:
event- event to be consumed
-
hasClickHandlers
public final boolean hasClickHandlers()
Returnstrueif there is any legend click handler, otherwisefalse.- Returns:
trueif there is any legend click handler, otherwisefalse.
-
hasHoverHandlers
public final boolean hasHoverHandlers()
Returnstrueif there is any legend hover handler, otherwisefalse.- Returns:
trueif there is any legend hover handler, otherwisefalse.
-
hasLeaveHandlers
public final boolean hasLeaveHandlers()
Returnstrueif there is any legend leave handler, otherwisefalse.- Returns:
trueif there is any legend leave handler, otherwisefalse.
-
setDisplay
public void setDisplay(boolean display)
Sets if the legend is shown.- Parameters:
display- if the legend is shown.
-
isDisplay
public boolean isDisplay()
Returns if the legend is shown.- Returns:
- if the legend is shown.
-
setFullSize
public void setFullSize(boolean fullSize)
Marks that this box should take the full width/height of the canvas (moving other boxes).- Parameters:
fullSize- Marks that this box should take the full width/height of the canvas (moving other boxes)
-
isFullSize
public boolean isFullSize()
Returns if marks that this box should take the full width/height of the canvas (moving other boxes).- Returns:
- Marks that this box should take the full width/height of the canvas (moving other boxes)
-
setReverse
public void setReverse(boolean reverse)
Sets the legend will show datasets in reverse order.- Parameters:
reverse- legend will show datasets in reverse order.
-
isReverse
public boolean isReverse()
Returns if the legend will show datasets in reverse order.- Returns:
- Legend will show datasets in reverse order.
-
setPosition
public void setPosition(Position position)
Sets the position of the legend.- Parameters:
position- Position of the legend.
-
getPosition
public Position getPosition()
Returns the position of the legend.- Returns:
- Position of the legend.
-
setAlign
public void setAlign(ElementAlign alignment)
Sets the alignment of the legend.- Parameters:
alignment- alignment of the legend.
-
getAlign
public ElementAlign getAlign()
Returns the alignment of the legend.- Returns:
- alignment of the legend.
-
setRtl
public void setRtl(boolean rtl)
Setstruefor rendering the legends from right to left.- Parameters:
rtl-truefor rendering the legends from right to left
-
isRtl
public boolean isRtl()
Returnstruefor rendering the legends from right to left.- Returns:
truefor rendering the legends from right to left.
-
setTextDirection
public void setTextDirection(TextDirection textDirection)
Sets the text direction of the legend that will force the text direction on the canvas for rendering the legend, regardless of the CSS specified on the canvas.- Parameters:
textDirection- the text direction of the legend.
-
getTextDirection
public TextDirection getTextDirection()
Returns the text direction of the legend that will force the text direction on the canvas for rendering the legend, regardless of the CSS specified on the canvas.- Returns:
- the text direction of the legend.
-
setMaxWidth
public void setMaxWidth(int maxWidth)
Sets the maximum width of the legend, in pixels.- Parameters:
maxWidth- the maximum width of the legend, in pixels
-
getMaxWidth
public int getMaxWidth()
Returns the maximum width of the legend, in pixels.- Returns:
- the maximum width of the legend, in pixels
-
setMaxHeight
public void setMaxHeight(int maxHeight)
Sets the maximum height of the legend, in pixels.- Parameters:
maxHeight- the maximum height of the legend, in pixels
-
getMaxHeight
public int getMaxHeight()
Returns the maximum width of the legend, in pixels.- Returns:
- the maximum width of the legend, in pixels
-
getOptions
protected final ConfigurationOptions getOptions()
Returns the configuration options.- Returns:
- the configuration options.
-
getConfiguration
protected final ExtendedOptions getConfiguration()
Returns the configuration element.- Returns:
- the configuration element.
-
getChart
public final IsChart getChart()
Returns the chart instance- Returns:
- the chart
-
-