Tour API Demos Download Tests
Aperture version 1.0
Generated by: JsDoc Toolkit 2.4.0

Class aperture.MapKey

A MapKey object maps from a Range object, representing a variable in data, to a color or numeric visual property such as a size or coordinate. MapKey is abstract. Instances are constructed by calling range.mappedTo(), and are used by mappings.

Method Summary

Method Detail

  • {aperture.Range} from()
    Returns the Range object that this maps from.
    Returns:
    {aperture.Range}
  • {String} label(value)
    A label for this map key reflecting the data property being mapped in readable form. This value is initialized from the label in the range but may be subsequently changed here.
    Parameters:
    {String} value
    If a parameter given, acts as a setter and sets the label.
    Returns:
    {String} If no parameter given, returns the MapKey's label. Otherwise sets and returns the label.
  • map(dataValue)
    Returns a visual property value mapped from a data value. This method is abstract and implemented by different types of map keys.
    Parameters:
    dataValue
    the value to be mapped using the key.
    Returns:
    the result of the mapping.
  • {Array} to()
    Returns the set of values that this maps to.
    Returns:
    {Array}
  • {this|Function} type(type)
    This method is mostly relevant to scalar mappings, where it can be used to set a non-linear mapping function. A string can be passed indicating a standard non linear-function, or a custom function may be supplied. Standard types include 'linear' and 'area', for area based visual properties (such as a circle's radius).

    An ordinal map key returns a type of 'ordinal'.
    Parameters:
    {String|Function} type Optional
    if setting the value, the type of mapping function which will map the progression of 0 to 1 input values to 0 to 1 output values, or a custom function.
    Returns:
    {this|Function} if getting the mapping function, the type or custom function, else if setting the function a reference to this is returned for convenience of chaining method calls.