public class AxisTics
extends java.lang.Object
Axes tics can be constructed in two ways, by specifying either (1) the interval between major tics or (2) the maximum number of major tics.
In the first case, when the major tic interval (a positive number) is specified, other tic parameters are easily computed. For example, the value of the first major tic equals the smallest multiple of the major tic interval that is not less than the minimum of the axis endpoint values. Likewise, the number of major tics is computed so that the value of the last major tic is not greater than the maximum of the axis endpoint values.
In the second case, when the maximum number of major tics is specified, the major tic interval is computed to be 2, 5, or 10 times some power of 10. Then, other tic parameters are computed as in the first case. The tricky part in this second case is choosing the best number from the set {2,5,10}. That best number is called the tic multiple, and is computed so that the number of major tics is close to, but not greater than, the specified maximum number of major tics.
After construction, the counts, increments, and first values of both major and minor tics are available.
Constructor and Description |
---|
AxisTics(double x1,
double x2,
double dtic)
Constructs axis tics for a specified major tic interval.
|
AxisTics(double x1,
double x2,
int ntic)
Constructs axis tics for a specified maximum number of major tics.
|
Modifier and Type | Method and Description |
---|---|
int |
getCountMajor()
Gets the number of major tics.
|
int |
getCountMinor()
Gets the number of minor tics.
|
double |
getDeltaMajor()
Gets major tic interval.
|
double |
getDeltaMinor()
Gets minor tic interval.
|
double |
getFirstMajor()
Gets the value of the first major tic.
|
double |
getFirstMinor()
Gets the value of the first minor tic.
|
int |
getMultiple()
Gets the tic multiple.
|
public AxisTics(double x1, double x2, double dtic)
x1
- the value at one end of the axis.x2
- the value at the other end of the axis.dtic
- the major tic interval; a positive number.public AxisTics(double x1, double x2, int ntic)
x1
- the value at one end of the axis.x2
- the value at the other end of the axis.ntic
- the maximum number of major tics.public int getCountMajor()
public double getDeltaMajor()
public double getFirstMajor()
public int getCountMinor()
public double getDeltaMinor()
public double getFirstMinor()
public int getMultiple()