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

Class aperture.TimeScalar

Extends a scalar model property range with modest specialization of formatting and banding for JavaScript Dates. Dates are mappable by time by simple scalars as well, however this class is more appropriate for determining and labeling bands within a scalar range. When banded, default date formatting is used (for the purposes of axis labeling) unless explicitly overridden in the banded view.

Class Summary
Constructor Attributes Constructor Name and Description
 
aperture.TimeScalar(name, values)
Constructs a new scalar time range.

Method Summary

Class Detail

aperture.TimeScalar(name, values)
Constructs a new scalar time range.
Parameters:
{String} name
the name of the property described.
{Array|Number|String|Date} values Optional
an optional array of values (or a single value) with which to populate the range. Equivalent to calling expand after construction.
Returns:
{this} a new Scalar

Method Detail

  • {aperture.TimeScalar} banded(bands, roundTo)
    Overrides the implementation in Scalar to expect a units field if the band specification object option is exercised. The units field in that case will be a string for the span, corresponding to the exact name of a common field in the Date class. For example:
    // band every three years
    myTimeRange.banded( {
        span: 3,
        units: 'FullYear',
    };
    Parameters:
    {Number|Object|Array} bands Optional, Default: 1(minimum)
    the approximate count of bands to create, OR a band specification object containing a span field indicating the regular interval for bands, OR an array of predefined bands supplied as objects with min and label properties, in ascending order. If this value is not supplied one band will be created, or two if the range extents span zero.
    {boolean} roundTo Optional, Default: true
    whether or not to round the range extents to band edges
    Returns:
    {aperture.TimeScalar} a new view of this Range, with limitations on further view creation.