Package org.jfree.chart.plot.dial
Class StandardDialScale
java.lang.Object
org.jfree.chart.plot.dial.AbstractDialLayer
org.jfree.chart.plot.dial.StandardDialScale
- All Implemented Interfaces:
Serializable,Cloneable,DialLayer,DialScale,PublicCloneable
public class StandardDialScale
extends AbstractDialLayer
implements DialScale, Cloneable, PublicCloneable, Serializable
A scale for a
DialPlot.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of DialScale.StandardDialScale(double lowerBound, double upperBound, double startAngle, double extent, double majorTickIncrement, int minorTickCount) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptiondoubleangleToValue(double angle) Converts the given angle to a data value, based on this scale.clone()Returns a clone of this instance.voiddraw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) Draws the scale on the dial plot.booleanTests thisStandardDialScalefor equality with an arbitrary object.doubleReturns the extent.booleanReturns a flag that controls whether or not the first tick label is visible.doubleReturns the lower bound for the scale.doubleReturns the increment (in data units) between major tick labels.doubleReturns the length factor for the major tick marks.Returns the major tick paint.Returns the stroke used to draw the major tick marks.intReturns the number of minor tick marks between major tick marks.doubleReturns the length factor for the minor tick marks.Returns the paint used to draw the minor tick marks.Returns the stroke used to draw the minor tick marks.doubleReturns the start angle for the scale (in degrees using the same orientation as Java'sArc2Dclass).Returns the font used to draw the tick labels.Returns the number formatter used to convert the tick label values to strings.doubleReturns the tick label offset.Returns the paint used to draw the tick labels.booleanReturnstrueif the tick labels should be displayed, andfalseotherwise.doubleReturns the radius (as a percentage of the maximum space available) of the outer limit of the tick marks.doubleReturns the upper bound for the scale.inthashCode()Returns a hash code for this instance.booleanReturnstrueto indicate that this layer should be clipped within the dial window.voidsetExtent(double extent) Sets the extent and sends aDialLayerChangeEventto all registered listeners.voidsetFirstTickLabelVisible(boolean visible) Sets a flag that controls whether or not the first tick label is visible, and sends aDialLayerChangeEventto all registered listeners.voidsetLowerBound(double lower) Sets the lower bound for the scale and sends aDialLayerChangeEventto all registered listeners.voidsetMajorTickIncrement(double increment) Sets the increment (in data units) between major tick labels and sends aDialLayerChangeEventto all registered listeners.voidsetMajorTickLength(double length) Sets the length factor for the major tick marks and sends aDialLayerChangeEventto all registered listeners.voidsetMajorTickPaint(Paint paint) Sets the major tick paint and sends aDialLayerChangeEventto all registered listeners.voidsetMajorTickStroke(Stroke stroke) Sets the stroke used to draw the major tick marks and sends aDialLayerChangeEventto all registered listeners.voidsetMinorTickCount(int count) Sets the number of minor tick marks between major tick marks and sends aDialLayerChangeEventto all registered listeners.voidsetMinorTickLength(double length) Sets the length factor for the minor tick marks and sends aDialLayerChangeEventto all registered listeners.voidsetMinorTickPaint(Paint paint) Sets the paint used to draw the minor tick marks and sends aDialLayerChangeEventto all registered listeners.voidsetMinorTickStroke(Stroke stroke) Sets the stroke used to draw the minor tick marks and sends aDialLayerChangeEventto all registered listeners.voidsetStartAngle(double angle) Sets the start angle for the scale and sends aDialLayerChangeEventto all registered listeners.voidsetTickLabelFont(Font font) Sets the font used to display the tick labels and sends aDialLayerChangeEventto all registered listeners.voidsetTickLabelFormatter(NumberFormat formatter) Sets the number formatter used to convert the tick label values to strings, and sends aDialLayerChangeEventto all registered listeners.voidsetTickLabelOffset(double offset) Sets the tick label offset and sends aDialLayerChangeEventto all registered listeners.voidsetTickLabelPaint(Paint paint) Sets the paint used to draw the tick labels and sends aDialLayerChangeEventto all registered listeners.voidsetTickLabelsVisible(boolean visible) Sets the flag that controls whether or not the tick labels are displayed, and sends aDialLayerChangeEventto all registered listeners.voidsetTickRadius(double radius) Sets the tick radius and sends aDialLayerChangeEventto all registered listeners.voidsetUpperBound(double upper) Sets the upper bound for the scale and sends aDialLayerChangeEventto all registered listeners.doublevalueToAngle(double value) Converts a data value to an angle against this scale.Methods inherited from class org.jfree.chart.plot.dial.AbstractDialLayer
addChangeListener, hasListener, isVisible, notifyListeners, removeChangeListener, setVisibleMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.chart.plot.dial.DialLayer
addChangeListener, hasListener, isVisible, removeChangeListener
-
Constructor Details
-
StandardDialScale
public StandardDialScale()Creates a new instance of DialScale. -
StandardDialScale
public StandardDialScale(double lowerBound, double upperBound, double startAngle, double extent, double majorTickIncrement, int minorTickCount) Creates a new instance.- Parameters:
lowerBound- the lower bound of the scale.upperBound- the upper bound of the scale.startAngle- the start angle (in degrees, using the same orientation as Java'sArc2Dclass).extent- the extent (in degrees, counter-clockwise).majorTickIncrement- the interval between major tick marks (must be > 0).minorTickCount- the number of minor ticks between major tick marks.
-
-
Method Details
-
getLowerBound
Returns the lower bound for the scale.- Returns:
- The lower bound for the scale.
- See Also:
-
setLowerBound
Sets the lower bound for the scale and sends aDialLayerChangeEventto all registered listeners.- Parameters:
lower- the lower bound.- See Also:
-
getUpperBound
Returns the upper bound for the scale.- Returns:
- The upper bound for the scale.
- See Also:
-
setUpperBound
Sets the upper bound for the scale and sends aDialLayerChangeEventto all registered listeners.- Parameters:
upper- the upper bound.- See Also:
-
getStartAngle
Returns the start angle for the scale (in degrees using the same orientation as Java'sArc2Dclass).- Returns:
- The start angle.
- See Also:
-
setStartAngle
Sets the start angle for the scale and sends aDialLayerChangeEventto all registered listeners.- Parameters:
angle- the angle (in degrees).- See Also:
-
getExtent
Returns the extent.- Returns:
- The extent.
- See Also:
-
setExtent
Sets the extent and sends aDialLayerChangeEventto all registered listeners.- Parameters:
extent- the extent.- See Also:
-
getTickRadius
Returns the radius (as a percentage of the maximum space available) of the outer limit of the tick marks.- Returns:
- The tick radius.
- See Also:
-
setTickRadius
Sets the tick radius and sends aDialLayerChangeEventto all registered listeners.- Parameters:
radius- the radius.- See Also:
-
getMajorTickIncrement
Returns the increment (in data units) between major tick labels.- Returns:
- The increment between major tick labels.
- See Also:
-
setMajorTickIncrement
Sets the increment (in data units) between major tick labels and sends aDialLayerChangeEventto all registered listeners.- Parameters:
increment- the increment (must be > 0).- See Also:
-
getMajorTickLength
Returns the length factor for the major tick marks. The value is subtracted from the tick radius to determine the inner starting point for the tick marks.- Returns:
- The length factor.
- See Also:
-
setMajorTickLength
Sets the length factor for the major tick marks and sends aDialLayerChangeEventto all registered listeners.- Parameters:
length- the length.- See Also:
-
getMajorTickPaint
Returns the major tick paint.- Returns:
- The major tick paint (never
null). - See Also:
-
setMajorTickPaint
Sets the major tick paint and sends aDialLayerChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
getMajorTickStroke
Returns the stroke used to draw the major tick marks.- Returns:
- The stroke (never
null). - See Also:
-
setMajorTickStroke
Sets the stroke used to draw the major tick marks and sends aDialLayerChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
-
getMinorTickCount
Returns the number of minor tick marks between major tick marks.- Returns:
- The number of minor tick marks between major tick marks.
- See Also:
-
setMinorTickCount
Sets the number of minor tick marks between major tick marks and sends aDialLayerChangeEventto all registered listeners.- Parameters:
count- the count.- See Also:
-
getMinorTickLength
Returns the length factor for the minor tick marks. The value is subtracted from the tick radius to determine the inner starting point for the tick marks.- Returns:
- The length factor.
- See Also:
-
setMinorTickLength
Sets the length factor for the minor tick marks and sends aDialLayerChangeEventto all registered listeners.- Parameters:
length- the length.- See Also:
-
getMinorTickPaint
Returns the paint used to draw the minor tick marks.- Returns:
- The paint (never
null). - See Also:
-
setMinorTickPaint
Sets the paint used to draw the minor tick marks and sends aDialLayerChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
getMinorTickStroke
Returns the stroke used to draw the minor tick marks.- Returns:
- The paint (never
null). - See Also:
-
setMinorTickStroke
Sets the stroke used to draw the minor tick marks and sends aDialLayerChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
-
getTickLabelOffset
Returns the tick label offset.- Returns:
- The tick label offset.
- See Also:
-
setTickLabelOffset
Sets the tick label offset and sends aDialLayerChangeEventto all registered listeners.- Parameters:
offset- the offset.- See Also:
-
getTickLabelFont
Returns the font used to draw the tick labels.- Returns:
- The font (never
null). - See Also:
-
setTickLabelFont
Sets the font used to display the tick labels and sends aDialLayerChangeEventto all registered listeners.- Parameters:
font- the font (nullnot permitted).- See Also:
-
getTickLabelPaint
Returns the paint used to draw the tick labels.- Returns:
- The paint (
nullnot permitted). - See Also:
-
setTickLabelPaint
Sets the paint used to draw the tick labels and sends aDialLayerChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).
-
getTickLabelsVisible
Returnstrueif the tick labels should be displayed, andfalseotherwise.- Returns:
- A boolean.
- See Also:
-
setTickLabelsVisible
Sets the flag that controls whether or not the tick labels are displayed, and sends aDialLayerChangeEventto all registered listeners.- Parameters:
visible- the new flag value.- See Also:
-
getTickLabelFormatter
Returns the number formatter used to convert the tick label values to strings.- Returns:
- The formatter (never
null). - See Also:
-
setTickLabelFormatter
Sets the number formatter used to convert the tick label values to strings, and sends aDialLayerChangeEventto all registered listeners.- Parameters:
formatter- the formatter (nullnot permitted).- See Also:
-
getFirstTickLabelVisible
Returns a flag that controls whether or not the first tick label is visible.- Returns:
- A boolean.
- See Also:
-
setFirstTickLabelVisible
Sets a flag that controls whether or not the first tick label is visible, and sends aDialLayerChangeEventto all registered listeners.- Parameters:
visible- the new flag value.- See Also:
-
isClippedToWindow
Returnstrueto indicate that this layer should be clipped within the dial window.- Specified by:
isClippedToWindowin interfaceDialLayer- Returns:
true.
-
draw
Draws the scale on the dial plot.- Specified by:
drawin interfaceDialLayer- Parameters:
g2- the graphics target (nullnot permitted).plot- the dial plot (nullnot permitted).frame- the reference frame that is used to construct the geometry of the plot (nullnot permitted).view- the visible part of the plot (nullnot permitted).
-
valueToAngle
Converts a data value to an angle against this scale.- Specified by:
valueToAnglein interfaceDialScale- Parameters:
value- the data value.- Returns:
- The angle (in degrees, using the same specification as Java's Arc2D class).
- See Also:
-
angleToValue
Converts the given angle to a data value, based on this scale.- Specified by:
angleToValuein interfaceDialScale- Parameters:
angle- the angle (in degrees).- Returns:
- The data value.
- See Also:
-
equals
Tests thisStandardDialScalefor equality with an arbitrary object.- Overrides:
equalsin classAbstractDialLayer- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
hashCode
Returns a hash code for this instance.- Overrides:
hashCodein classAbstractDialLayer- Returns:
- A hash code.
-
clone
Returns a clone of this instance.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractDialLayer- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if this instance is not cloneable.
-