Package | com.esri.bacore |
Class | public class ValueFormatter |
Inheritance | ValueFormatter mx.formatters.NumberFormatter |
Implements | IValueFormatter |
See also
Property | Defined By | ||
---|---|---|---|
formatUnits : Function
A function providing units for a formatted value. | ValueFormatter | ||
removeUnits : Function
A function removing units from a formatted value. | ValueFormatter |
Method | Defined By | ||
---|---|---|---|
Initializes a new instance of the ValueFormatter class. | ValueFormatter | ||
formatValue(value:Number, decimals:int):String
Converts a numeric value to a string representation with the required number of digits after the decimal point. | ValueFormatter | ||
formatValueWithUnits(value:Number, decimals:int, valueType:BAValueType):String
Converts a numeric value to a string representation with the required number of digits after the decimal point
provided with units if necessary. | ValueFormatter | ||
parse(formattedValue:String):Number
Converts a formatted value to a numeric value. | ValueFormatter |
formatUnits | property |
formatUnits:Function
A function providing units for a formatted value.
The signature of this function is the following:
formatUnits(formattedValue:String, valueType:BAValueType):String;
It can add units to a formatted value and return the resulting string. For example, if the
valueType
is BAValueType.PERCENTAGE
, this function can append the percent sign
to the input formattedValue
. If units are missing for the given value type, the function should
return the input formattedValue
.
If this function is null, units are not added to a value formatted with the
FormatValueWithUnits
method.
public function get formatUnits():Function
public function set formatUnits(value:Function):void
removeUnits | property |
removeUnits:Function
Since : | Community Analyst API for Flex 2.2. |
A function removing units from a formatted value.
The signature of this function is the following:
removeUnits(formattedValueWithUnits:String):String;
It should test the formattedValueWithUnits
parameter to contain units and
return the value without units.
public function get removeUnits():Function
public function set removeUnits(value:Function):void
ValueFormatter | () | Constructor |
public function ValueFormatter()
Initializes a new instance of the ValueFormatter class.
formatValue | () | method |
public function formatValue(value:Number, decimals:int):String
Converts a numeric value to a string representation with the required number of digits after the decimal point.
The base version formats a value using the format
method of the base class
with specified decimals
as a precision value.
Parameters
value:Number — A numeric value to be converted.
| |
decimals:int — The number of significant digits after the decimal point.
Negative value means unknown number of digits.
|
String |
formatValueWithUnits | () | method |
public function formatValueWithUnits(value:Number, decimals:int, valueType:BAValueType):String
Converts a numeric value to a string representation with the required number of digits after the decimal point provided with units if necessary.
The base version formats the value using the FormatValue
method and after that adds units
if necessary using the FormatUnits
function associated with this formatter.
Parameters
value:Number — A numeric value to be converted.
| |
decimals:int — The number of significant digits after the decimal point.
Negative value means unknown number of digits.
| |
valueType:BAValueType — Type of value.
|
String |
parse | () | method |
public function parse(formattedValue:String):Number
Since : | Community Analyst API for Flex 2.2. |
Converts a formatted value to a numeric value.
The formatted value can contain units which will be removed if the removeUnits
function is specified. After that the numeric value is parsed and the result is returned.
If the value cannot be parsed, NaN is returned.
Parameters
formattedValue:String — String containing a formatted value.
|
Number — Numeric value or NaN.
|