org.jfree.chart.title

Class PaintScaleLegend

public class PaintScaleLegend extends Title implements PublicCloneable

A legend that shows a range of values and their associated colors, driven by an underlying PaintScale implementation.

Since: 1.0.4

Constructor Summary
PaintScaleLegend(PaintScale scale, ValueAxis axis)
Creates a new instance.
Method Summary
Size2Darrange(Graphics2D g2, RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and returns the block size.
protected Size2DarrangeRR(Graphics2D g2, Range widthRange, Range heightRange)
Returns the content size for the title.
voiddraw(Graphics2D g2, Rectangle2D area)
Draws the legend within the specified area.
Objectdraw(Graphics2D g2, Rectangle2D area, Object params)
Draws the legend within the specified area.
booleanequals(Object obj)
Tests this legend for equality with an arbitrary object.
ValueAxisgetAxis()
Returns the axis for the paint scale.
AxisLocationgetAxisLocation()
Returns the axis location.
doublegetAxisOffset()
Returns the offset between the axis and the paint strip.
PaintgetBackgroundPaint()
Returns the background paint.
PaintScalegetScale()
Returns the scale used to convert values to colors.
PaintgetStripOutlinePaint()
Returns the paint used to draw the outline of the paint strip.
StrokegetStripOutlineStroke()
Returns the stroke used to draw the outline around the paint strip.
doublegetStripWidth()
Returns the width of the paint strip, in Java2D units.
booleanisStripOutlineVisible()
Returns the flag that controls whether or not an outline is drawn around the paint strip.
voidsetAxis(ValueAxis axis)
Sets the axis for the paint scale and sends a TitleChangeEvent to all registered listeners.
voidsetAxisLocation(AxisLocation location)
Sets the axis location and sends a TitleChangeEvent to all registered listeners.
voidsetAxisOffset(double offset)
Sets the offset between the axis and the paint strip and sends a TitleChangeEvent to all registered listeners.
voidsetBackgroundPaint(Paint paint)
Sets the background paint and sends a TitleChangeEvent to all registered listeners.
voidsetScale(PaintScale scale)
Sets the scale and sends a TitleChangeEvent to all registered listeners.
voidsetStripOutlinePaint(Paint paint)
Sets the paint used to draw the outline of the paint strip, and sends a TitleChangeEvent to all registered listeners.
voidsetStripOutlineStroke(Stroke stroke)
Sets the stroke used to draw the outline around the paint strip and sends a TitleChangeEvent to all registered listeners.
voidsetStripOutlineVisible(boolean visible)
Sets the flag that controls whether or not an outline is drawn around the paint strip, and sends a TitleChangeEvent to all registered listeners.
voidsetStripWidth(double width)
Sets the width of the paint strip and sends a TitleChangeEvent to all registered listeners.

Constructor Detail

PaintScaleLegend

public PaintScaleLegend(PaintScale scale, ValueAxis axis)
Creates a new instance.

Parameters: scale the scale (null not permitted). axis the axis (null not permitted).

Method Detail

arrange

public Size2D arrange(Graphics2D g2, RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and returns the block size.

Parameters: g2 the graphics device. constraint the constraint (null not permitted).

Returns: The block size (in Java2D units, never null).

arrangeRR

protected Size2D arrangeRR(Graphics2D g2, Range widthRange, Range heightRange)
Returns the content size for the title. This will reflect the fact that a text title positioned on the left or right of a chart will be rotated 90 degrees.

Parameters: g2 the graphics device. widthRange the width range. heightRange the height range.

Returns: The content size.

draw

public void draw(Graphics2D g2, Rectangle2D area)
Draws the legend within the specified area.

Parameters: g2 the graphics target (null not permitted). area the drawing area (null not permitted).

draw

public Object draw(Graphics2D g2, Rectangle2D area, Object params)
Draws the legend within the specified area.

Parameters: g2 the graphics target (null not permitted). area the drawing area (null not permitted). params drawing parameters (ignored here).

Returns: null.

equals

public boolean equals(Object obj)
Tests this legend for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getAxis

public ValueAxis getAxis()
Returns the axis for the paint scale.

Returns: The axis (never null).

See Also: setAxis

getAxisLocation

public AxisLocation getAxisLocation()
Returns the axis location.

Returns: The axis location (never null).

See Also: setAxisLocation

getAxisOffset

public double getAxisOffset()
Returns the offset between the axis and the paint strip.

Returns: The offset between the axis and the paint strip.

See Also: PaintScaleLegend

getBackgroundPaint

public Paint getBackgroundPaint()
Returns the background paint.

Returns: The background paint.

getScale

public PaintScale getScale()
Returns the scale used to convert values to colors.

Returns: The scale (never null).

See Also: setScale

getStripOutlinePaint

public Paint getStripOutlinePaint()
Returns the paint used to draw the outline of the paint strip.

Returns: The paint (never null).

See Also: setStripOutlinePaint

getStripOutlineStroke

public Stroke getStripOutlineStroke()
Returns the stroke used to draw the outline around the paint strip.

Returns: The stroke (never null).

See Also: setStripOutlineStroke

getStripWidth

public double getStripWidth()
Returns the width of the paint strip, in Java2D units.

Returns: The width of the paint strip.

See Also: PaintScaleLegend

isStripOutlineVisible

public boolean isStripOutlineVisible()
Returns the flag that controls whether or not an outline is drawn around the paint strip.

Returns: A boolean.

See Also: PaintScaleLegend

setAxis

public void setAxis(ValueAxis axis)
Sets the axis for the paint scale and sends a TitleChangeEvent to all registered listeners.

Parameters: axis the axis (null not permitted).

See Also: getAxis

setAxisLocation

public void setAxisLocation(AxisLocation location)
Sets the axis location and sends a TitleChangeEvent to all registered listeners.

Parameters: location the location (null not permitted).

See Also: getAxisLocation

setAxisOffset

public void setAxisOffset(double offset)
Sets the offset between the axis and the paint strip and sends a TitleChangeEvent to all registered listeners.

Parameters: offset the offset.

setBackgroundPaint

public void setBackgroundPaint(Paint paint)
Sets the background paint and sends a TitleChangeEvent to all registered listeners.

Parameters: paint the paint (null permitted).

setScale

public void setScale(PaintScale scale)
Sets the scale and sends a TitleChangeEvent to all registered listeners.

Parameters: scale the scale (null not permitted).

See Also: getScale

setStripOutlinePaint

public void setStripOutlinePaint(Paint paint)
Sets the paint used to draw the outline of the paint strip, and sends a TitleChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getStripOutlinePaint

setStripOutlineStroke

public void setStripOutlineStroke(Stroke stroke)
Sets the stroke used to draw the outline around the paint strip and sends a TitleChangeEvent to all registered listeners.

Parameters: stroke the stroke (null not permitted).

See Also: getStripOutlineStroke

setStripOutlineVisible

public void setStripOutlineVisible(boolean visible)
Sets the flag that controls whether or not an outline is drawn around the paint strip, and sends a TitleChangeEvent to all registered listeners.

Parameters: visible the flag.

See Also: isStripOutlineVisible

setStripWidth

public void setStripWidth(double width)
Sets the width of the paint strip and sends a TitleChangeEvent to all registered listeners.

Parameters: width the width.

See Also: getStripWidth