com.sencha.gxt.chart.client.chart
Class Legend<M>

java.lang.Object
  extended by com.sencha.gxt.chart.client.chart.Legend<M>
Type Parameters:
M - the data type of the legend
All Implemented Interfaces:
LegendHandler.HasLegendHandlers, LegendItemOutEvent.HasLegendItemOutHandlers, LegendItemOverEvent.HasLegendItemOverHandlers, LegendSelectionEvent.HasLegendSelectionHandlers

public class Legend<M>
extends Object
implements LegendHandler.HasLegendHandlers, LegendSelectionEvent.HasLegendSelectionHandlers, LegendItemOutEvent.HasLegendItemOutHandlers, LegendItemOverEvent.HasLegendItemOverHandlers

Defines a legend for a chart's series. The legend class displays a list of legend items each of them related with a series being rendered.


Constructor Summary
Legend()
           
 
Method Summary
 HandlerRegistration addLegendHandler(LegendHandler handler)
          Adds a LegendHandler handler for LegendSelectionEvent, LegendItemOutEvent, LegendItemOverEvent events.
 HandlerRegistration addLegendItemOutHandler(LegendItemOutEvent.LegendItemOutHandler handler)
          Adds a LegendItemOutEvent.LegendItemOutHandler handler for LegendItemOutEvent events.
 HandlerRegistration addLegendItemOverHandler(LegendItemOverEvent.LegendItemOverHandler handler)
          Adds a LegendItemOverEvent.LegendItemOverHandler handler for LegendItemOverEvent events.
 HandlerRegistration addLegendSelectionHandler(LegendSelectionEvent.LegendSelectionHandler handler)
          Adds a LegendSelectionEvent.LegendSelectionHandler handler for LegendSelectionEvent events.
 void create()
          Create all the sprites for the legend.
 void delete()
          Removes all the sprites of the legend from the surface.
 PreciseRectangle getBBox()
          Calculates and returns the bounding box of the legend.
 Chart<M> getChart()
          Returns the chart that the legend is attached.
 List<String> getCurrentLegendTitles()
          Returns the current list of titles used in the legend.
 LegendItem<M> getItemFromPoint(PrecisePoint point)
          Returns the LegendItem at the given point.
 Chart.Position getPosition()
          Returns the position of the legend.
 ToolTip getToolTip()
          Returns the currently generated tooltip for legend.
 LegendToolTipConfig<M> getToolTipConfig()
          Returns the tool tip configuration of the legend.
 boolean isItemHiding()
          Returns true if legend item hiding is enabled.
 boolean isItemHighlighting()
          Returns true if legend item highlighting is enabled.
 void removeToolTip()
          Removes the components tooltip (if one exists).
 void setChart(Chart<M> chart)
          Sets the chart that the legend is attached.
 void setItemHiding(boolean itemHiding)
          Sets whether or not the legend uses item highlighting.
 void setItemHighlighting(boolean itemHighlighting)
          Sets whether or not the legend uses item highlighting.
 void setPosition(Chart.Position position)
          Sets the position of the legend.
 void setToolTipConfig(LegendToolTipConfig<M> config)
          Sets the tooltip configuration.
 void updatePosition()
          Adjusts the position of the legend to fit in its chart.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Legend

public Legend()
Method Detail

addLegendHandler

public HandlerRegistration addLegendHandler(LegendHandler handler)
Description copied from interface: LegendHandler.HasLegendHandlers
Adds a LegendHandler handler for LegendSelectionEvent, LegendItemOutEvent, LegendItemOverEvent events.

Specified by:
addLegendHandler in interface LegendHandler.HasLegendHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addLegendItemOutHandler

public HandlerRegistration addLegendItemOutHandler(LegendItemOutEvent.LegendItemOutHandler handler)
Description copied from interface: LegendItemOutEvent.HasLegendItemOutHandlers
Adds a LegendItemOutEvent.LegendItemOutHandler handler for LegendItemOutEvent events.

Specified by:
addLegendItemOutHandler in interface LegendItemOutEvent.HasLegendItemOutHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addLegendItemOverHandler

public HandlerRegistration addLegendItemOverHandler(LegendItemOverEvent.LegendItemOverHandler handler)
Description copied from interface: LegendItemOverEvent.HasLegendItemOverHandlers
Adds a LegendItemOverEvent.LegendItemOverHandler handler for LegendItemOverEvent events.

Specified by:
addLegendItemOverHandler in interface LegendItemOverEvent.HasLegendItemOverHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addLegendSelectionHandler

public HandlerRegistration addLegendSelectionHandler(LegendSelectionEvent.LegendSelectionHandler handler)
Description copied from interface: LegendSelectionEvent.HasLegendSelectionHandlers
Adds a LegendSelectionEvent.LegendSelectionHandler handler for LegendSelectionEvent events.

Specified by:
addLegendSelectionHandler in interface LegendSelectionEvent.HasLegendSelectionHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

create

public void create()
Create all the sprites for the legend.


delete

public void delete()
Removes all the sprites of the legend from the surface.


getBBox

public PreciseRectangle getBBox()
Calculates and returns the bounding box of the legend.

Returns:
the bounding box of the legend.

getChart

public Chart<M> getChart()
Returns the chart that the legend is attached.

Returns:
the chart that the legend is attached

getCurrentLegendTitles

public List<String> getCurrentLegendTitles()
Returns the current list of titles used in the legend.

Returns:
the current list of titles used in the legend

getItemFromPoint

public LegendItem<M> getItemFromPoint(PrecisePoint point)
Returns the LegendItem at the given point. Returns null if no item at that point.

Parameters:
point - the point of the item
Returns:
the legend item

getPosition

public Chart.Position getPosition()
Returns the position of the legend.

Returns:
the position of the legend

getToolTip

public ToolTip getToolTip()
Returns the currently generated tooltip for legend.

Returns:
the currently generated tooltip for legend

getToolTipConfig

public LegendToolTipConfig<M> getToolTipConfig()
Returns the tool tip configuration of the legend.

Returns:
the tool tip configuration of the legend

isItemHiding

public boolean isItemHiding()
Returns true if legend item hiding is enabled.

Returns:
true if legend item hiding is enabled

isItemHighlighting

public boolean isItemHighlighting()
Returns true if legend item highlighting is enabled.

Returns:
true if legend item highlighting is enabled

removeToolTip

public void removeToolTip()
Removes the components tooltip (if one exists).


setChart

public void setChart(Chart<M> chart)
Sets the chart that the legend is attached.

Parameters:
chart - the chart that the legend is attached

setItemHiding

public void setItemHiding(boolean itemHiding)
Sets whether or not the legend uses item highlighting.

Parameters:
itemHiding - true if the legend uses item highlighting

setItemHighlighting

public void setItemHighlighting(boolean itemHighlighting)
Sets whether or not the legend uses item highlighting.

Parameters:
itemHighlighting - ture if the legend uses item highlighting

setPosition

public void setPosition(Chart.Position position)
Sets the position of the legend.

Parameters:
position - the position of the legend

setToolTipConfig

public void setToolTipConfig(LegendToolTipConfig<M> config)
Sets the tooltip configuration.

Parameters:
config - the tooltip configuration

updatePosition

public void updatePosition()
Adjusts the position of the legend to fit in its chart.



Copyright © 2011. All Rights Reserved.