org.jplot2d.element
Interface Legend
-
- All Superinterfaces:
- Element, MovableComponent, PComponent
- All Known Subinterfaces:
- LegendEx
- All Known Implementing Classes:
- LegendImpl
public interface Legend extends MovableComponent
Legend display legend items. If there is no item in a legend, it will not show.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description intgetColumns()Returns the number of columns in the legend item.HAligngetHAlign()Get the horizontal alignment.LegendItem[]getItems()Returns all legend items managed by this legendjava.awt.geom.Point2DgetLocation()Gets the location of this legend.LegendPositiongetPosition()Gets the current position of this legend.doublegetRowSpacingFactor()Returns the row spacing factor.VAligngetVAlign()Get the vertical alignment.booleanisBorderVisible()Returnstrueif the legend border is visiblebooleanisEnabled()Returnstrueif this legend is enabled.booleanisMovable()Returnstrueif the component is movable by mouse dragging.voidsetBorderVisible(boolean visible)Sets if the legend border is visible.voidsetColumns(int columns)Sets the number of columns.voidsetEnabled(boolean enabled)Set totrueto let this legend to host items.voidsetHAlign(HAlign halign)Set the horizontal alignment.voidsetLocation(double x, double y)Moves this legend to a new location.voidsetLocation(java.awt.geom.Point2D loc)Moves this legend to a new location.voidsetMovable(boolean movable)Set if the component is movable by mouse dragging.voidsetPosition(LegendPosition position)Sets the position of this legend.voidsetRowSpacingFactor(double factor)Sets the row spacing factor.voidsetVAlign(VAlign valign)Set the vertical alignment.-
Methods inherited from interface org.jplot2d.element.PComponent
getBounds, getColor, getEffectiveFont, getFontName, getFontScale, getFontSize, getFontStyle, getPaperTransform, getParent, getSelectableBounds, getSize, getZOrder, isCacheable, isSelectable, isVisible, setCacheable, setColor, setFont, setFontName, setFontScale, setFontSize, setFontStyle, setSelectable, setVisible, setZOrder
-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment, getId
-
-
-
-
Method Detail
-
isEnabled
boolean isEnabled()
Returnstrueif this legend is enabled. By default, the legend is enabled.- Returns:
- the enabled flag.
-
setEnabled
void setEnabled(boolean enabled)
Set totrueto let this legend to host items. Otherwise the items will be displayed in parent legend. The disabled legend will not show.- Parameters:
enabled-
-
getPosition
LegendPosition getPosition()
Gets the current position of this legend.- Returns:
- the position.
-
setPosition
void setPosition(LegendPosition position)
Sets the position of this legend. Only when position isLegendPosition.FREE, the legend can be located bysetLocation(Point2D),#setHAlign(),#setVAlign().- Parameters:
position- the position of this legend.
-
getLocation
java.awt.geom.Point2D getLocation()
Gets the location of this legend.- Specified by:
getLocationin interfacePComponent- Returns:
- an instance of
Pointrepresenting the base point of this legend
-
setLocation
void setLocation(java.awt.geom.Point2D loc)
Moves this legend to a new location. Setting legend to a new location will change legend position toLegendPosition.FREE- Specified by:
setLocationin interfaceMovableComponent- Parameters:
loc- the base point of this legend
-
setLocation
void setLocation(double x, double y)Moves this legend to a new location. Setting legend to a new location will change legend position toLegendPosition.FREE- Specified by:
setLocationin interfaceMovableComponent- Parameters:
x- the x-coordinate of the new locationy- the y-coordinate of the new location
-
getHAlign
HAlign getHAlign()
Get the horizontal alignment.- Returns:
- the horizontal alignment.
-
setHAlign
void setHAlign(HAlign halign)
Set the horizontal alignment. The alignment can be LEFT, CENTER, or RIGHT. eg, LEFT means the base point is on the left of this legend.Notice: This method should be called when the position is
LegendPosition.FREE, otherwise the behavior is not defined.- Parameters:
halign- horizontal alignment.
-
getVAlign
VAlign getVAlign()
Get the vertical alignment.- Returns:
- the vertical alignment.
-
setVAlign
void setVAlign(VAlign valign)
Set the vertical alignment. The alignment can be TOP, MIDDLE, or BOTTOM. eg, TOP means the base point is on the top of this legend.Notice: This method should be called when the position is
LegendPosition.FREE, otherwise the behavior is not defined.- Parameters:
valign- The vertical alignment.
-
getColumns
int getColumns()
Returns the number of columns in the legend item.- Returns:
- the number of columns
-
setColumns
void setColumns(int columns)
Sets the number of columns. This method only take effect when position isLegendPosition.FREE. Otherwise the columns is auto selected.- Parameters:
cols- number of columns
-
getRowSpacingFactor
double getRowSpacingFactor()
Returns the row spacing factor. The row spacing is factor * row height.- Returns:
- the row spacing factor
-
setRowSpacingFactor
void setRowSpacingFactor(double factor)
Sets the row spacing factor. The row spacing is factor * row height. The default factor is 0.125- Parameters:
factor- the row spacing factor
-
isBorderVisible
boolean isBorderVisible()
Returnstrueif the legend border is visible- Returns:
trueif the legend border is visible
-
setBorderVisible
void setBorderVisible(boolean visible)
Sets if the legend border is visible. By default, the legend border is visible.- Parameters:
visible- the flag to indicate if the legend border is visible
-
isMovable
boolean isMovable()
Description copied from interface:MovableComponentReturnstrueif the component is movable by mouse dragging. Only selectable component can be movable.- Specified by:
isMovablein interfaceMovableComponent- Returns:
trueif movable
-
setMovable
void setMovable(boolean movable)
Description copied from interface:MovableComponentSet if the component is movable by mouse dragging.- Specified by:
setMovablein interfaceMovableComponent- Parameters:
movable-trueif movable
-
getItems
LegendItem[] getItems()
Returns all legend items managed by this legend- Returns:
- items managed by this legend
-
-
DMelt 3.0 © DataMelt by jWork.ORG