A chart title that displays a legend for the data in the chart.
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).
arrange
public Size2D arrange(Graphics2D g2,
RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and
returns the block size.
- arrange in interface Block
- arrange in interface AbstractBlock
g2
- the graphics device.constraint
- the constraint (null
not permitted).
- The block size (in Java2D units, never
null
).
draw
public void draw(Graphics2D g2,
Rectangle2D area)
Draws the title on a Java 2D graphics device (such as the screen or a
printer).
- draw in interface Title
g2
- the graphics device.area
- the available area for the title.
draw
public Object draw(Graphics2D g2,
Rectangle2D area,
Object params)
Draws the block within the specified area.
- draw in interface Block
g2
- the graphics device.area
- the area.params
- ignored (null
permitted).
equals
public boolean equals(Object obj)
Tests this title for equality with an arbitrary object.
- equals in interface Title
obj
- the object (null
permitted).
fetchLegendItems
protected void fetchLegendItems()
Fetches the latest legend items.
getBackgroundPaint
public Paint getBackgroundPaint()
Returns the background paint.
- The background paint (possibly
null
).
getItemFont
public Font getItemFont()
Returns the item font.
getItemLabelPadding
public RectangleInsets getItemLabelPadding()
Returns the padding used for the items labels.
- The padding (never
null
).
getItemPaint
public Paint getItemPaint()
Returns the item paint.
getLegendItemGraphicAnchor
public RectangleAnchor getLegendItemGraphicAnchor()
Returns the legend item graphic anchor.
- The graphic anchor (never
null
).
getLegendItemGraphicEdge
public RectangleEdge getLegendItemGraphicEdge()
Returns the location of the shape within each legend item.
- The location (never
null
).
getLegendItemGraphicLocation
public RectangleAnchor getLegendItemGraphicLocation()
Returns the legend item graphic location.
- The location (never
null
).
getLegendItemGraphicPadding
public RectangleInsets getLegendItemGraphicPadding()
Returns the padding that will be applied to each item graphic.
- The padding (never
null
).
setBackgroundPaint
public void setBackgroundPaint(Paint paint)
Sets the background paint for the legend and sends a
TitleChangeEvent
to all registered listeners.
paint
- the paint (null
permitted).
setItemFont
public void setItemFont(Font font)
font
- the font (null
not permitted).
setItemLabelPadding
public void setItemLabelPadding(RectangleInsets padding)
Sets the padding used for the item labels in the legend.
padding
- the padding (null
not permitted).
setItemPaint
public void setItemPaint(Paint paint)
Sets the item paint.
paint
- the paint (null
not permitted).
setLegendItemGraphicAnchor
public void setLegendItemGraphicAnchor(RectangleAnchor anchor)
Sets the anchor point used for the graphic in each legend item.
anchor
- the anchor point (null
not permitted).
setLegendItemGraphicEdge
public void setLegendItemGraphicEdge(RectangleEdge edge)
Sets the location of the shape within each legend item.
edge
- the edge (null
not permitted).
setLegendItemGraphicLocation
public void setLegendItemGraphicLocation(RectangleAnchor anchor)
Sets the legend item graphic location.
anchor
- the anchor (null
not permitted).
setLegendItemGraphicPadding
public 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.
padding
- the padding (null
not permitted).
setWrapper
public void setWrapper(BlockContainer wrapper)
Sets the wrapper container for the legend.
wrapper
- the wrapper container.