com.jidesoft.chart.axis
Class IntegerTickCalculator
java.lang.Object
com.jidesoft.chart.axis.DefaultNumericTickCalculator
com.jidesoft.chart.axis.IntegerTickCalculator
- All Implemented Interfaces:
- NumericTickCalculator, TickCalculator<Double>
public class IntegerTickCalculator
- extends DefaultNumericTickCalculator
A tick calculator that generates ticks only at integer values along the axis range.
Method Summary |
Tick[] |
calculateTicks(Range<Double> r)
Works out where to place the tick markers. |
double |
getTolerance()
Returns the current error tolerance used when determining if a number is an integer |
void |
setTolerance(double tolerance)
Specify the tolerance to use for determining whether a number is an integer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IntegerTickCalculator
public IntegerTickCalculator()
getTolerance
public double getTolerance()
- Returns the current error tolerance used when determining if a number is an integer
- Returns:
- the current error tolerance
setTolerance
public void setTolerance(double tolerance)
- Specify the tolerance to use for determining whether a number is an integer.
Due to imprecise arithmetic there are bound to be some small errors that we need to take
account of when answering this question, so we allow for a small error tolerance, as
specified by this property.
For example, with a value of 0.01 for the tolerance the number 4.01 is deemed close enough to 4 to
be called an integer. In practice, we should be using smaller values than 0.01.
By default, the tolerance is set at 1×10-10.
- Parameters:
tolerance
- the tolerance to use when determining if a value is an integer
calculateTicks
public Tick[] calculateTicks(Range<Double> r)
- Works out where to place the tick markers.
- Specified by:
calculateTicks
in interface TickCalculator<Double>
- Overrides:
calculateTicks
in class DefaultNumericTickCalculator
- Returns:
- an array of tick values