Class PaintScaleLegend

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Block, AxisChangeListener, org.jfree.ui.Drawable, org.jfree.util.PublicCloneable

    public class PaintScaleLegend
    extends Title
    implements AxisChangeListener, org.jfree.util.PublicCloneable
    A legend that shows a range of values and their associated colors, driven by an underlying PaintScale implementation.
    Since:
    1.0.4
    See Also:
    Serialized Form
    • 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

      • 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()
      • 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:
        setAxisOffset(double)
      • 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.
      • getStripWidth

        public double getStripWidth()
        Returns the width of the paint strip, in Java2D units.
        Returns:
        The width of the paint strip.
        See Also:
        setStripWidth(double)
      • getBackgroundPaint

        public java.awt.Paint getBackgroundPaint()
        Returns the background paint.
        Returns:
        The background paint.
      • setBackgroundPaint

        public void setBackgroundPaint​(java.awt.Paint paint)
        Sets the background paint and sends a TitleChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null permitted).
      • getSubdivisionCount

        public int getSubdivisionCount()
        Returns the number of subdivisions used to draw the scale.
        Returns:
        The subdivision count.
        Since:
        1.0.11
      • setSubdivisionCount

        public void setSubdivisionCount​(int count)
        Sets the subdivision count and sends a TitleChangeEvent to all registered listeners.
        Parameters:
        count - the count.
        Since:
        1.0.11
      • arrange

        public org.jfree.ui.Size2D arrange​(java.awt.Graphics2D g2,
                                           RectangleConstraint constraint)
        Arranges the contents of the block, within the given constraints, and returns the block size.
        Specified by:
        arrange in interface Block
        Overrides:
        arrange in class AbstractBlock
        Parameters:
        g2 - the graphics device.
        constraint - the constraint (null not permitted).
        Returns:
        The block size (in Java2D units, never null).
      • arrangeRR

        protected org.jfree.ui.Size2D arrangeRR​(java.awt.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​(java.awt.Graphics2D g2,
                         java.awt.geom.Rectangle2D area)
        Draws the legend within the specified area.
        Specified by:
        draw in interface org.jfree.ui.Drawable
        Specified by:
        draw in class Title
        Parameters:
        g2 - the graphics target (null not permitted).
        area - the drawing area (null not permitted).
      • draw

        public java.lang.Object draw​(java.awt.Graphics2D g2,
                                     java.awt.geom.Rectangle2D area,
                                     java.lang.Object params)
        Draws the legend within the specified area.
        Specified by:
        draw in interface Block
        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​(java.lang.Object obj)
        Tests this legend for equality with an arbitrary object.
        Overrides:
        equals in class Title
        Parameters:
        obj - the object (null permitted).
        Returns:
        A boolean.