Package org.jfree.chart.axis
Class TickUnits
java.lang.Object
org.jfree.chart.axis.TickUnits
- All Implemented Interfaces:
Serializable
,Cloneable
,TickUnitSource
public class TickUnits extends Object implements TickUnitSource, Cloneable, Serializable
A collection of tick units.
Used by the DateAxis
and NumberAxis
classes.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description TickUnits()
Constructs a new collection of tick units. -
Method Summary
Modifier and Type Method Description void
add(TickUnit unit)
Adds a tick unit to the collection.Object
clone()
Returns a clone of the collection.static TickUnitSource
createIntegerTickUnits()
Deprecated.this method has been moved to the NumberAxis class.static TickUnitSource
createIntegerTickUnits(Locale locale)
Deprecated.this method has been moved to the NumberAxis class.static TickUnitSource
createStandardTickUnits()
Deprecated.this method has been moved to the NumberAxis class.static TickUnitSource
createStandardTickUnits(Locale locale)
Deprecated.this method has been moved to the NumberAxis class.boolean
equals(Object object)
Tests an object for equality with this instance.TickUnit
get(int pos)
Returns the tickunit on the given position.TickUnit
getCeilingTickUnit(double size)
Returns the tick unit in the collection that is greater than or equal to the specified size.TickUnit
getCeilingTickUnit(TickUnit unit)
Returns the tick unit in the collection that is greater than or equal to (in size) the specified unit.static DecimalFormat
getDecimalFormat(String pattern)
TickUnit
getLargerTickUnit(TickUnit unit)
Returns a tick unit that is larger than the supplied unit.int
size()
Returns the number of tick units in this collection.static String
stringReplace(String s, String find, String replace)
Replace occurrences of a substring.
-
Constructor Details
-
TickUnits
public TickUnits()Constructs a new collection of tick units.
-
-
Method Details
-
add
Adds a tick unit to the collection.The tick units are maintained in ascending order.
- Parameters:
unit
- the tick unit to add.
-
size
public int size()Returns the number of tick units in this collection.This method is required for the XML writer.
- Returns:
- the number of units in this collection
-
get
Returns the tickunit on the given position.This method is required for the XML writer.
- Parameters:
pos
- the position in the list.- Returns:
- the tickunit.
-
getLargerTickUnit
Returns a tick unit that is larger than the supplied unit.- Specified by:
getLargerTickUnit
in interfaceTickUnitSource
- Parameters:
unit
- the unit.- Returns:
- a tick unit that is larger than the supplied unit.
-
getCeilingTickUnit
Returns the tick unit in the collection that is greater than or equal to (in size) the specified unit.- Specified by:
getCeilingTickUnit
in interfaceTickUnitSource
- Parameters:
unit
- the unit.- Returns:
- a unit from the collection.
-
getCeilingTickUnit
Returns the tick unit in the collection that is greater than or equal to the specified size.- Specified by:
getCeilingTickUnit
in interfaceTickUnitSource
- Parameters:
size
- the size.- Returns:
- a unit from the collection.
-
createStandardTickUnits
Deprecated.this method has been moved to the NumberAxis class.Creates the standard tick units.If you don't like these defaults, create your own instance of TickUnits and then pass it to the setStandardTickUnits(...) method in the NumberAxis class.
- Returns:
- the standard tick units.
-
createIntegerTickUnits
Deprecated.this method has been moved to the NumberAxis class.Returns a collection of tick units for integer values.- Returns:
- a collection of tick units for integer values.
-
stringReplace
Replace occurrences of a substring. http://ostermiller.org/utils/StringHelper.html StringHelper.replace("1-2-3", "-", "|");
result: "1|2|3"
StringHelper.replace("-1--2-", "-", "|");
result: "|1||2|"
StringHelper.replace("123", "", "|");
result: "123"
StringHelper.replace("1-2---3----4", "--", "|");
result: "1-2|-3||4"
StringHelper.replace("1-2---3----4", "--", "---");
result: "1-2----3------4"- Parameters:
s
- String to be modified.find
- String to find.replace
- String to replace.- Returns:
- a string with all the occurrences of the string to find replaced.
- Throws:
NullPointerException
- if s is null.
-
getDecimalFormat
-
createStandardTickUnits
Deprecated.this method has been moved to the NumberAxis class.Creates the standard tick units, and uses a given Locale to create the DecimalFormatsIf you don't like these defaults, create your own instance of TickUnits and then pass it to the setStandardTickUnits(...) method in the NumberAxis class.
- Parameters:
locale
- the locale to use to represent Numbers.- Returns:
- the standard tick units.
-
createIntegerTickUnits
Deprecated.this method has been moved to the NumberAxis class.Returns a collection of tick units for integer values. Uses a given Locale to create the DecimalFormats.- Parameters:
locale
- the locale to use to represent Numbers.- Returns:
- a collection of tick units for integer values.
-
clone
Returns a clone of the collection.- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if an item in the collection does not support cloning.
-
equals
Tests an object for equality with this instance.
-