com.jinsight.jetchart
Class GaugeScale

java.lang.Object
  extended bycom.jinsight.jetchart.GaugeScale

public class GaugeScale
extends java.lang.Object

The numerical scale of a gauge chart is placed along the border of the gauge frame. It is comprised of major and minor ticks marks to help user identify the current value of a gauge series within a range varying from a minimum to a maximum value.
An unlimited number of GaugeScale objects can be added to the context of a gauge chart, each of them associated with different objects, as GaugeSerie and GaugeZone instances.
Objects not associated with any scales are automatically painted with respect to a primary scale kept by the GaugeGraph class.
By adjusting the start and end points of a gauge scale, it is possible to place scales sequentially along the border of the gauge frame, without overlapping. The direction a gauge scale is painted can also be changed modifying the start and end points values.

See Also:
GaugeGraph, GaugeFrame, GaugeSerie, GaugeZone, setStartPoint(double), setEndPoint(double)

Field Summary
static int INSIDE
          Constant used to set the position of scale labels and scale ticks to inside the gauge area.
static int OUTSIDE
          Constant used to set the position of scale labels and scale ticks to outside the gauge area.
 
Constructor Summary
GaugeScale()
          Creates a GaugeScale object.
GaugeScale(double minValue, double maxValue)
          Creates a GaugeScale object.
 
Method Summary
protected  void finalize()
           
 void setColor(java.awt.Color color)
          Sets the color of this GaugeScale labels.
 void setEndPoint(double endPoint)
          Sets the end point of a GaugeScale object, as a fraction of the gauge frame border.
 void setFont(java.awt.Font font)
          Sets the font of a GaugeScale labels.
 void setImage(java.awt.Image img, double value, double position)
          Sets an image to be associated with a gauge scale.
 void setLabels(java.lang.String[] labels)
          Sets the scale labels to be displayed, replacing the scale values, which are automatically calculated.
 void setLabelsGap(int labelsGap)
          Sets the gap between the scale labels and the tip of the major ticks.
 void setLabelsPosition(int labelsPosition)
          Sets the position where the scale labels are painted.
 void setMinorTicksColor(java.awt.Color minorTicksColor)
          Sets the color of the minor ticks.
 void setMinorTicksCount(int minorTicksCount)
          Sets the number of minor ticks.
 void setMinorTicksLength(int minorTicksLength)
          Sets the length of the minor ticks.
 void setRange(double minValue, double maxValue)
          Sets the range of a GaugeScale object.
 void setStartPoint(double startPoint)
          Sets the start point of a GaugeScale object, as a fraction of the gauge frame border.
 void setTicksColor(java.awt.Color ticksColor)
          Sets the color of the major ticks.
 void setTicksCount(int ticksCount)
          Sets the number of major ticks.
 void setTicksLength(int ticksLength)
          Sets the length of all major ticks.
 void setTicksPosition(int ticksPosition)
          Sets the position where the major and minor ticks are painted.
 void setValueFormat(java.lang.String valueFormat)
          Sets the format of a GaugeScale values.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSIDE

public static final int INSIDE
Constant used to set the position of scale labels and scale ticks to inside the gauge area.

See Also:
Constant Field Values

OUTSIDE

public static final int OUTSIDE
Constant used to set the position of scale labels and scale ticks to outside the gauge area.

See Also:
Constant Field Values
Constructor Detail

GaugeScale

public GaugeScale()
Creates a GaugeScale object. Default constructor.


GaugeScale

public GaugeScale(double minValue,
                  double maxValue)
Creates a GaugeScale object. The constructor takes the minimum and maximum scale values.

Parameters:
minValue - A double precision number.
maxValue - A double precision number.
See Also:
setRange(double, double)
Method Detail

setColor

public void setColor(java.awt.Color color)
Sets the color of this GaugeScale labels. Default color is Color.black.

Parameters:
color - A Color object.

setTicksColor

public void setTicksColor(java.awt.Color ticksColor)
Sets the color of the major ticks. The major ticks are those pointing to the scale labels. Default color is Color.black.

Parameters:
ticksColor - A Color object.

setTicksLength

public void setTicksLength(int ticksLength)
Sets the length of all major ticks. Default length is 10 pixels.

Parameters:
ticksLength - An integer value.

setMinorTicksColor

public void setMinorTicksColor(java.awt.Color minorTicksColor)
Sets the color of the minor ticks. The minor ticks are those placed between two consecutive major ticks.

Parameters:
minorTicksColor - A Color object.

setMinorTicksLength

public void setMinorTicksLength(int minorTicksLength)
Sets the length of the minor ticks. Default length is 5 pixels.

Parameters:
minorTicksLength - An integer value.

setRange

public void setRange(double minValue,
                     double maxValue)
Sets the range of a GaugeScale object.

Parameters:
minValue - A double precision number.
maxValue - A double precision number.

setLabelsGap

public void setLabelsGap(int labelsGap)
Sets the gap between the scale labels and the tip of the major ticks. Default gap is 5 pixels.

Parameters:
labelsGap - An integer value.

setTicksCount

public void setTicksCount(int ticksCount)
Sets the number of major ticks. Default value is 11. The smallest number allowed is 3. If a number smaller than 3 is informed the number of major ticks is automatically reset to the default value.

Parameters:
ticksCount - An integer value.

setMinorTicksCount

public void setMinorTicksCount(int minorTicksCount)
Sets the number of minor ticks. Default value is 0.

Parameters:
minorTicksCount - An integer value.

setFont

public void setFont(java.awt.Font font)
Sets the font of a GaugeScale labels. Default font is SansSerif,BOLD,10.

Parameters:
font - A Font object.

setImage

public void setImage(java.awt.Image img,
                     double value,
                     double position)
Sets an image to be associated with a gauge scale. This method takes a reference to the Image object, the scale value to determine the angle the image center makes with the horizontal gauge radius, and the image position as a fraction of the gauge radius.
For instance, if a scale ranges from 0 to 100, the value parameter is 10 and the position is .5, the image center is positioned at the middle of the radius that makes an angle corresponding to the value 10 within the scale range.

Parameters:
img - The Image object.
value - A double precision number.
position - A double precision number ranging from 0 to 1, corresponding to the center and the border of the gauge, respectively.

setValueFormat

public void setValueFormat(java.lang.String valueFormat)
Sets the format of a GaugeScale values. Default format is "###,###,##0.00". Please refer to the java.text.DecimalFormat for a list of available patterns.

Parameters:
valueFormat - A String object.

setStartPoint

public void setStartPoint(double startPoint)
Sets the start point of a GaugeScale object, as a fraction of the gauge frame border. A value of zero corresponds to the beginning of the border, whereas a value of 1 corresponds to the end. Any value between 0 and 1 shifts the start point. Default value is zero, the start point coincides with the beginning of the gauge frame border.

Parameters:
startPoint - A double precision number, ranging from 0 to 1.
See Also:
setEndPoint(double)

setEndPoint

public void setEndPoint(double endPoint)
Sets the end point of a GaugeScale object, as a fraction of the gauge frame border. A value of zero corresponds to the beginning of the border, whereas a value of 1 corresponds to the end. Any value between 0 and 1 shifts the end point. Default value is 1, the start point coincides with the end of the gauge frame border.

Parameters:
endPoint - A double precision number, ranging from 0 to 1.
See Also:
setStartPoint(double)

setTicksPosition

public void setTicksPosition(int ticksPosition)
Sets the position where the major and minor ticks are painted. The accepted values are GaugeScale.OUTSIDE and GaugeScale.INSIDE. The former moves the ticks to the outside of the gauge frame border, whereas the latter moves them to the inside.
Default position is GaugeScale.INSIDE.

Parameters:
ticksPosition - One of the constants used to set ticks position.
See Also:
INSIDE, OUTSIDE

setLabelsPosition

public void setLabelsPosition(int labelsPosition)
Sets the position where the scale labels are painted. The accepted values are GaugeScale.OUTSIDE and GaugeScale.INSIDE. The former moves the labels to the outside of the gauge frame border, whereas the latter moves them to the inside.
Default position is GaugeScale.INSIDE.

Parameters:
labelsPosition - One of the constants used to set labels position.
See Also:
INSIDE, OUTSIDE

setLabels

public void setLabels(java.lang.String[] labels)
Sets the scale labels to be displayed, replacing the scale values, which are automatically calculated.

Parameters:
labels - An array of strings.

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable