Class: Formatter

OM.style. Formatter


new Formatter(options)

Creates a new style Formatter.

Parameters:
Name Type Description
options object

The options parameter is a JSON object containing several optional
properties, such as:


  • scale the bucketing algorithm used to format or classify data values.
    If not specified the default logarithm scale is used.
  • numClasses the number of buckets or classes to use during formatting.
  • style the original style that this Formatter is affecting. Optional.

Methods


getNumClasses()

Gets the desired classes or buckets for dividing the data item values.


getScale()

gets the scale (such as linear or logarithmic) used to classify data item
values.


getStyle()

Gets the original style for which this Formatter might be affecting one
of its visual attributes.


resolve(itemValue, column, feature)

The main function of a Formatter. It computes and returns a style attribute
value based on the specified data item value and the set of all possible
data item values (captured as a Column).

Parameters:
Name Type Description
itemValue object

the value of a specific data item, against
which the optimal style attribute value (such as fill color or marker size)
is determined.

column object

the OM.Column instance that contains the set of
all possible data items. itemValue is the value of one of the data items
from the column.

feature object

the feature object being resolved.

Returns:

the determined style attribute value

Type
object