Class DialValueIndicator

java.lang.Object
org.jfree.chart.plot.dial.AbstractDialLayer
org.jfree.chart.plot.dial.DialValueIndicator
All Implemented Interfaces:
Serializable, Cloneable, DialLayer, PublicCloneable

public class DialValueIndicator extends AbstractDialLayer implements DialLayer, Cloneable, PublicCloneable, Serializable
A value indicator for a DialPlot.
See Also:
  • Field Details

    • serialVersionUID

      static final long serialVersionUID
      For serialization.
      See Also:
    • datasetIndex

      private int datasetIndex
      The dataset index.
    • angle

      private double angle
      The angle that defines the anchor point.
    • radius

      private double radius
      The radius that defines the anchor point.
    • frameAnchor

      private RectangleAnchor frameAnchor
      The frame anchor.
    • templateValue

      private Number templateValue
      The template value.
    • maxTemplateValue

      private Number maxTemplateValue
      A data value that will be formatted to determine the maximum size of the indicator bounds. If this is null, the indicator bounds can grow as large as necessary to contain the actual data value.
    • formatter

      private NumberFormat formatter
      The formatter.
    • font

      private Font font
      The font.
    • paint

      private transient Paint paint
      The paint.
    • backgroundPaint

      private transient Paint backgroundPaint
      The background paint.
    • outlineStroke

      private transient Stroke outlineStroke
      The outline stroke.
    • outlinePaint

      private transient Paint outlinePaint
      The outline paint.
    • insets

      private RectangleInsets insets
      The insets.
    • valueAnchor

      private RectangleAnchor valueAnchor
      The value anchor.
    • textAnchor

      private TextAnchor textAnchor
      The text anchor for displaying the value.
  • Constructor Details

    • DialValueIndicator

      public DialValueIndicator()
      Creates a new instance of DialValueIndicator.
    • DialValueIndicator

      public DialValueIndicator(int datasetIndex)
      Creates a new instance of DialValueIndicator.
      Parameters:
      datasetIndex - the dataset index.
  • Method Details

    • getDatasetIndex

      public int getDatasetIndex()
      Returns the index of the dataset from which this indicator fetches its current value.
      Returns:
      The dataset index.
      See Also:
    • setDatasetIndex

      public void setDatasetIndex(int index)
      Sets the dataset index and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      index - the index.
      See Also:
    • getAngle

      public double getAngle()
      Returns the angle for the anchor point. The angle is specified in degrees using the same orientation as Java's Arc2D class.
      Returns:
      The angle (in degrees).
      See Also:
    • setAngle

      public void setAngle(double angle)
      Sets the angle for the anchor point and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      angle - the angle (in degrees).
      See Also:
    • getRadius

      public double getRadius()
      Returns the radius.
      Returns:
      The radius.
      See Also:
    • setRadius

      public void setRadius(double radius)
      Sets the radius and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      radius - the radius.
      See Also:
    • getFrameAnchor

      public RectangleAnchor getFrameAnchor()
      Returns the frame anchor.
      Returns:
      The frame anchor.
      See Also:
    • setFrameAnchor

      public void setFrameAnchor(RectangleAnchor anchor)
      Sets the frame anchor and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      anchor - the anchor (null not permitted).
      See Also:
    • getTemplateValue

      public Number getTemplateValue()
      Returns the template value.
      Returns:
      The template value (never null).
      See Also:
    • setTemplateValue

      public void setTemplateValue(Number value)
      Sets the template value and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      value - the value (null not permitted).
      See Also:
    • getMaxTemplateValue

      public Number getMaxTemplateValue()
      Returns the template value for the maximum size of the indicator bounds.
      Returns:
      The template value (possibly null).
      See Also:
    • setMaxTemplateValue

      public void setMaxTemplateValue(Number value)
      Sets the template value for the maximum size of the indicator bounds and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      value - the value (null permitted).
      See Also:
    • getNumberFormat

      public NumberFormat getNumberFormat()
      Returns the formatter used to format the value.
      Returns:
      The formatter (never null).
      See Also:
    • setNumberFormat

      public void setNumberFormat(NumberFormat formatter)
      Sets the formatter used to format the value and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      formatter - the formatter (null not permitted).
      See Also:
    • getFont

      public Font getFont()
      Returns the font.
      Returns:
      The font (never null).
      See Also:
    • setFont

      public void setFont(Font font)
      Sets the font and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      font - the font (null not permitted).
    • getPaint

      public Paint getPaint()
      Returns the paint.
      Returns:
      The paint (never null).
      See Also:
    • setPaint

      public void setPaint(Paint paint)
      Sets the paint and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      paint - the paint (null not permitted).
      See Also:
    • getBackgroundPaint

      public Paint getBackgroundPaint()
      Returns the background paint.
      Returns:
      The background paint.
      See Also:
    • setBackgroundPaint

      public void setBackgroundPaint(Paint paint)
      Sets the background paint and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      paint - the paint (null not permitted).
      See Also:
    • getOutlineStroke

      public Stroke getOutlineStroke()
      Returns the outline stroke.
      Returns:
      The outline stroke (never null).
      See Also:
    • setOutlineStroke

      public void setOutlineStroke(Stroke stroke)
      Sets the outline stroke and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      stroke - the stroke (null not permitted).
      See Also:
    • getOutlinePaint

      public Paint getOutlinePaint()
      Returns the outline paint.
      Returns:
      The outline paint (never null).
      See Also:
    • setOutlinePaint

      public void setOutlinePaint(Paint paint)
      Sets the outline paint and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      paint - the paint (null not permitted).
      See Also:
    • getInsets

      public RectangleInsets getInsets()
      Returns the insets.
      Returns:
      The insets (never null).
      See Also:
    • setInsets

      public void setInsets(RectangleInsets insets)
      Sets the insets and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      insets - the insets (null not permitted).
      See Also:
    • getValueAnchor

      public RectangleAnchor getValueAnchor()
      Returns the value anchor.
      Returns:
      The value anchor (never null).
      See Also:
    • setValueAnchor

      public void setValueAnchor(RectangleAnchor anchor)
      Sets the value anchor and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      anchor - the anchor (null not permitted).
      See Also:
    • getTextAnchor

      public TextAnchor getTextAnchor()
      Returns the text anchor.
      Returns:
      The text anchor (never null).
      See Also:
    • setTextAnchor

      public void setTextAnchor(TextAnchor anchor)
      Sets the text anchor and sends a DialLayerChangeEvent to all registered listeners.
      Parameters:
      anchor - the anchor (null not permitted).
      See Also:
    • isClippedToWindow

      public boolean isClippedToWindow()
      Returns true to indicate that this layer should be clipped within the dial window.
      Specified by:
      isClippedToWindow in interface DialLayer
      Returns:
      true.
    • draw

      public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view)
      Draws the background to the specified graphics device. If the dial frame specifies a window, the clipping region will already have been set to this window before this method is called.
      Specified by:
      draw in interface DialLayer
      Parameters:
      g2 - the graphics device (null not permitted).
      plot - the plot (ignored here).
      frame - the dial frame (ignored here).
      view - the view rectangle (null not permitted).
    • fixToRange

      private double fixToRange(double x, double minX, double maxX)
      A utility method that adjusts a value, if necessary, to be within a specified range.
      Parameters:
      x - the value.
      minX - the minimum value in the range.
      maxX - the maximum value in the range.
      Returns:
      The adjusted value.
    • equals

      public boolean equals(Object obj)
      Tests this instance for equality with an arbitrary object.
      Overrides:
      equals in class AbstractDialLayer
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Returns a hash code for this instance.
      Overrides:
      hashCode in class AbstractDialLayer
      Returns:
      The hash code.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone of this instance.
      Specified by:
      clone in interface PublicCloneable
      Overrides:
      clone in class AbstractDialLayer
      Returns:
      The clone.
      Throws:
      CloneNotSupportedException - if some attribute of this instance cannot be cloned.
    • writeObject

      private void writeObject(ObjectOutputStream stream) throws IOException
      Provides serialization support.
      Parameters:
      stream - the output stream.
      Throws:
      IOException - if there is an I/O error.
    • readObject

      private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
      Provides serialization support.
      Parameters:
      stream - the input stream.
      Throws:
      IOException - if there is an I/O error.
      ClassNotFoundException - if there is a classpath problem.