Packageflare.vis.data
Classpublic class ScaleBinding
InheritanceScaleBinding Inheritance Scale

Utility class that binds a data property to a descriptive scale. A ScaleBinding provides a layer of indirection between a data field and a data scale describing that field. The created scale can be used for layout and encoding of data values. When scale parameters such as the scale type or value range are updated, an underlying scale instance will be updated accordingly or a new instance will be created as needed.



Public Properties
 PropertyDefined by
  base : Number
The number base to use for a quantitative scale (10 by default).
ScaleBinding
  bins : int
The number of bins for quantile scales.
ScaleBinding
  data : Data
The data instance to bind to.
ScaleBinding
  flush : Boolean
Flag indicating if the scale bounds should be flush with the data.
ScaleBinding
  group : String
The data group to bind to.
ScaleBinding
  ignoreUpdates : Boolean = false
If true, updates to the underlying data will be ignored, as will any calls to updateBinding.
ScaleBinding
  labelFormat : String
Formatting pattern for formatting labels for scale values.
ScaleBinding
  length : int
[read-only] The number of distinct values in this scale, if ordinal.
ScaleBinding
  max : Object
The maximum data value backing this scale.
ScaleBinding
  min : Object
The minimum data value backing this scale.
ScaleBinding
  ordinals : Array
An ordered array of values for defining an ordinal scale.
ScaleBinding
  power : Number
A free parameter that indicates the exponent for a RootScale.
ScaleBinding
  preferredMax : Object
The preferred maximum data value for the scale.
ScaleBinding
  preferredMin : Object
The preferred minimum data value for the scale.
ScaleBinding
  property : String
The data property to bind to.
ScaleBinding
  scaleType : String
The type of scale to create.
ScaleBinding
  zeroBased : Boolean
Flag indicating if a zero-based scale should be used.
ScaleBinding
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
  scale : Scale
[read-only] The underlying scale created by this binding.
ScaleBinding
Public Methods
 MethodDefined by
  
Creates a new ScaleBinding.
ScaleBinding
  
Returns a cloned copy of the scale.
ScaleBinding
  
index(value:Object):int
Returns the index of the input value in the ordinal array if the scale is ordinal or categorical, otherwise returns -1.
ScaleBinding
  
interpolate(value:Object):Number
Returns an interpolation fraction indicating the position of the input value within the scale range.
ScaleBinding
  
label(value:Object):String
Returns a string label representing a value in this scale.
ScaleBinding
  
lookup(f:Number):Object
Performs a reverse lookup, returning an object value corresponding to a interpolation fraction along the scale range.
ScaleBinding
  
updateBinding():Boolean
Checks to see if the binding is current.
ScaleBinding
  
values(num:int = -1):Array
Returns a set of label values for this scale.
ScaleBinding
Property detail
baseproperty
base:Number  [read-write]

The number base to use for a quantitative scale (10 by default).

Implementation
    public function get base():Number
    public function set base(value:Number):void
binsproperty 
bins:int  [read-write]

The number of bins for quantile scales.

Implementation
    public function get bins():int
    public function set bins(value:int):void
dataproperty 
data:Data  [read-write]

The data instance to bind to.

Implementation
    public function get data():Data
    public function set data(value:Data):void
flushproperty 
flush:Boolean  [read-write]

Flag indicating if the scale bounds should be flush with the data.

Implementation
    public function get flush():Boolean
    public function set flush(value:Boolean):void

See also

groupproperty 
group:String  [read-write]

The data group to bind to.

Implementation
    public function get group():String
    public function set group(value:String):void
ignoreUpdatesproperty 
public var ignoreUpdates:Boolean = false

If true, updates to the underlying data will be ignored, as will any calls to updateBinding. Set this flag if you want to prevent the scale values from changing automatically.

labelFormatproperty 
labelFormat:String  [read-write]

Formatting pattern for formatting labels for scale values.

Implementation
    public function get labelFormat():String
    public function set labelFormat(value:String):void

See also

flare.vis.scale.Scale.labelFormat.
lengthproperty 
length:int  [read-only]

The number of distinct values in this scale, if ordinal.

Implementation
    public function get length():int
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
ordinalsproperty 
ordinals:Array  [read-write]

An ordered array of values for defining an ordinal scale.

Implementation
    public function get ordinals():Array
    public function set ordinals(value:Array):void
powerproperty 
power:Number  [read-write]

A free parameter that indicates the exponent for a RootScale.

Implementation
    public function get power():Number
    public function set power(value:Number):void
preferredMaxproperty 
preferredMax:Object  [read-write]

The preferred maximum data value for the scale. If null, the scale maximum will be determined from the data directly.

Implementation
    public function get preferredMax():Object
    public function set preferredMax(value:Object):void
preferredMinproperty 
preferredMin:Object  [read-write]

The preferred minimum data value for the scale. If null, the scale minimum will be determined from the data directly.

Implementation
    public function get preferredMin():Object
    public function set preferredMin(value:Object):void
propertyproperty 
property:String  [read-write]

The data property to bind to.

Implementation
    public function get property():String
    public function set property(value:String):void
scaleproperty 
scale:Scale  [read-only]

The underlying scale created by this binding.

Implementation
    protected function get scale():Scale
scaleTypeproperty 
scaleType:String  [read-write]

The type of scale to create.

Implementation
    public function get scaleType():String
    public function set scaleType(value:String):void
zeroBasedproperty 
zeroBased:Boolean  [read-write]

Flag indicating if a zero-based scale should be used. If set to true, and the scale type is numerical, the minimum or maximum scale value will automatically be adjusted to include the zero point as necessary.

Implementation
    public function get zeroBased():Boolean
    public function set zeroBased(value:Boolean):void
Constructor detail
ScaleBinding()constructor
public function ScaleBinding()

Creates a new ScaleBinding.

Method detail
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 if the scale is ordinal or categorical, otherwise returns -1.

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
label()method 
public override function label(value:Object):String

Returns a string label representing a value in this scale. The labelFormat property determines how the value will be formatted.

Parameters
value:Object — the data value to get the string label for

Returns
String — a string label for the value
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.
updateBinding()method 
public function updateBinding():Boolean

Checks to see if the binding is current. If not, the internal stats and scale for this binding will be cleared and lazily recomputed.

Returns
Boolean — true if the binding was updated, false otherwise
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