Package de.gsi.chart.axes.spi.format
Class DefaultFormatter
- java.lang.Object
-
- javafx.util.StringConverter<java.lang.Number>
-
- de.gsi.chart.axes.spi.format.AbstractFormatter
-
- de.gsi.chart.axes.spi.format.DefaultFormatter
-
- All Implemented Interfaces:
AxisLabelFormatter
public class DefaultFormatter extends AbstractFormatter
Default number formatter for NumberAxis, this stays in sync with auto-ranging and formats values appropriately. You can wrap this formatter to add prefixes or suffixes;
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_SMALL_AXISprotected NumberFormatterImplmyFormatterprotected intoldRangeIndexprotected intrangeIndex-
Fields inherited from class de.gsi.chart.axes.spi.format.AbstractFormatter
labelCache, localSchmidtTriggerThreshold, majorTickMarksCopy, rangeMax, rangeMin, schmittTriggerThreshold, unitScaling
-
-
Constructor Summary
Constructors Constructor Description DefaultFormatter()Construct a DefaultFormatter for the given NumberAxisDefaultFormatter(Axis axis)Construct a DefaultFormatter for the given NumberAxisDefaultFormatter(Axis axis, java.lang.String prefix, java.lang.String suffix)Construct a DefaultFormatter for the given NumberAxis with a prefix and/or suffix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.NumberfromString(java.lang.String string)Converts the string provided into a Number defined by the this converter.protected voidrangeUpdated()java.lang.StringtoString(java.lang.Number object)Converts the object provided into its string form.-
Methods inherited from class de.gsi.chart.axes.spi.format.AbstractFormatter
getLogRange, getRange, getTickUnitSupplier, schmittTriggerThresholdProperty, setTickUnitSupplier, tickUnitSupplierProperty, updateFormatter
-
-
-
-
Field Detail
-
DEFAULT_SMALL_AXIS
public static final int DEFAULT_SMALL_AXIS
- See Also:
- Constant Field Values
-
myFormatter
protected NumberFormatterImpl myFormatter
-
rangeIndex
protected int rangeIndex
-
oldRangeIndex
protected int oldRangeIndex
-
-
Constructor Detail
-
DefaultFormatter
public DefaultFormatter(Axis axis)
Construct a DefaultFormatter for the given NumberAxis- Parameters:
axis- The axis to format tick marks for
-
DefaultFormatter
public DefaultFormatter()
Construct a DefaultFormatter for the given NumberAxis
-
DefaultFormatter
public DefaultFormatter(Axis axis, java.lang.String prefix, java.lang.String suffix)
Construct a DefaultFormatter for the given NumberAxis with a prefix and/or suffix.- Parameters:
axis- The axis to format tick marks forprefix- The prefix to append to the start of formatted number, can be null if not neededsuffix- The suffix to append to the end of formatted number, can be null if not needed
-
-
Method Detail
-
rangeUpdated
protected void rangeUpdated()
- Specified by:
rangeUpdatedin classAbstractFormatter
-
toString
public java.lang.String toString(java.lang.Number object)
Converts the object provided into its string form. Format of the returned string is defined by this converter.- Specified by:
toStringin interfaceAxisLabelFormatter- Specified by:
toStringin classjavafx.util.StringConverter<java.lang.Number>- Parameters:
object- the number to be converted- Returns:
- a string representation of the object passed in.
- See Also:
StringConverter.toString(T)
-
fromString
public java.lang.Number fromString(java.lang.String string)
Converts the string provided into a Number defined by the this converter. Format of the string and type of the resulting object is defined by this converter.- Specified by:
fromStringin interfaceAxisLabelFormatter- Specified by:
fromStringin classjavafx.util.StringConverter<java.lang.Number>- Parameters:
string- the string to be converted back into a number- Returns:
- a Number representation of the string passed in.
- See Also:
StringConverter.toString(T)
-
-