Class ValueFormatter


  • public final class ValueFormatter
    extends java.lang.Object
    This class handles the formatting work of any data value.
    • Constructor Summary

      Constructors 
      Constructor Description
      ValueFormatter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String format​(java.lang.Object oValue, FormatSpecifier formatSpecifier, com.ibm.icu.util.ULocale lcl, java.lang.Object oCachedJavaFormatter)
      Returns the formatted string representation of given object.
      static java.lang.String getNumericPattern​(double dValue)
      Returns an auto computed decimal format pattern for category data or axis label.
      static java.lang.String getNumericPattern​(java.lang.Number num)
      Returns an auto computed number pattern.
      static java.lang.Number normalizeDouble​(java.lang.Double value)
      Normalize double value to avoid error precision.
      static java.lang.Number normalizeDouble​(java.lang.Double dValue, java.lang.String pattern)  
      static FormatSpecifier resetFormatSpecifier​(java.lang.Object oValue, FormatSpecifier fs)
      Under some cases, the specified format specifier is not suitable for current value, the format specifier must be reset to fit current value.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DECIMAL_FORMAT_PATTERN

        public static final java.lang.String DECIMAL_FORMAT_PATTERN
        See Also:
        Constant Field Values
    • Constructor Detail

      • ValueFormatter

        public ValueFormatter()
    • Method Detail

      • format

        public static java.lang.String format​(java.lang.Object oValue,
                                              FormatSpecifier formatSpecifier,
                                              com.ibm.icu.util.ULocale lcl,
                                              java.lang.Object oCachedJavaFormatter)
                                       throws ChartException
        Returns the formatted string representation of given object.
        Parameters:
        oValue -
        formatSpecifier -
        lcl -
        Returns:
        formatted string
        Throws:
        ChartException
      • resetFormatSpecifier

        public static FormatSpecifier resetFormatSpecifier​(java.lang.Object oValue,
                                                           FormatSpecifier fs)
        Under some cases, the specified format specifier is not suitable for current value, the format specifier must be reset to fit current value.
        Parameters:
        oValue -
        fs -
        Returns:
        format specifier.
      • getNumericPattern

        public static java.lang.String getNumericPattern​(java.lang.Number num)
        Returns an auto computed number pattern.
        Parameters:
        num - number value
        Returns:
        number pattern
        Since:
        2.5.3
      • getNumericPattern

        public static java.lang.String getNumericPattern​(double dValue)
        Returns an auto computed decimal format pattern for category data or axis label. If it's an integer, no decimal point and no separator. This is also used for representing logarithmic values.
        Returns:
        numeric pattern
      • normalizeDouble

        public static java.lang.Number normalizeDouble​(java.lang.Double value)
        Normalize double value to avoid error precision.
        Parameters:
        value -
        Returns:
        normalized value of specified double.
      • normalizeDouble

        public static java.lang.Number normalizeDouble​(java.lang.Double dValue,
                                                       java.lang.String pattern)