Package org.eclipse.birt.chart.computation

# Class ValueFormatter

java.lang.Object
org.eclipse.birt.chart.computation.ValueFormatter

public final class ValueFormatter extends Object
This class handles the formatting work of any data value.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DECIMAL_FORMAT_PATTERN`

## Constructor Summary

Constructors
Constructor
Description
`ValueFormatter()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`format(Object oValue, FormatSpecifier formatSpecifier, com.ibm.icu.util.ULocale lcl, Object oCachedJavaFormatter)`
Returns the formatted string representation of given object.
`static String`
`getNumericPattern(double dValue)`
Returns an auto computed decimal format pattern for category data or axis label.
`static String`
`getNumericPattern(Number num)`
Returns an auto computed number pattern.
`static Number`
`normalizeDouble(Double value)`
Normalize double value to avoid error precision.
`static Number`
`normalizeDouble(Double dValue, String pattern)`
`static FormatSpecifier`
`resetFormatSpecifier(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 Details

### DECIMAL_FORMAT_PATTERN

public static final String DECIMAL_FORMAT_PATTERN

See Also:
  - Constant Field Values

## Constructor Details

### ValueFormatter

public ValueFormatter()

## Method Details

### format

public static String format(Object oValue, FormatSpecifier formatSpecifier, com.ibm.icu.util.ULocale lcl, 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(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 String getNumericPattern(Number num)
Returns an auto computed number pattern.

Parameters:
  `num` - number value
Returns:
  number pattern
Since:
  2.5.3

### getNumericPattern

public static 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 Number normalizeDouble(Double value)
Normalize double value to avoid error precision.

Parameters:
  `value` -
Returns:
  normalized value of specified double.

### normalizeDouble

public static Number normalizeDouble(Double dValue, String pattern)