com.jinsight.jetchart
Class Scale

java.lang.Object
  |
  +--com.jinsight.jetchart.Scale

public class Scale
extends java.lang.Object

This class implements the properties and methods of a chart scale. A scale has no public constructor, and can only be accessed through 'get' methods implemented in classes ScatterGraph and GraphSet.

See Also:
ScatterGraph, GraphSet

Field Summary
static int BOTTOM
          Constant used to place scale along the bottom of the chart.
static int INNER_LEFT
          Constant used to place scale along the inner side of the left axis of vertical charts.
static int INNER_LEFT_RIGHT
          Constant used to place scale along the inner sides of both left and right axis of vertical charts.
static int INNER_RIGHT
          Constant used to place scale along the inner side of the right axis of vertical charts.
static int LEFT
          Constant used to place scale along the left axis of vertical charts.
static int LEFT_RIGHT
          Constant used to place scale along both left and right axis of vertical charts.
static int RIGHT
          Constant used to place scale along the right axis of vertical charts.
static int TOP_BOTTOM
          Constant used to place scale along the top and bottom of the chart.
 
Method Summary
protected  void finalize()
           
 void setAutoScaleEnabled(boolean isAutoScaleEnabled)
          Enables/disables automatic scale.
 void setColor(java.awt.Color color)
          Sets the scale color.
 void setEndPoint(float endPoint)
          Sets scale end point.
 void setFont(java.awt.Font font)
          Sets the scale font.
 void setIncrement(double increment)
          Sets the scale increment.
 void setLabels(java.lang.String[] labels)
          Sets the scale labels to be displayed, replacing the scale values, which are automatically calculated.
 void setLabelsEnabled(boolean isLabelsEnabled)
          Enables/disables display of scale labels.
 void setLogBase(int logBase)
          Sets the logarithmic scale base.
 void setLogEnabled(boolean isLogEnabled)
          Enables/disables a logarithmic scale.
 void setLogIncrementEnabled(boolean isLogIncrementEnabled)
          Enables/disables display of logarithmic values on a logarithmic scale.
 void setMarksColor(java.awt.Color marksColor)
          Sets the color of the scale marks.
 void setMarksEnabled(boolean isMarksEnabled)
          Enables/disables display of scale marks.
 void setMaxValue(double maxValue)
          Sets the scale maximum value.
 void setMinValue(double minValue)
          Sets the scale minimum value.
 void setPosition(int position)
          Sets scale position.
 void setStartPoint(float startPoint)
          Sets a scale starting point.
 void setValueFormat(java.lang.String valueFormat)
          Sets the format of values displayed along the scale.
 void setValuesEnabled(boolean isValuesEnabled)
          Deprecated.  
 void setVisibleLabelsIndexes(int[] visibleLabelsIndexes)
          Sets the indexes of the only scale labels to be displayed.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Constant used to place scale along the left axis of vertical charts.

RIGHT

public static final int RIGHT
Constant used to place scale along the right axis of vertical charts.

LEFT_RIGHT

public static final int LEFT_RIGHT
Constant used to place scale along both left and right axis of vertical charts.

INNER_LEFT

public static final int INNER_LEFT
Constant used to place scale along the inner side of the left axis of vertical charts.

INNER_RIGHT

public static final int INNER_RIGHT
Constant used to place scale along the inner side of the right axis of vertical charts.

INNER_LEFT_RIGHT

public static final int INNER_LEFT_RIGHT
Constant used to place scale along the inner sides of both left and right axis of vertical charts.

BOTTOM

public static final int BOTTOM
Constant used to place scale along the bottom of the chart. Only has effect with scatter charts.

TOP_BOTTOM

public static final int TOP_BOTTOM
Constant used to place scale along the top and bottom of the chart. Only has effect with scatter charts.
Method Detail

setLogEnabled

public void setLogEnabled(boolean isLogEnabled)
Enables/disables a logarithmic scale. A logarithmic scale increment is based on multiplication rather than addition, as in a linear scale. It allows examination of values that span many orders of magnitude, and has application in various fields, like astronomy, sound level analysis, stock market analysis, and others.
A logarithmic scale increases exponentially, by raising the log base value sequentially, starting with exponent 0. For example, a logarithmic scale of base 10 is increased as follows:
1,10,100,1000,10000, and so on.
If the automatic scale flag is enabled, this method is ignored and a linear scale is displayed instead. A logarithmic scale is always manual and does not support negative values.
Parameters:
isLogEnabled - A boolean value(true/false).
See Also:
setLogBase(int), setLogIncrementEnabled(boolean), setAutoScaleEnabled(boolean)

setLogBase

public void setLogBase(int logBase)
Sets the logarithmic scale base. The base number is used to set the magnitude of a logarithmic scale. It is sequentially raised to exponents that usually start at 0 and increase linearly, until the result found reaches a value delimited by the maximum scale number. For example, the numbers below is a logarithmic sequence of base 10 raised to exponents ranging from 0 to 4: 1,10,100,1000,10000.
The logarithmic scale base is 10, by default. It must always be a positive number greater than 1, otherwise it defaults to 10.
Parameters:
logBase - An integer number.
See Also:
setLogEnabled(boolean), setLogIncrementEnabled(boolean), setMaxValue(double), setMinValue(double), setIncrement(double)

setLogIncrementEnabled

public void setLogIncrementEnabled(boolean isLogIncrementEnabled)
Enables/disables display of logarithmic values on a logarithmic scale. If enabled, scale values are sequentially calculated raising the log base to exponents that usually start at 0 and increase linearly. Valid values are those found to be within the range delimited by the minimum and maximum scale values. If log increment is enabled, the distance between ticks is constant. If disabled, the distance decreases in a logarithmic rate. Logarithmic increment is enabled by default.
Parameters:
isLogIncrementEnabled - A boolean value(true/false).
See Also:
setLogEnabled(boolean), setLogBase(int), setMaxValue(double), setMinValue(double), setIncrement(double)

setStartPoint

public void setStartPoint(float startPoint)
Sets a scale starting point. The starting point is a fraction of the vertical axis extension, ranging from 0 to 1. For instance, if the starting point is set to 0.5 , the scale starts at the middle point of the vertical axis. The starting point value must not be greater than the end point.
Parameters:
startPoint - A float number ranging from 0 to 1.
See Also:
setEndPoint(float)

setEndPoint

public void setEndPoint(float endPoint)
Sets scale end point. The end point is a fraction of the vertical axis extension, ranging from 0 to 1. For instance, if the end point is set to 0.5, the scale ends at the middle point of the vertical axis. The end point value must not be smaller than the starting point.
Parameters:
startPoint - A float number ranging from 0 to 1.
See Also:
setStartPoint(float)

setLabels

public void setLabels(java.lang.String[] labels)
Sets the scale labels to be displayed, replacing the scale values, which are automatically calculated. The labels are passed as an array of strings, and they are placed from top to bottom or from left to right, in vertical and horizontal charts, respectively.
Parameters:
labels - An array of strings.

setVisibleLabelsIndexes

public void setVisibleLabelsIndexes(int[] visibleLabelsIndexes)
Sets the indexes of the only scale labels to be displayed. The indexes range from 0 to the maximum number of labels displayed minus 1. If chart is vertical the labels indexes increase from top to bottom, and if chart is horizontal, from left to right.
Parameters:
visibleLabelsIndexes - An array of integer numbers.

setPosition

public void setPosition(int position)
Sets scale position.
Parameters:
position - One of the constants used to set scale position.
See Also:
LEFT, RIGHT, LEFT_RIGHT, INNER_LEFT, INNER_RIGHT, INNER_LEFT_RIGHT, BOTTOM, TOP_BOTTOM

setAutoScaleEnabled

public void setAutoScaleEnabled(boolean isAutoScaleEnabled)
Enables/disables automatic scale. If disabled, the maximum, minimum and increment values can be set manually.
Parameters:
isAutoScaleEnabled - A boolean value(true/false).
See Also:
setMaxValue(double), setMinValue(double), setIncrement(double)

setMaxValue

public void setMaxValue(double maxValue)
Sets the scale maximum value. Has no effect if automatic scale is enabled or if maximum value is smaller than the largest value of all series.
Parameters:
maxValue - A double precision number.
See Also:
setAutoScaleEnabled(boolean)

setMinValue

public void setMinValue(double minValue)
Sets the scale minimum value. Has no effect if automatic scale is enabled or if the minimum value is larger than the smallest value of all series. If a scale is logarithmic and the minimum value is set to a number smaller than 1, the minimum value is automatically set to 1, which is the smallest number supported by logarithmic scales.
Parameters:
minValue - A double precision number.
See Also:
setAutoScaleEnabled(boolean)

setIncrement

public void setIncrement(double increment)
Sets the scale increment. Has no effect if automatic scale is enabled. By default, the scale increment is 1.
Parameters:
increment - A double precision number.
See Also:
setAutoScaleEnabled(boolean)

setValueFormat

public void setValueFormat(java.lang.String valueFormat)
Sets the format of values displayed along the scale. If a value format is informed, a NumberFormat object is created and, if possible, cast to a DecimalFormat instance. Then all values are formatted, provided that the 'valueFormat' parameter is a valid DecimalFormat pattern. By default, the value format is "#0.00".
Parameters:
valueFormat - String pattern to format values.

setFont

public void setFont(java.awt.Font font)
Sets the scale font.
Parameters:
font - A Font object.

setColor

public void setColor(java.awt.Color color)
Sets the scale color.
Parameters:
color - A Color object.

setMarksColor

public void setMarksColor(java.awt.Color marksColor)
Sets the color of the scale marks.
Parameters:
marksColor - A Color object.

setLabelsEnabled

public void setLabelsEnabled(boolean isLabelsEnabled)
Enables/disables display of scale labels.
Parameters:
isLabelsEnabled - A boolean value(true/false).

setValuesEnabled

public void setValuesEnabled(boolean isValuesEnabled)
Deprecated.  

This method has been deprecated. Use setLabelsEnabled instead.
See Also:
setLabelsEnabled(boolean)

setMarksEnabled

public void setMarksEnabled(boolean isMarksEnabled)
Enables/disables display of scale marks.
Parameters:
isMarksEnabled - A boolean value(true/false).

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object