JIDE 3.5.15

com.jidesoft.chart.axis
Class DefaultNumericTickCalculator

java.lang.Object
  extended by com.jidesoft.chart.axis.DefaultNumericTickCalculator
All Implemented Interfaces:
NumericTickCalculator, TickCalculator<Double>
Direct Known Subclasses:
IntegerTickCalculator

public class DefaultNumericTickCalculator
extends Object
implements NumericTickCalculator

A default implementation of a tick calculator for numeric values.


Field Summary
static String PROPERTY_NUMBER_FORMAT
           
static String PROPERTY_TICK_INTERVALS_BETWEEN_MAJORS
           
 
Constructor Summary
DefaultNumericTickCalculator()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Register an object's interest in property changes on this object
 Tick[] calculateTicks(Range<Double> r)
          Works out where to place the tick markers
 int getMinorTickIntervalBetweenMajors()
          Returns the number of intervals between major ticks.
 NumberFormat getNumberFormat()
          Returns the number format used for generating tick labels
 void removePropertyChangeListener(PropertyChangeListener listener)
          De-register an object's interest in property changes on this object
 void setMinorTickIntervalBetweenMajors(int minorTickIntervalBetweenMajors)
          Set the number of ticks between major ticks by specifying the number of intervals.
 void setNumberFormat(NumberFormat numberFormat)
          By default the number format used for generating the ticks uses a maximum of 2 digits for the fractional part.
 void setNumberFormat(String numberFormat)
          The string to use for the number format is as used in the applyPattern method of DecimalFormat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_NUMBER_FORMAT

public static final String PROPERTY_NUMBER_FORMAT
See Also:
Constant Field Values

PROPERTY_TICK_INTERVALS_BETWEEN_MAJORS

public static final String PROPERTY_TICK_INTERVALS_BETWEEN_MAJORS
See Also:
Constant Field Values
Constructor Detail

DefaultNumericTickCalculator

public DefaultNumericTickCalculator()
Method Detail

getMinorTickIntervalBetweenMajors

public int getMinorTickIntervalBetweenMajors()
Returns the number of intervals between major ticks. The number of intervals is one more than the number of minor ticks, as the end intervals are delimited by major ticks.

Returns:
the number of intervals between major ticks

setMinorTickIntervalBetweenMajors

public void setMinorTickIntervalBetweenMajors(int minorTickIntervalBetweenMajors)
Set the number of ticks between major ticks by specifying the number of intervals. For example if you want 5 subdivisions between major ticks then you specify 5 as the parameter to this method. This means that you actually get 4 minor ticks between the major ticks.

Parameters:
minorTickIntervalBetweenMajors - specify the number of intervals between major ticks

getNumberFormat

public NumberFormat getNumberFormat()
Returns the number format used for generating tick labels

Specified by:
getNumberFormat in interface NumericTickCalculator
Returns:
the number format used for generating tick labels

setNumberFormat

public void setNumberFormat(NumberFormat numberFormat)
By default the number format used for generating the ticks uses a maximum of 2 digits for the fractional part.

Specified by:
setNumberFormat in interface NumericTickCalculator
Parameters:
numberFormat - the new number format object

setNumberFormat

public void setNumberFormat(String numberFormat)
The string to use for the number format is as used in the applyPattern method of DecimalFormat.

Specified by:
setNumberFormat in interface NumericTickCalculator
Parameters:
numberFormat - the number format to use

calculateTicks

public Tick[] calculateTicks(Range<Double> r)
Works out where to place the tick markers

Specified by:
calculateTicks in interface TickCalculator<Double>
Returns:
an array of tick values

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Register an object's interest in property changes on this object

Specified by:
addPropertyChangeListener in interface TickCalculator<Double>
Parameters:
listener - the interested object that will be notified when a change occurs

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
De-register an object's interest in property changes on this object

Specified by:
removePropertyChangeListener in interface TickCalculator<Double>
Parameters:
listener - the object that will no longer be notified of changes

JIDE 3.5.15