de.erichseifert.gral.plots.legends
Interface Legend
-
- All Known Implementing Classes:
- AbstractLegend, BarPlot.BarPlotLegend, BoxPlot.BoxPlotLegend, PiePlot.PiePlotLegend, SeriesLegend, ValueLegend, XYPlot.XYLegend
public interface Legend extends Container, Drawable
Interface for a legend that display visual examples of the variables used in a plot.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidadd(DataSource source)Adds the specified data source in order to display it.voidclear()Removes all data sources from the legend.booleancontains(DataSource source)Returns whether the specified data source was added to the legend.doublegetAlignmentX()Returns the horizontal alignment of the legend relative to the plot area.doublegetAlignmentY()Returns the vertical alignment of the legend relative to the plot area.java.awt.PaintgetBackground()Returns the paint used to draw the background.java.awt.FontgetBaseFont()Returns the current font used as a default for sub-components ans for calculation of relative sizes.java.awt.PaintgetBorderColor()Returns the paint used to fill the border of the legend.java.awt.StrokegetBorderStroke()Returns the stroke used to draw the border of the legend.java.awt.FontgetFont()Returns the font used to display the labels.java.awt.geom.Dimension2DgetGap()Returns the horizontal and vertical gap between items.OrientationgetOrientation()Returns the direction of the legend's items.java.awt.geom.Dimension2DgetSymbolSize()Returns the size of the legend's symbols.voidremove(DataSource source)Removes the specified data source.voidsetAlignmentX(double alignmentX)Sets the horizontal alignment of the legend relative to the plot area.voidsetAlignmentY(double alignmentY)Sets the vertical alignment of the legend relative to the plot area.voidsetBackground(java.awt.Paint background)Sets the paint used to draw the background.voidsetBaseFont(java.awt.Font baseFont)Sets the new font that will be used as a default for sub-components and for calculation of relative sizes.voidsetBorderColor(java.awt.Paint borderColor)Sets the paint used to fill the border of the legend.voidsetBorderStroke(java.awt.Stroke borderStroke)Sets the stroke used to draw the border of the legend.voidsetFont(java.awt.Font font)Sets the font used to display the labels.voidsetGap(java.awt.geom.Dimension2D gap)Sets the horizontal and vertical gap between items.voidsetOrientation(Orientation orientation)Sets the direction of the legend's items.voidsetSymbolSize(java.awt.geom.Dimension2D symbolSize)Sets the size of the legend's symbols.
-
-
-
Method Detail
-
add
void add(DataSource source)
Adds the specified data source in order to display it.- Parameters:
source- data source to be added.
-
contains
boolean contains(DataSource source)
Returns whether the specified data source was added to the legend.- Parameters:
source- Data source- Returns:
trueif legend contains the data source, otherwisefalse
-
remove
void remove(DataSource source)
Removes the specified data source.- Parameters:
source- Data source to be removed.
-
clear
void clear()
Removes all data sources from the legend.
-
getBaseFont
java.awt.Font getBaseFont()
Returns the current font used as a default for sub-components ans for calculation of relative sizes.- Returns:
- Current base font.
-
setBaseFont
void setBaseFont(java.awt.Font baseFont)
Sets the new font that will be used as a default for sub-components and for calculation of relative sizes. This method is only used internally to propagate the base font and shouldn't be used manually.- Parameters:
baseFont- New base font.
-
getBackground
java.awt.Paint getBackground()
Returns the paint used to draw the background.- Returns:
- Paint used for background drawing.
-
setBackground
void setBackground(java.awt.Paint background)
Sets the paint used to draw the background.- Parameters:
background- Paint used for background drawing.
-
getBorderStroke
java.awt.Stroke getBorderStroke()
Returns the stroke used to draw the border of the legend.- Returns:
- Stroke used for border drawing.
-
setBorderStroke
void setBorderStroke(java.awt.Stroke borderStroke)
Sets the stroke used to draw the border of the legend.- Parameters:
borderStroke- Stroke used for border drawing.
-
getFont
java.awt.Font getFont()
Returns the font used to display the labels.- Returns:
- Font used for labels.
-
setFont
void setFont(java.awt.Font font)
Sets the font used to display the labels.- Parameters:
font- Font used for labels.
-
getBorderColor
java.awt.Paint getBorderColor()
Returns the paint used to fill the border of the legend.- Returns:
- Paint used for border drawing.
-
setBorderColor
void setBorderColor(java.awt.Paint borderColor)
Sets the paint used to fill the border of the legend.- Parameters:
borderColor- Paint used for border drawing.
-
getOrientation
Orientation getOrientation()
Returns the direction of the legend's items.- Returns:
- Item orientation.
-
setOrientation
void setOrientation(Orientation orientation)
Sets the direction of the legend's items.- Parameters:
orientation- Item orientation.
-
getSymbolSize
java.awt.geom.Dimension2D getSymbolSize()
Returns the size of the legend's symbols.- Returns:
- Symbol size relative to the font height.
-
setSymbolSize
void setSymbolSize(java.awt.geom.Dimension2D symbolSize)
Sets the size of the legend's symbols.- Parameters:
symbolSize- Symbol size relative to the font height.
-
getAlignmentX
double getAlignmentX()
Returns the horizontal alignment of the legend relative to the plot area.0.0means left,0.5means centered, and1.0means right.- Returns:
- Relative horizontal alignment.
-
setAlignmentX
void setAlignmentX(double alignmentX)
Sets the horizontal alignment of the legend relative to the plot area.0.0means left,0.5means centered, and1.0means right.- Parameters:
alignmentX- Relative horizontal alignment.
-
getAlignmentY
double getAlignmentY()
Returns the vertical alignment of the legend relative to the plot area.0.0means top,0.5means centered, and1.0means bottom.- Returns:
- Relative vertical alignment.
-
setAlignmentY
void setAlignmentY(double alignmentY)
Sets the vertical alignment of the legend relative to the plot area.0.0means top,0.5means centered, and1.0means bottom.- Parameters:
alignmentY- Relative vertical alignment.
-
getGap
java.awt.geom.Dimension2D getGap()
Returns the horizontal and vertical gap between items.- Returns:
- Gap size relative to the font height.
-
setGap
void setGap(java.awt.geom.Dimension2D gap)
Sets the horizontal and vertical gap between items.- Parameters:
gap- Gap size relative to the font height.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG