Class 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 Detail

      • rangeIndex

        protected int rangeIndex
      • oldRangeIndex

        protected int oldRangeIndex
    • Constructor Detail

      • DefaultFormatter

        public DefaultFormatter()
        Construct a DefaultFormatter for the given NumberAxis
      • DefaultFormatter

        public DefaultFormatter​(Axis axis)
        Construct a DefaultFormatter for the given NumberAxis
        Parameters:
        axis - The axis to format tick marks for
      • 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 for
        prefix - The prefix to append to the start of formatted number, can be null if not needed
        suffix - The suffix to append to the end of formatted number, can be null if not needed
    • Method Detail

      • 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:
        fromString in interface AxisLabelFormatter
        Specified by:
        fromString in class javafx.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)
      • 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:
        toString in interface AxisLabelFormatter
        Specified by:
        toString in class javafx.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)