Packageflare.scale
Classpublic class TimeScale
InheritanceTimeScale Inheritance Scale

Scale for timelines represented using Date values. This scale represents a linear, quantitative time line. The class attempts to automatically configure date value labels based on the time span between the earliest and latest date in the scale. The label formatting pattern can also be manually set using the labelFormat property.



Public Properties
 PropertyDefined by
  dataMax : Date
The maximum (latest) Date value in the underlying data.
TimeScale
  dataMin : Date
The minimum (earliest) Date value in the underlying data.
TimeScale
  flush : Boolean
[write-only]
TimeScale
  labelFormat : String
Formatting pattern for formatting labels for scale values.
TimeScale
  max : Object
The maximum data value backing this scale.
TimeScale
  min : Object
The minimum data value backing this scale.
TimeScale
  scaleMax : Date
[read-only] The maximum (latest) Date value in the underlying data.
TimeScale
  scaleMin : Date
[read-only] The minimum (earliest) Date value in the scale.
TimeScale
  scaleType : String
[read-only] A string indicating the type of scale this is.
TimeScale
Protected Properties
 PropertyDefined by
 Inherited_flush : Boolean = false
Flag indicating if the scale bounds should be flush with the data.
Scale
 Inherited_format : String = "null"
Formatting pattern for formatting labels for scale values.
Scale
Public Methods
 MethodDefined by
  
TimeScale(min:Date = null, max:Date = null, flush:Boolean = false, labelFormat:String = null)
Creates a new TimeScale.
TimeScale
  
Returns a cloned copy of the scale.
TimeScale
  
interpolate(value:Object):Number
Returns an interpolation fraction indicating the position of the input value within the scale range.
TimeScale
 Inherited
label(value:Object):String
Returns a string label representing a value in this scale.
Scale
  
lookup(f:Number):Object
Performs a reverse lookup, returning an object value corresponding to a interpolation fraction along the scale range.
TimeScale
  
values(num:int = -1):Array
Returns a set of label values for this scale.
TimeScale
Protected Methods
 MethodDefined by
  
formatString(span:int):String
Determines the format string to be used based on a measure of the time span covered by this scale.
TimeScale
  
updateScale():void
Updates the scale range when the data range is changed.
TimeScale
Property detail
dataMaxproperty
dataMax:Date  [read-write]

The maximum (latest) Date value in the underlying data. This property is the same as the maximum property, but properly typed.

Implementation
    public function get dataMax():Date
    public function set dataMax(value:Date):void
dataMinproperty 
dataMin:Date  [read-write]

The minimum (earliest) Date value in the underlying data. This property is the same as the minimum property, but properly typed.

Implementation
    public function get dataMin():Date
    public function set dataMin(value:Date):void
flushproperty 
flush:Boolean  [write-only]

Implementation
    public function set flush(value:Boolean):void
labelFormatproperty 
labelFormat:String  [read-write]

Formatting pattern for formatting labels for scale values. For details about the various formatting patterns, see the documentation for the Strings.format method.

Implementation
    public function get labelFormat():String
    public function set labelFormat(value:String):void
maxproperty 
max:Object  [read-write]

The maximum data value backing this scale. Note that the actual maximum scale value may be higher if the scale is not flush.

Implementation
    public function get max():Object
    public function set max(value:Object):void
minproperty 
min:Object  [read-write]

The minimum data value backing this scale. Note that the actual minimum scale value may be lower if the scale is not flush.

Implementation
    public function get min():Object
    public function set min(value:Object):void
scaleMaxproperty 
scaleMax:Date  [read-only]

The maximum (latest) Date value in the underlying data.

Implementation
    public function get scaleMax():Date
scaleMinproperty 
scaleMin:Date  [read-only]

The minimum (earliest) Date value in the scale.

Implementation
    public function get scaleMin():Date
scaleTypeproperty 
scaleType:String  [read-only]

A string indicating the type of scale this is.

Implementation
    public function get scaleType():String
Constructor detail
TimeScale()constructor
public function TimeScale(min:Date = null, max:Date = null, flush:Boolean = false, labelFormat:String = null)

Creates a new TimeScale.

Parameters
min:Date (default = null) — the minimum (earliest) date value
 
max:Date (default = null) — the maximum (latest) date value
 
flush:Boolean (default = false) — the flush flag for scale padding
 
labelFormat:String (default = null) — the formatting pattern for value labels
Method detail
clone()method
public override function clone():Scale

Returns a cloned copy of the scale.

Returns
Scale — a cloned scale.
formatString()method 
protected function formatString(span:int):String

Determines the format string to be used based on a measure of the time span covered by this scale.

Parameters
span:int — the time span covered by this scale. Should use the format of the flare.util.Dates class.

Returns
String — the label formatting pattern
interpolate()method 
public override function interpolate(value:Object):Number

Returns an interpolation fraction indicating the position of the input value within the scale range.

Parameters
value:Object — a data value for which to return an interpolation fraction along the data scale

Returns
Number — the interpolation fraction of the value in the data scale
lookup()method 
public override function lookup(f:Number):Object

Performs a reverse lookup, returning an object value corresponding to a interpolation fraction along the scale range.

Parameters
f:Number — the interpolation fraction

Returns
Object — the scale value at the interpolation fraction. May return null if no value corresponds to the input fraction.
updateScale()method 
protected function updateScale():void

Updates the scale range when the data range is changed.

values()method 
public override function values(num:int = -1):Array

Returns a set of label values for this scale.

Parameters
num:int (default = -1) — a desired target number of labels. This parameter is handled idiosyncratically by different scale sub-classes.

Returns
Array — an array of label values for the scale