Packageflare.scale
Classpublic class OrdinalScale
InheritanceOrdinalScale Inheritance Scale

Scale for ordered sequential data. This supports both numeric and non-numeric data, and simply places each element in sequence using the ordering found in the input data array.



Public Properties
 PropertyDefined by
 Inheritedflush : Boolean
Flag indicating if the scale bounds should be flush with the data.
Scale
 InheritedlabelFormat : String
Formatting pattern for formatting labels for scale values.
Scale
  length : int
[read-only] The number of distinct values in this scale.
OrdinalScale
  max : Object
[read-only] The maximum data value backing this scale.
OrdinalScale
  min : Object
[read-only] The minimum data value backing this scale.
OrdinalScale
  ordinals : Array
The ordered data array defining this scale.
OrdinalScale
  scaleType : String
[read-only] A string indicating the type of scale this is.
OrdinalScale
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
  
OrdinalScale(ordinals:Array = null, flush:Boolean = false, copy:Boolean = true, labelFormat:String = null)
Creates a new OrdinalScale.
OrdinalScale
  
Returns a cloned copy of the scale.
OrdinalScale
  
index(value:Object):int
Returns the index of the input value in the ordinal array
OrdinalScale
  
interpolate(value:Object):Number
Returns an interpolation fraction indicating the position of the input value within the scale range.
OrdinalScale
 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.
OrdinalScale
  
values(num:int = -1):Array
Returns a set of label values for this scale.
OrdinalScale
Protected Methods
 MethodDefined by
  
buildLookup():void
Builds a lookup table for mapping values to their indices.
OrdinalScale
Property detail
lengthproperty
length:int  [read-only]

The number of distinct values in this scale.

Implementation
    public function get length():int
maxproperty 
max:Object  [read-only]

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
minproperty 
min:Object  [read-only]

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
ordinalsproperty 
ordinals:Array  [read-write]

The ordered data array defining this scale.

Implementation
    public function get ordinals():Array
    public function set ordinals(value:Array):void
scaleTypeproperty 
scaleType:String  [read-only]

A string indicating the type of scale this is.

Implementation
    public function get scaleType():String
Constructor detail
OrdinalScale()constructor
public function OrdinalScale(ordinals:Array = null, flush:Boolean = false, copy:Boolean = true, labelFormat:String = null)

Creates a new OrdinalScale.

Parameters
ordinals:Array (default = null) — an ordered array of data values to include in the scale
 
flush:Boolean (default = false) — the flush flag for scale padding
 
copy:Boolean (default = true) — flag indicating if a copy of the input data array should be made. True by default.
 
labelFormat:String (default = null) — the formatting pattern for value labels
Method detail
buildLookup()method
protected function buildLookup():void

Builds a lookup table for mapping values to their indices.

clone()method 
public override function clone():Scale

Returns a cloned copy of the scale.

Returns
Scale — a cloned scale.
index()method 
public function index(value:Object):int

Returns the index of the input value in the ordinal array

Parameters
value:Object — the value to lookup

Returns
int — the index of the input value. If the value is not contained in the ordinal array, this method returns -1.
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.
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