org.jfree.chart.title
public class LegendTitle extends Title implements Cloneable, PublicCloneable, Serializable
The title can be populated with legend items manually, or you can assign a reference to the plot, in which case the legend items will be automatically created to match the dataset(s).
Field Summary | |
---|---|
static Font | DEFAULT_ITEM_FONT The default item font. |
static Paint | DEFAULT_ITEM_PAINT The default item paint. |
Constructor Summary | |
---|---|
LegendTitle(LegendItemSource source)
Constructs a new (empty) legend for the specified source.
| |
LegendTitle(LegendItemSource source, Arrangement hLayout, Arrangement vLayout)
Creates a new legend title with the specified arrangement.
|
Method Summary | |
---|---|
Size2D | arrange(Graphics2D g2, RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and
returns the block size.
|
protected Block | createLegendItemBlock(LegendItem item)
Creates a legend item block.
|
void | draw(Graphics2D g2, Rectangle2D area)
Draws the title on a Java 2D graphics device (such as the screen or a
printer).
|
Object | draw(Graphics2D g2, Rectangle2D area, Object params)
Draws the block within the specified area.
|
boolean | equals(Object obj)
Tests this title for equality with an arbitrary object.
|
protected void | fetchLegendItems()
Fetches the latest legend items. |
Paint | getBackgroundPaint()
Returns the background paint.
|
BlockContainer | getItemContainer()
Returns the container that holds the legend items.
|
Font | getItemFont()
Returns the item font.
|
RectangleInsets | getItemLabelPadding()
Returns the padding used for the items labels.
|
Paint | getItemPaint()
Returns the item paint.
|
RectangleAnchor | getLegendItemGraphicAnchor()
Returns the legend item graphic anchor.
|
RectangleEdge | getLegendItemGraphicEdge()
Returns the location of the shape within each legend item.
|
RectangleAnchor | getLegendItemGraphicLocation()
Returns the legend item graphic location.
|
RectangleInsets | getLegendItemGraphicPadding()
Returns the padding that will be applied to each item graphic.
|
LegendItemSource[] | getSources()
Returns the legend item sources.
|
void | setBackgroundPaint(Paint paint)
Sets the background paint for the legend and sends a
TitleChangeEvent to all registered listeners.
|
void | setItemFont(Font font)
Sets the item font and sends a TitleChangeEvent to
all registered listeners.
|
void | setItemLabelPadding(RectangleInsets padding)
Sets the padding used for the item labels in the legend.
|
void | setItemPaint(Paint paint)
Sets the item paint.
|
void | setLegendItemGraphicAnchor(RectangleAnchor anchor)
Sets the anchor point used for the graphic in each legend item.
|
void | setLegendItemGraphicEdge(RectangleEdge edge)
Sets the location of the shape within each legend item.
|
void | setLegendItemGraphicLocation(RectangleAnchor anchor)
Sets the legend item graphic location.
|
void | setLegendItemGraphicPadding(RectangleInsets padding)
Sets the padding that will be applied to each item graphic in the
legend and sends a TitleChangeEvent to all registered listeners.
|
void | setSources(LegendItemSource[] sources)
Sets the legend item sources and sends a TitleChangeEvent to
all registered listeners.
|
void | setWrapper(BlockContainer wrapper)
Sets the wrapper container for the legend.
|
Parameters: source the source.
Parameters: source the source. hLayout the horizontal item arrangement (null
not
permitted). vLayout the vertical item arrangement (null
not
permitted).
Parameters: g2 the graphics device. constraint the constraint (null
not permitted).
Returns: The block size (in Java2D units, never null
).
Parameters: item the legend item.
Returns: The block.
Parameters: g2 the graphics device. area the available area for the title.
Parameters: g2 the graphics device. area the area. params ignored (null
permitted).
Returns: An EntityBlockResult or
null
.
Parameters: obj the object (null
permitted).
Returns: A boolean.
Returns: The background paint (possibly null
).
Returns: The container for the legend items.
Returns: The font (never null
).
Returns: The padding (never null
).
Returns: The paint (never null
).
Returns: The graphic anchor (never null
).
Returns: The location (never null
).
Returns: The location (never null
).
Returns: The padding (never null
).
Returns: The sources.
Parameters: paint the paint (null
permitted).
Parameters: font the font (null
not permitted).
Parameters: padding the padding (null
not permitted).
Parameters: paint the paint (null
not permitted).
Parameters: anchor the anchor point (null
not permitted).
Parameters: edge the edge (null
not permitted).
Parameters: anchor the anchor (null
not permitted).
Parameters: padding the padding (null
not permitted).
Parameters: sources the sources (null
not permitted).
Parameters: wrapper the wrapper container.