/layer/themes/graduated

The layer theme module exports a method for graduated themes.

Methods

(inner) graduated(theme, feature)

The graduated theme method assigns the style of the category which matches a numeric feature field value according to the theme's graduated_breaks. A value outside the category range is assigned the nearest category by value: the lowest category for greater_than and the highest category for less_than.

Parameters:
NameTypeDescription
themeObject

The theme configuration object.

featureObject

The feature object.

Properties
NameTypeAttributesDescription
theme.fieldstring

The field name used for determining the category.

theme.categoriesArray

An array of category objects.

theme.graduated_breaksstring

The comparison operator ("less_than" or "greater_than").

feature.propertiesObject

The properties of the feature.

properties.featuresArray<optional>

An array of sub-features.