Constructor
new AttributeGroupHandler(matchRules)
Creates an attribute group handler that will generate stylistic attribute values such as colors or shapes based on data set categories.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
matchRules |
Object |
<optional> |
A map of key value pairs for categories and the matching attribute value e.g. {"soda" : "square", "water" : "circle", "iced tea" : "triangleUp"}. Attribute values listed in the matchRules object will be reserved only for the matching categories when getAttributeValue is called. |
Methods
-
addMatchRule(category, attributeValue)
-
Reserves an attribute value for the given category
Parameters:
Name Type Description category
String Used for checking inputs to getAttributeValue against when assigning an attribute value attributeValue
String The attribute value to assign for inputs matching the given category e.g. "square" or "circle" - Source:
-
getCategoryAssignments() → {Array}
-
Returns the current map of key value pairs for categories and the assigned attribute values
- Source:
Returns:
The current list of category and value pairing- Type
- Array
-
getValue(category) → {Object}
-
Assigns the given category an attribute value. Will consistently return the same attribute value for equal categories.
Parameters:
Name Type Description category
Object The category to assign - Source:
Returns:
The attribute value for the category- Type
- Object
-
getValueRamp() → {Array}
-
Returns the array of possible attribute values for this attribute group handler. This array can be modified so subclasses should return a copy of its internal value ramp.
- Source:
Returns:
The array of attribute values- Type
- Array