Packageflare.scale
Classpublic class QuantileScale
InheritanceQuantileScale Inheritance Scale

Scale that organizes data into discrete bins by quantiles. For example, the quantile scale can be used to create a discrete size encoding by statistically dividing the data into bins. Quantiles are computed using the flare.util.Maths.quantile method.

See also

flare.util.Maths.quantile


Public Properties
 PropertyDefined by
  flush : Boolean
Flag indicating if the scale bounds should be flush with the data.
QuantileScale
 InheritedlabelFormat : String
Formatting pattern for formatting labels for scale values.
Scale
  max : Object
[read-only] The maximum data value backing this scale.
QuantileScale
  min : Object
[read-only] The minimum data value backing this scale.
QuantileScale
  scaleType : String
[read-only] A string indicating the type of scale this is.
QuantileScale
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
  
QuantileScale(n:int, values:Array, sorted:Boolean = false, labelFormat:String)
Creates a new QuantileScale.
QuantileScale
  
Returns a cloned copy of the scale.
QuantileScale
  
interpolate(value:Object):Number
Returns an interpolation fraction indicating the position of the input value within the scale range.
QuantileScale
 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.
QuantileScale
  
values(num:int = -1):Array
Returns a set of label values for this scale.
QuantileScale
Property detail
flushproperty
flush:Boolean  [read-write]

Flag indicating if the scale bounds should be flush with the data. If true, the scale should be flush with the data range, such that the min and max values should sit directly on the extremes of the scale. If false, the scale should be padded as needed to make the scale more readable and human-friendly.

Implementation
    public function get flush():Boolean
    public function set flush(value:Boolean):void
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
scaleTypeproperty 
scaleType:String  [read-only]

A string indicating the type of scale this is.

Implementation
    public function get scaleType():String
Constructor detail
QuantileScale()constructor
public function QuantileScale(n:int, values:Array, sorted:Boolean = false, labelFormat:String)

Creates a new QuantileScale.

Parameters
n:int — the number of quantiles desired
 
values:Array — the data values to organized into quantiles
 
sorted:Boolean (default = false) — flag indicating if the input values array is already pre-sorted
 
labelFormat:String — 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.
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