| Package | flare.vis.data |
| Class | public class DataList |
| Inheritance | DataList flash.utils.Proxy |
| Implements | flash.events.IEventDispatcher |
DataSprite instances.
Items contained in this list can be accessed using array notation
([]), iterated over using the for each
construct, or can be processed by passing a visitor function to the
visit method.
Data lists provide methods for sorting elements both in a one-time
and persistent fashion, for setting the properties of contained
items in a batch-processing style (see the setProperty
and setProperties methods), and for computing and
caching summary statistics of data variables (see the
stats method.
Data lists also support listeners for add and remove events. These
events are fired before the add or remove is executed. These
data events can be canceled by calling preventDefault()
on the DataEvent object, thereby preventing the add or
remove from being performed. Using this mechanism, clients can add
custom constraints on the contents of a data list by adding new
listeners that monitor add and remove events and cancel them when
desired.
| Property | Defined by | ||
|---|---|---|---|
| length : int [read-only] The number of items contained in this list.
| DataList | ||
| list : Array [read-only] The underlying array storing the list.
| DataList | ||
| name : String [read-only] The name of this data list.
| DataList | ||
| sort : Sort
A standing sort criteria for items in the list.
| DataList | ||
| Method | Defined by | ||
|---|---|---|---|
|
DataList(name:String)
Creates a new DataList instance.
| DataList | ||
|
Add a DataSprite to the list.
| DataList | ||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
| DataList | ||
|
Creates a new adjacency matrix representing the connections between
items in this DataList.
| DataList | ||
|
applyDefaults(o:Object):void
Applies the default values to an object.
| DataList | ||
|
clear():Boolean
Remove all DataSprites from this list.
| DataList | ||
|
clearDefaults():void
Clears all default value settings for this list.
| DataList | ||
|
clearStats(field:String):void
Clears any cached stats for the given field.
| DataList | ||
|
contains(d:DataSprite):Boolean
Indicates if the given object is contained in this list.
| DataList | ||
|
dispatchEvent(event:Event):Boolean
| DataList | ||
|
Creates a new distance matrix based on a distance function.
| DataList | ||
|
hasEventListener(type:String):Boolean
| DataList | ||
|
remove(d:DataSprite):Boolean
Remove a data sprite from the list.
| DataList | ||
|
removeAt(idx:int):DataSprite
Remove a DataSprite from the list.
| DataList | ||
|
removeDefault(name:String):void
Removes a default value for newly created items.
| DataList | ||
|
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
| DataList | ||
|
setDefault(name:String, value:*):void
Sets a default property value for newly created items.
| DataList | ||
|
setDefaults(values:Object):void
Sets default values for newly created items.
| DataList | ||
|
setLater(vals:Object, filter:* = null):Function
A function generator that can be used to set properties
at a later time.
| DataList | ||
|
setProperties(vals:Object, t:* = null, filter:* = null):Transitioner
Sets property values on all sprites in a given group.
| DataList | ||
|
setProperty(name:String, value:*, t:* = null, filter:* = null):Transitioner
Sets a property value on all items in the list.
| DataList | ||
|
sortBy(... args):void
Sort DataSprites according to their properties.
| DataList | ||
|
Computes and caches statistics for a data field.
| DataList | ||
|
toDataArray():Array
Returns an array of data objects for each item in this data list.
| DataList | ||
|
visit(visitor:Function, filter:Boolean = null, reverse:* = false):Boolean
Iterates over the contents of the list, invoking a visitor function
on each element of the list.
| DataList | ||
|
willTrigger(type:String):Boolean
| DataList | ||
| length | property |
length:int [read-only]The number of items contained in this list.
Implementation public function get length():int
| list | property |
list:Array [read-only]The underlying array storing the list.
Implementation public function get list():Array
| name | property |
name:String [read-only]The name of this data list.
Implementation public function get name():String
| sort | property |
sort:Sort [read-write]A standing sort criteria for items in the list.
Implementation public function get sort():Sort
public function set sort(value:Sort):void
| DataList | () | constructor |
public function DataList(name:String)Creates a new DataList instance.
Parametersname:String — indicates if this list should be publicly editable.
|
| add | () | method |
public function add(d:DataSprite):DataSpriteAdd a DataSprite to the list.
Parametersd:DataSprite — the DataSprite to add
|
DataSprite —
the added DataSprite, or null if the add failed
|
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
| adjacencyMatrix | () | method |
public function adjacencyMatrix(w:Function = null, mat:IMatrix = null):IMatrix
Creates a new adjacency matrix representing the connections between
items in this DataList. This method should only be applied when the
items contained in this list are NodeSprite instances.
The method takes an optional function to compute edge weights.
w:Function (default = null) — the edge weight function. This function should take an
EdgeSprite as input and return a Number.
|
|
mat:IMatrix (default = null) — a matrix instance in which to store the adjacency matrix
values. If this value is null, a new DenseMatrix will
be constructed.
|
IMatrix —
the adjacency matrix
|
| applyDefaults | () | method |
public function applyDefaults(o:Object):voidApplies the default values to an object.
Parameterso:Object — the object on which to set the default values
|
| clear | () | method |
public function clear():BooleanRemove all DataSprites from this list.
ReturnsBoolean |
| clearDefaults | () | method |
public function clearDefaults():voidClears all default value settings for this list.
| clearStats | () | method |
public function clearStats(field:String):voidClears any cached stats for the given field.
Parametersfield:String — the data field to clear the stats for.
|
| contains | () | method |
public function contains(d:DataSprite):BooleanIndicates if the given object is contained in this list.
Parametersd:DataSprite — the object to check for containment
|
Boolean — true if the list contains the object, false otherwise.
|
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):BooleanParameters
event:Event |
Boolean |
| distanceMatrix | () | method |
public function distanceMatrix(d:Function, mat:IMatrix = null):IMatrixCreates a new distance matrix based on a distance function.
Parametersd:Function — the distance function. This should take two
DataSprite instances and return a Number
|
|
mat:IMatrix (default = null) — a matrix instance in which to store the adjacency matrix
values. If this value is null, a new DenseMatrix will
be constructed.
|
IMatrix —
the distance matrix
|
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanParameters
type:String |
Boolean |
| remove | () | method |
public function remove(d:DataSprite):BooleanRemove a data sprite from the list.
Parametersd:DataSprite — the DataSprite to remove
|
Boolean — true if the object was found and removed, false otherwise
|
| removeAt | () | method |
public function removeAt(idx:int):DataSpriteRemove a DataSprite from the list.
Parametersidx:int — the index of the DataSprite to remove
|
DataSprite —
the removed DataSprite
|
| removeDefault | () | method |
public function removeDefault(name:String):voidRemoves a default value for newly created items.
Parametersname:String — the name of the property
|
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
| setDefault | () | method |
public function setDefault(name:String, value:*):voidSets a default property value for newly created items.
Parametersname:String — the name of the property
|
|
value:* — the value of the property
|
| setDefaults | () | method |
public function setDefaults(values:Object):voidSets default values for newly created items.
Parametersvalues:Object — the default properties to set
|
| setLater | () | method |
public function setLater(vals:Object, filter:* = null):Function
A function generator that can be used to set properties
at a later time. This method returns a function that can
accept a Transitioner as its sole argument and then
executes the setProperties method.
vals:Object — an object containing the properties and values to set.
This is treated the same as the setProperties method.
|
|
filter:* (default = null) — an optional Boolean-valued filter function for
limiting which items are visited
|
Function — a function that accepts a Transitioner argument
and runs setProperties.
|
| setProperties | () | method |
public function setProperties(vals:Object, t:* = null, filter:* = null):Transitioner
Sets property values on all sprites in a given group. The values
within the vals argument can take a number of forms:
Function, it will be evaluated
for each element and the result will be used as the property
value for that element.IEvaluable instance, such as
flare.util.Property or
flare.query.Expression, it will be evaluated for
each element and the result will be used as the property value
for that element.vals:Object — an object containing the properties and values to set.
|
|
t:* (default = null) — a transitioner or time span for updating object values. If
the input is a transitioner, it will be used to store the updated
values. If the input is a number, a new Transitioner with duration
set to the input value will be used. The input is null by default,
in which case object values are updated immediately.
|
|
filter:* (default = null) — an optional Boolean-valued filter function for
limiting which items are visited
|
Transitioner —
the transitioner used to update the values
|
| setProperty | () | method |
public function setProperty(name:String, value:*, t:* = null, filter:* = null):TransitionerSets a property value on all items in the list. The value can take a number of forms:
Function, it will be evaluated
for each element and the result will be used as the property
value for that element.IEvaluable instance, such as
flare.util.Property or
flare.query.Expression, it will be evaluated for
each element and the result will be used as the property value
for that element.name:String — the name of the property
|
|
value:* — the value of the property
|
|
t:* (default = null) — a transitioner or time span for updating object values. If
the input is a transitioner, it will be used to store the updated
values. If the input is a number, a new Transitioner with duration
set to the input value will be used. The input is null by default,
in which case object values are updated immediately.
|
|
filter:* (default = null) — an optional Boolean-valued filter function for
limiting which items are visited
|
Transitioner —
the transitioner used to update the values
|
| sortBy | () | method |
public function sortBy(... args):void
Sort DataSprites according to their properties. This method performs
a one-time sorting. To establish a consistent sort order robust over
the addition of new items, use the sort property.
... args — the sort arguments.
If a String is provided, the data will be sorted in ascending order
according to the data field named by the string.
If an Array is provided, the data will be sorted according to the
fields in the array. In addition, field names can optionally
be followed by a boolean value. If true, the data is sorted in
ascending order (the default). If false, the data is sorted in
descending order.
|
| stats | () | method |
public function stats(field:String):Stats
Computes and caches statistics for a data field. The resulting
Stats object is cached, so that later access does not
require any re-calculation. The cache of statistics objects may be
cleared, however, if changes to the data set are made.
field:String — the property name
|
Stats —
a Stats object with the computed statistics
|
| toDataArray | () | method |
public function toDataArray():ArrayReturns an array of data objects for each item in this data list. Data objects are retrieved from the "data" property for each item.
ReturnsArray — an array of data objects for items in this data list
|
| visit | () | method |
public function visit(visitor:Function, filter:Boolean = null, reverse:* = false):BooleanIterates over the contents of the list, invoking a visitor function on each element of the list. If the visitor function returns a Boolean true value, the iteration will stop with an early exit.
Parametersvisitor:Function — the visitor function to be invoked on each item
|
|
filter:Boolean (default = null) — an optional boolean-valued function indicating which
items should be visited
|
|
reverse:* (default = false) — optional flag indicating if the list should be
visited in reverse order
|
Boolean — true if the visitation was interrupted with an early exit
|
| willTrigger | () | method |
public function willTrigger(type:String):BooleanParameters
type:String |
Boolean |
| add | event |
| remove | event |