Package org.jfree.chart.plot.dial
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 Summary
FieldsModifier and TypeFieldDescriptionprivate double
The angle that defines the anchor point.private Paint
The background paint.private int
The dataset index.private Font
The font.private NumberFormat
The formatter.private RectangleAnchor
The frame anchor.private RectangleInsets
The insets.private Number
A data value that will be formatted to determine the maximum size of the indicator bounds.private Paint
The outline paint.private Stroke
The outline stroke.private Paint
The paint.private double
The radius that defines the anchor point.(package private) static final long
For serialization.private Number
The template value.private TextAnchor
The text anchor for displaying the value.private RectangleAnchor
The value anchor. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofDialValueIndicator
.DialValueIndicator
(int datasetIndex) Creates a new instance ofDialValueIndicator
. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of this instance.void
draw
(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) Draws the background to the specified graphics device.boolean
Tests this instance for equality with an arbitrary object.private double
fixToRange
(double x, double minX, double maxX) A utility method that adjusts a value, if necessary, to be within a specified range.double
getAngle()
Returns the angle for the anchor point.Returns the background paint.int
Returns the index of the dataset from which this indicator fetches its current value.getFont()
Returns the font.Returns the frame anchor.Returns the insets.Returns the template value for the maximum size of the indicator bounds.Returns the formatter used to format the value.Returns the outline paint.Returns the outline stroke.getPaint()
Returns the paint.double
Returns the radius.Returns the template value.Returns the text anchor.Returns the value anchor.int
hashCode()
Returns a hash code for this instance.boolean
Returnstrue
to indicate that this layer should be clipped within the dial window.private void
readObject
(ObjectInputStream stream) Provides serialization support.void
setAngle
(double angle) Sets the angle for the anchor point and sends aDialLayerChangeEvent
to all registered listeners.void
setBackgroundPaint
(Paint paint) Sets the background paint and sends aDialLayerChangeEvent
to all registered listeners.void
setDatasetIndex
(int index) Sets the dataset index and sends aDialLayerChangeEvent
to all registered listeners.void
Sets the font and sends aDialLayerChangeEvent
to all registered listeners.void
setFrameAnchor
(RectangleAnchor anchor) Sets the frame anchor and sends aDialLayerChangeEvent
to all registered listeners.void
setInsets
(RectangleInsets insets) Sets the insets and sends aDialLayerChangeEvent
to all registered listeners.void
setMaxTemplateValue
(Number value) Sets the template value for the maximum size of the indicator bounds and sends aDialLayerChangeEvent
to all registered listeners.void
setNumberFormat
(NumberFormat formatter) Sets the formatter used to format the value and sends aDialLayerChangeEvent
to all registered listeners.void
setOutlinePaint
(Paint paint) Sets the outline paint and sends aDialLayerChangeEvent
to all registered listeners.void
setOutlineStroke
(Stroke stroke) Sets the outline stroke and sends aDialLayerChangeEvent
to all registered listeners.void
Sets the paint and sends aDialLayerChangeEvent
to all registered listeners.void
setRadius
(double radius) Sets the radius and sends aDialLayerChangeEvent
to all registered listeners.void
setTemplateValue
(Number value) Sets the template value and sends aDialLayerChangeEvent
to all registered listeners.void
setTextAnchor
(TextAnchor anchor) Sets the text anchor and sends aDialLayerChangeEvent
to all registered listeners.void
setValueAnchor
(RectangleAnchor anchor) Sets the value anchor and sends aDialLayerChangeEvent
to all registered listeners.private void
writeObject
(ObjectOutputStream stream) Provides serialization support.Methods inherited from class org.jfree.chart.plot.dial.AbstractDialLayer
addChangeListener, hasListener, isVisible, notifyListeners, removeChangeListener, setVisible
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.chart.plot.dial.DialLayer
addChangeListener, hasListener, isVisible, removeChangeListener
-
Field Details
-
serialVersionUID
static final long serialVersionUIDFor serialization.- See Also:
-
datasetIndex
private int datasetIndexThe dataset index. -
angle
private double angleThe angle that defines the anchor point. -
radius
private double radiusThe radius that defines the anchor point. -
frameAnchor
The frame anchor. -
templateValue
The template value. -
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
The formatter. -
font
The font. -
paint
The paint. -
backgroundPaint
The background paint. -
outlineStroke
The outline stroke. -
outlinePaint
The outline paint. -
insets
The insets. -
valueAnchor
The value anchor. -
textAnchor
The text anchor for displaying the value.
-
-
Constructor Details
-
DialValueIndicator
public DialValueIndicator()Creates a new instance ofDialValueIndicator
. -
DialValueIndicator
public DialValueIndicator(int datasetIndex) Creates a new instance ofDialValueIndicator
.- 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 aDialLayerChangeEvent
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'sArc2D
class.- Returns:
- The angle (in degrees).
- See Also:
-
setAngle
public void setAngle(double angle) Sets the angle for the anchor point and sends aDialLayerChangeEvent
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 aDialLayerChangeEvent
to all registered listeners.- Parameters:
radius
- the radius.- See Also:
-
getFrameAnchor
Returns the frame anchor.- Returns:
- The frame anchor.
- See Also:
-
setFrameAnchor
Sets the frame anchor and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
anchor
- the anchor (null
not permitted).- See Also:
-
getTemplateValue
Returns the template value.- Returns:
- The template value (never
null
). - See Also:
-
setTemplateValue
Sets the template value and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
value
- the value (null
not permitted).- See Also:
-
getMaxTemplateValue
Returns the template value for the maximum size of the indicator bounds.- Returns:
- The template value (possibly
null
). - See Also:
-
setMaxTemplateValue
Sets the template value for the maximum size of the indicator bounds and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
value
- the value (null
permitted).- See Also:
-
getNumberFormat
Returns the formatter used to format the value.- Returns:
- The formatter (never
null
). - See Also:
-
setNumberFormat
Sets the formatter used to format the value and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
formatter
- the formatter (null
not permitted).- See Also:
-
getFont
Returns the font.- Returns:
- The font (never
null
). - See Also:
-
setFont
Sets the font and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
font
- the font (null
not permitted).
-
getPaint
Returns the paint.- Returns:
- The paint (never
null
). - See Also:
-
setPaint
Sets the paint and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getBackgroundPaint
Returns the background paint.- Returns:
- The background paint.
- See Also:
-
setBackgroundPaint
Sets the background paint and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getOutlineStroke
Returns the outline stroke.- Returns:
- The outline stroke (never
null
). - See Also:
-
setOutlineStroke
Sets the outline stroke and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
-
getOutlinePaint
Returns the outline paint.- Returns:
- The outline paint (never
null
). - See Also:
-
setOutlinePaint
Sets the outline paint and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getInsets
Returns the insets.- Returns:
- The insets (never
null
). - See Also:
-
setInsets
Sets the insets and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
insets
- the insets (null
not permitted).- See Also:
-
getValueAnchor
Returns the value anchor.- Returns:
- The value anchor (never
null
). - See Also:
-
setValueAnchor
Sets the value anchor and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
anchor
- the anchor (null
not permitted).- See Also:
-
getTextAnchor
Returns the text anchor.- Returns:
- The text anchor (never
null
). - See Also:
-
setTextAnchor
Sets the text anchor and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
anchor
- the anchor (null
not permitted).- See Also:
-
isClippedToWindow
public boolean isClippedToWindow()Returnstrue
to indicate that this layer should be clipped within the dial window.- Specified by:
isClippedToWindow
in interfaceDialLayer
- Returns:
true
.
-
draw
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. -
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
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classAbstractDialLayer
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()Returns a hash code for this instance.- Overrides:
hashCode
in classAbstractDialLayer
- Returns:
- The hash code.
-
clone
Returns a clone of this instance.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classAbstractDialLayer
- Returns:
- The clone.
- Throws:
CloneNotSupportedException
- if some attribute of this instance cannot be cloned.
-
writeObject
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
IOException
- if there is an I/O error.
-
readObject
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
IOException
- if there is an I/O error.ClassNotFoundException
- if there is a classpath problem.
-