Class ValueFormatter
- java.lang.Object
-
- org.eclipse.birt.chart.computation.ValueFormatter
-
public final class ValueFormatter extends java.lang.ObjectThis class handles the formatting work of any data value.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDECIMAL_FORMAT_PATTERN
-
Constructor Summary
Constructors Constructor Description ValueFormatter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringformat(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.StringgetNumericPattern(double dValue)Returns an auto computed decimal format pattern for category data or axis label.static java.lang.StringgetNumericPattern(java.lang.Number num)Returns an auto computed number pattern.static java.lang.NumbernormalizeDouble(java.lang.Double value)Normalize double value to avoid error precision.static java.lang.NumbernormalizeDouble(java.lang.Double dValue, java.lang.String pattern)static FormatSpecifierresetFormatSpecifier(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.
-
-
-
Field Detail
-
DECIMAL_FORMAT_PATTERN
public static final java.lang.String DECIMAL_FORMAT_PATTERN
- See Also:
- Constant Field Values
-
-
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 ChartExceptionReturns 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)
-
-